stm32 uses HID to connect to the computer, and has two endpoints, one for communication with the host computer and one for the keyboard. Adopt the matrix keyboard scanning idea and add diodes for full-key rollover. The download port and serial port are lead out separately and can be used for debugging. The ws2812 lamp is controlled by spi and dma. Use at20c64 as storage. It refers to the source code of many big guys, so the code may be a bit messy.
Because the price of stm32f103c8t6 has increased significantly, I started to buy domestic HK, but in the end I found that the USB could not be used.
The welding level in the early stage was too low, so I bought c8t6 and the welding failed. Finally, I bought stm32febkc6t6, which is a special chip for electric vehicles, but it is actually pin to pin compatible and completely replaces f103c6t6. It is super cheap, but the memory and storage are too small, only 10/ 32kb, which is a bit smaller than the 20/64 of c8, and the spi2 port used by ws2812 at the beginning of the design. C6 does not have spi2..., rgb cannot be realized, and the idea of using pwm was not realized in the end.
I don’t know why I selected 10k for the sda and scl pull-ups. Every time I connected the monitor, the at20c64 failed. After troubleshooting for a long time, I finally broke the oled12832. Therefore, it actually shows that there is still something wrong with the upper computer, and the lower computer has not been debugged. , first use it as no screen
Cubemx will reset the USB every time it is configured. It is recommended to save the Middlewares and USB_DEVICE folders before generating code for each configuration, and replace the files after the code generation is completed.
Because I was poor (lazy), I corrected some errors in the circuit diagram. I changed the ws2812 control spi2 to spi1 and reserved the pwm control. Therefore, the actual code needs to be fine-tuned. If you use c6t6, you can use the branch newf103c6. If you use c8t6, use the branch newf103c8. It needs to be modified. The places are as follows 1.
The original knobs used pa5 and pa6, and the new ones use pa10 and pa11. It is necessary to reset pa11 as interrupt trigger and pa10 input. Both are drop-down programs. Change as follows. Replace pa5 and pa6 in main.h.
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { if (GPIO_Pin == GPIO_PIN_6) { //ec11 knob data delay_us(100); //printf("145 "); if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_6) == 1) { if (HAL_GPIO_ReadPin (GPIOA, GPIO_PIN_5) == 1) { //clockwise//delay_ms(10); knobkey_send(0); } else { //counterclockwise knobkey send(1); } } _HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_6); } }
2. Configure spi2 to spi1. The configuration parameters are the same. Turn on dma and the speed is 2.25m. Change hspi2 in ws2812.c to hspi1. There are two places. 3. Turn on the screen
Delete the second return of void Info_Deal_Display(void) in infoDeal.c
The main maintenance is still on the c8t6 version, and the bugs are also mainly fixed on c8t6. After all, the space is larger, c6t6 can be used, and can realize basic keyboard functions. The light has not been verified because there is no spi2. Although it was changed to spi1 later, it has not been boarded yet.
Using C# programming, administrator rights are used to obtain the cpu temperature, net4.5, after all, for the sake of functionality, it is actually quite ugly.
The code is open source on the host computer on the code cloud: https://gitee.com/wanglifree/customized_keyboard_csharp.git Microcontroller: https://gitee.com/wanglifree/stm32_customized_keyboard.git Please check the branch 3D printing shell: https://gitee. com/wanglifree/customized_keyboard_3dmode.git edited by sw2016, the stl has been exported and can be printed directly
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet