关于瀚文键监休眠后全键唤醒方案的讨论以及HID键盘报文17字节切换标准8字节的请教

作者: Wangzm007创建于 2022年11月28日更新于 2024年6月26日
  1. The original connection method of HANWEN wants to wake up from the sleep state, which requires a button like the Fn key, with an I/O connected to the pull-up end of the button, but the I/O port is limited and cannot wake up with all keys. image 1.1 So I thought of the following two connection methods to solve the problem: Scheme 1: Unify the ground end of the original button to an I/O port of the single-chip microcomputer, and the I/O port outputs a low level in the normal state, and is reinitialized to the input state when entering the sleep state, enabling the interrupt; in the interrupt processing program, exit the sleep state and reinitialize to the output low level state. 1.2 Scheme 2: Derived from 1, Port A specifically controls the connection and disconnection of the CMOS, and Port B interrupts the input judgment: in the normal state, Port A controls the connection of the CMOS, and Port B disables the interrupt enable; when entering the sleep state, disconnect the CMOS and enable the B interrupt input enable. When exiting the sleep state, the state can be switched. image 1.3 The shortcomings of the two schemes are that the button that is first awakened after the sleep may not output to the PC side (the above scheme is only discussed and not verified). 1.4 I have a temporary immature idea here, that in the HANWEN original scheme, what state is the 74HC165 in when the single-chip microcomputer is in the sleep state? When a button is pressed, will the 74HC165 output a pulse or level to the MCU, and if so, can the MCU-related I/O port be changed to an interrupt input, and initialized to SPI in the normal state, and to an interrupt input in the sleep state to achieve full-key awakening (it is just a thought, and my programming level cannot verify it). -------------------------------------------------------------------------------------------------------- 2. I learned that the general HID keyboard is 8-byte message (6 keys without pulse) in order to be compatible with use in the BIOS interface, that is, the third byte: 0x04 is a, 0x05 is b, 0x06 is c, and so on; the HANWEN keyboard is 17-bit bit representation (full-key without pulse), the third byte: 0x10 is a, 0x20 is b, 0x40 is c, and so on. However, I saw a comment that the HANWEN keyboard can be used in the BIOS interface, so I would like to ask UP if HANWEN can switch between the two formats, so that HANWEN switches to the 1ms hard message mode when connected to the system via a wired connection, and switches to the 8-byte message compatible mode in other states (such as BIOS, wireless Bluetooth, 2.4G connection); if it is possible, where should it be switched, or where should I modify the way to add the 8-byte message in the program?

内容来源: peng-zhihui/HelloWord-Keyboard