Skip to content

Commit

Permalink
add adc and extern the uart buffer for f401 wm28
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaxin96 committed Jun 16, 2021
1 parent 3c0dbc5 commit 278d0e7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
9 changes: 9 additions & 0 deletions keyboards/yandrstudio/whiteMouse28T/f401/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,13 @@
#endif


#define SERIAL_DRIVER SD1
#define SD1_TX_PIN A9
#define SD1_TX_PAL_MODE 7
#define SD1_RX_PIN A10
#define SD1_RX_PAL_MODE 7


#define ADC_RESOLUTION ADC_CFGR1_RES_12BIT


10 changes: 8 additions & 2 deletions keyboards/yandrstudio/whiteMouse28T/f401/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@
#define HAL_USE_SERIAL TRUE

#undef HAL_USE_SPI
#define HAL_USE_SPI TRUE
#define HAL_USE_SPI FALSE

#undef HAL_USE_ADC
#define HAL_USE_ADC TRUE

#undef SERIAL_USB_BUFFERS_SIZE

#undef SERIAL_USB_BUFFERS_SIZE
#define SERIAL_USB_BUFFERS_SIZE 256

#undef SERIAL_BUFFERS_SIZE
#define SERIAL_BUFFERS_SIZE 128

#undef SPI_USE_WAIT
#define SPI_USE_WAIT TRUE

Expand Down
6 changes: 5 additions & 1 deletion keyboards/yandrstudio/whiteMouse28T/f401/mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@
#define STM32_PWM_USE_TIM3 TRUE

#undef STM32_SPI_USE_SPI1
#define STM32_SPI_USE_SPI1 TRUE
#define STM32_SPI_USE_SPI1 FALSE

#undef STM32_SERIAL_USE_USART1
#define STM32_SERIAL_USE_USART1 TRUE


#undef STM32_ADC_USE_ADC1
#define STM32_ADC_USE_ADC1 TRUE

#undef STM32_NO_INIT
#undef STM32_HSI_ENABLED
#undef STM32_LSI_ENABLED
Expand Down
14 changes: 8 additions & 6 deletions keyboards/yandrstudio/whiteMouse28T/f401/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ RGB_MATRIX_DRIVER = WS2812
# RGBLIGHT_DRIVER = WS2812
WS2812_DRIVER = pwm

EEPROM_DRIVER = spi
# EEPROM_DRIVER = custom
# SRC += eep/eeprom_stm32.c
# SRC += eep/flash_stm32.c
# OPT_DEFS += -DEEPROM_EMU_STM32F401xC
# COMMON_VPATH += keyboards/yandrstudio/whiteMouse28T/f401/eep
# EEPROM_DRIVER = spi
EEPROM_DRIVER = custom
SRC += eep/eeprom_stm32.c
SRC += eep/flash_stm32.c
OPT_DEFS += -DEEPROM_EMU_STM32F401xC
COMMON_VPATH += keyboards/yandrstudio/whiteMouse28T/f401/eep

SRC += analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include QMK_KEYBOARD_H
#include "uart.h"
#include "print.h"
#include "analog.h"


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
Expand Down Expand Up @@ -49,6 +50,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
uart_putchar(keycode >> 8);
uart_putchar(keycode & 0xff);
uart_putchar(0xfe);
uprintf("Adc read: %d\n", analogReadPinAdc(A4,0));
uprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u, interrupt: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
}
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VIA_ENABLE = yes

QUANTUM_LIB_SRC += uart.c

0 comments on commit 278d0e7

Please sign in to comment.