Skip to content

Commit

Permalink
Enable wear leveling spi flash eeprom for feather f405
Browse files Browse the repository at this point in the history
  • Loading branch information
drashna committed Nov 13, 2024
1 parent bb5318b commit b8eb7e2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
13 changes: 13 additions & 0 deletions keyboards/handwired/feather_stm32f405_express/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,16 @@
#define DRV2605L_FB_ERM_LRA 0
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_BUZZ_1_100

/* spi config for eeprom and pmw3360 sensor */
#define SPI_DRIVER SPID1
#define SPI_SCK_PIN B3
#define SPI_SCK_PAL_MODE 5
#define SPI_MOSI_PIN B5
#define SPI_MOSI_PAL_MODE 5
#define SPI_MISO_PIN B4
#define SPI_MISO_PAL_MODE 5

#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN A15
#define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 32 // 16 or less doesn't work right
#define EXTERNAL_FLASH_SIZE (2 * 1024 * 1024)
5 changes: 5 additions & 0 deletions keyboards/handwired/feather_stm32f405_express/halconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@

#define HAL_USE_I2C TRUE

#if HAL_USE_SPI == TRUE
# define SPI_USE_WAIT TRUE
# define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif

#include_next <halconf.h>
7 changes: 7 additions & 0 deletions keyboards/handwired/feather_stm32f405_express/keyboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"haptic": {
"driver": "drv2605l"
},
"eeprom": {
"wear_leveling": {
"driver": "spi_flash",
"logical_size": 16384,
"backing_size": 65536
}
},
"matrix_pins": {
"cols": [null, null, null, null],
"rows": [null, null, null, null]
Expand Down
12 changes: 12 additions & 0 deletions keyboards/handwired/feather_stm32f405_express/mcuconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,15 @@

#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE


#if HAL_USE_SPI == TRUE
# undef STM32_SPI_USE_SPI1
# define STM32_SPI_USE_SPI1 TRUE

# undef STM32_SPI_SPI1_TX_DMA_STREAM
# define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
# undef STM32_SPI_SPI1_RX_DMA_STREAM
# define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)

#endif

0 comments on commit b8eb7e2

Please sign in to comment.