mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-25 01:47:10 +06:00
Consolidate some EEPROM Driver configuration (#22321)
This commit is contained in:
parent
79094d3f72
commit
bf6f13a2b0
|
@ -66,6 +66,14 @@ Currently QMK supports 25xx-series chips over SPI. As such, requires a working s
|
||||||
`#define EXTERNAL_EEPROM_PAGE_SIZE` | `32` | Page size of the EEPROM in bytes, as specified in the datasheet
|
`#define EXTERNAL_EEPROM_PAGE_SIZE` | `32` | Page size of the EEPROM in bytes, as specified in the datasheet
|
||||||
`#define EXTERNAL_EEPROM_ADDRESS_SIZE` | `2` | The number of bytes to transmit for the memory location within the EEPROM
|
`#define EXTERNAL_EEPROM_ADDRESS_SIZE` | `2` | The number of bytes to transmit for the memory location within the EEPROM
|
||||||
|
|
||||||
|
Default values and extended descriptions can be found in `drivers/eeprom/eeprom_spi.h`.
|
||||||
|
|
||||||
|
Alternatively, there are pre-defined hardware configurations for available chips/modules:
|
||||||
|
|
||||||
|
Module | Equivalent `#define` | Source
|
||||||
|
-----------------|---------------------------------|------------------------------------------
|
||||||
|
MB85RS64V FRAM | `define EEPROM_SPI_MB85RS64V` | <https://www.adafruit.com/product/1897>
|
||||||
|
|
||||||
!> There's no way to determine if there is an SPI EEPROM actually responding. Generally, this will result in reads of nothing but zero.
|
!> There's no way to determine if there is an SPI EEPROM actually responding. Generally, this will result in reads of nothing but zero.
|
||||||
|
|
||||||
## Transient Driver configuration :id=transient-eeprom-driver-configuration
|
## Transient Driver configuration :id=transient-eeprom-driver-configuration
|
||||||
|
|
|
@ -16,6 +16,18 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/*
|
||||||
|
Default device configurations:
|
||||||
|
|
||||||
|
For the Adafruit SPI Non-Volatile FRAM Breakout: https://www.adafruit.com/product/1897
|
||||||
|
#define EEPROM_SPI_MB85RS64V
|
||||||
|
*/
|
||||||
|
#if defined(EEPROM_SPI_MB85RS64V)
|
||||||
|
# define EXTERNAL_EEPROM_BYTE_COUNT 8192
|
||||||
|
# define EXTERNAL_EEPROM_PAGE_SIZE 64 // it's FRAM, so it doesn't actually matter, this just sets the RAM buffer
|
||||||
|
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The slave select pin of the EEPROM.
|
The slave select pin of the EEPROM.
|
||||||
This needs to be a normal GPIO pin_t value, such as A7.
|
This needs to be a normal GPIO pin_t value, such as A7.
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#define MATRIX_ROW_PINS { A8, A1, A2, B1, A7 }
|
#define MATRIX_ROW_PINS { A8, A1, A2, B1, A7 }
|
||||||
|
|
||||||
// FRAM configuration
|
// FRAM configuration
|
||||||
|
#define EEPROM_SPI_MB85RS64V
|
||||||
#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A0
|
#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN A0
|
||||||
#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 4 // 48MHz / 4 = 12MHz; max supported by MB85R64 is 20MHz
|
#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 4 // 48MHz / 4 = 12MHz; max supported by MB85R64 is 20MHz
|
||||||
|
|
||||||
|
|
|
@ -19,5 +19,3 @@
|
||||||
// 20m timeout (20m * 60s * 1000mil)
|
// 20m timeout (20m * 60s * 1000mil)
|
||||||
// #define RGB_MATRIX_TIMEOUT 1200000
|
// #define RGB_MATRIX_TIMEOUT 1200000
|
||||||
#define RGB_DISABLE_WHEN_USB_SUSPENDED
|
#define RGB_DISABLE_WHEN_USB_SUSPENDED
|
||||||
|
|
||||||
#define STM32_ONBOARD_EEPROM_SIZE 2048
|
|
||||||
|
|
|
@ -24,5 +24,3 @@
|
||||||
// 224B per layer right now
|
// 224B per layer right now
|
||||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 8
|
#define DYNAMIC_KEYMAP_LAYER_COUNT 8
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047
|
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047
|
||||||
|
|
||||||
#define STM32_ONBOARD_EEPROM_SIZE 2048
|
|
||||||
|
|
|
@ -19,6 +19,3 @@
|
||||||
// 20m timeout (20m * 60s * 1000mil)
|
// 20m timeout (20m * 60s * 1000mil)
|
||||||
// #define RGB_MATRIX_TIMEOUT 1200000
|
// #define RGB_MATRIX_TIMEOUT 1200000
|
||||||
#define RGB_DISABLE_WHEN_USB_SUSPENDED
|
#define RGB_DISABLE_WHEN_USB_SUSPENDED
|
||||||
|
|
||||||
#define STM32_ONBOARD_EEPROM_SIZE 2048
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,3 @@
|
||||||
// 224B per layer right now
|
// 224B per layer right now
|
||||||
#define DYNAMIC_KEYMAP_LAYER_COUNT 8
|
#define DYNAMIC_KEYMAP_LAYER_COUNT 8
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047
|
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047
|
||||||
|
|
||||||
#define STM32_ONBOARD_EEPROM_SIZE 2048
|
|
||||||
|
|
||||||
|
|
|
@ -17,15 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
// Buggy, currently disabled
|
|
||||||
/* #define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000
|
|
||||||
#define EXTERNAL_EEPROM_I2C_ADDRESS(loc) (EXTERNAL_EEPROM_I2C_BASE_ADDRESS | ((((loc) >> 8) & 0x07) << 1))
|
|
||||||
#define EXTERNAL_EEPROM_BYTE_COUNT 2048
|
|
||||||
#define EXTERNAL_EEPROM_PAGE_SIZE 16
|
|
||||||
#define EXTERNAL_EEPROM_ADDRESS_SIZE 1
|
|
||||||
#define EXTERNAL_EEPROM_WRITE_TIME 5 */
|
|
||||||
|
|
||||||
#define RGBLIGHT_LAYERS_RETAIN_VAL
|
#define RGBLIGHT_LAYERS_RETAIN_VAL
|
||||||
|
|
||||||
#define OLED_DISPLAY_WIDTH 128
|
#define OLED_DISPLAY_WIDTH 128
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#define RGB_CURR_3000mA_OK_PIN C5
|
#define RGB_CURR_3000mA_OK_PIN C5
|
||||||
|
|
||||||
// EEPROM configuration
|
// EEPROM configuration
|
||||||
|
#define EEPROM_SPI_MB85RS64V
|
||||||
#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN B5
|
#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN B5
|
||||||
#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // (160MHz/8) => 20MHz
|
#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // (160MHz/8) => 20MHz
|
||||||
#define EXTERNAL_EEPROM_BYTE_COUNT 8192
|
|
||||||
#define EXTERNAL_EEPROM_PAGE_SIZE 64 // it's FRAM, so it doesn't actually matter, this just sets the RAM buffer size
|
|
||||||
|
|
|
@ -25,10 +25,9 @@
|
||||||
#define RGB_CURR_3000mA_OK_PIN C4
|
#define RGB_CURR_3000mA_OK_PIN C4
|
||||||
|
|
||||||
// EEPROM configuration
|
// EEPROM configuration
|
||||||
|
#define EEPROM_SPI_MB85RS64V
|
||||||
#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN B5
|
#define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN B5
|
||||||
#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // (160MHz/8) => 20MHz
|
#define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // (160MHz/8) => 20MHz
|
||||||
#define EXTERNAL_EEPROM_BYTE_COUNT 8192
|
|
||||||
#define EXTERNAL_EEPROM_PAGE_SIZE 64 // it's FRAM, so it doesn't actually matter, this just sets the RAM buffer size
|
|
||||||
|
|
||||||
// External flash config
|
// External flash config
|
||||||
#define EXTERNAL_FLASH_SPI_MODE 3
|
#define EXTERNAL_FLASH_SPI_MODE 3
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
// #define MATRIX_COLS 8 // actually defined in info.json: 8 bits per register
|
// #define MATRIX_COLS 8 // actually defined in info.json: 8 bits per register
|
||||||
|
|
||||||
// EEPROM configuration
|
// EEPROM configuration
|
||||||
#define EXTERNAL_EEPROM_BYTE_COUNT 8192
|
#define EEPROM_SPI_MB85RS64V
|
||||||
#define EXTERNAL_EEPROM_PAGE_SIZE 64 // it's FRAM, so it doesn't actually matter, this just sets the RAM buffer
|
|
||||||
|
|
||||||
// RGB configuration
|
// RGB configuration
|
||||||
#define RGB_MATRIX_LED_COUNT 40
|
#define RGB_MATRIX_LED_COUNT 40
|
||||||
|
|
|
@ -19,11 +19,7 @@
|
||||||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9
|
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9
|
||||||
|
|
||||||
/* eeprom i2c driver config */
|
/* eeprom i2c driver config */
|
||||||
#define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000
|
#define EEPROM_I2C_24LC32A
|
||||||
#define EXTERNAL_EEPROM_BYTE_COUNT 4096
|
|
||||||
#define EXTERNAL_EEPROM_PAGE_SIZE 32
|
|
||||||
#define EXTERNAL_EEPROM_WRITE_TIME 10
|
|
||||||
//#define EEPROM_I2C_24LC32
|
|
||||||
|
|
||||||
/* OLED config */
|
/* OLED config */
|
||||||
#define OLED_UPDATE_INTERVAL 100
|
#define OLED_UPDATE_INTERVAL 100
|
||||||
|
|
|
@ -35,6 +35,3 @@
|
||||||
|
|
||||||
// I2C EEPROM
|
// I2C EEPROM
|
||||||
#define EEPROM_I2C_CAT24C512
|
#define EEPROM_I2C_CAT24C512
|
||||||
|
|
||||||
// Dynamic EEPROM
|
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 65535
|
|
||||||
|
|
|
@ -36,9 +36,6 @@
|
||||||
// I2C EEPROM
|
// I2C EEPROM
|
||||||
#define EEPROM_I2C_24LC64
|
#define EEPROM_I2C_24LC64
|
||||||
|
|
||||||
// More EEPROM for layers
|
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191
|
|
||||||
|
|
||||||
// RGB Matrix defines
|
// RGB Matrix defines
|
||||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||||
|
|
||||||
|
|
|
@ -30,14 +30,7 @@
|
||||||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
|
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
|
||||||
|
|
||||||
// EEPROM config
|
// EEPROM config
|
||||||
// 24LC32
|
#define EEPROM_I2C_24LC32A
|
||||||
#define EXTERNAL_EEPROM_BYTE_COUNT 4096
|
|
||||||
#define EXTERNAL_EEPROM_PAGE_SIZE 32
|
|
||||||
#define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
|
||||||
#define EXTERNAL_EEPROM_WRITE_TIME 5
|
|
||||||
|
|
||||||
// More EEPROM for layers
|
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
|
|
||||||
|
|
||||||
// Hardware Defines
|
// Hardware Defines
|
||||||
#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
|
#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
|
||||||
|
|
|
@ -30,14 +30,7 @@
|
||||||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
|
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
|
||||||
|
|
||||||
// EEPROM config
|
// EEPROM config
|
||||||
// 24LC32
|
#define EEPROM_I2C_24LC32A
|
||||||
#define EXTERNAL_EEPROM_BYTE_COUNT 4096
|
|
||||||
#define EXTERNAL_EEPROM_PAGE_SIZE 32
|
|
||||||
#define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
|
||||||
#define EXTERNAL_EEPROM_WRITE_TIME 5
|
|
||||||
|
|
||||||
// More EEPROM for layers
|
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
|
|
||||||
|
|
||||||
// Hardware Defines
|
// Hardware Defines
|
||||||
#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
|
#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
|
||||||
|
|
|
@ -36,9 +36,6 @@
|
||||||
// I2C EEPROM
|
// I2C EEPROM
|
||||||
#define EEPROM_I2C_24LC64
|
#define EEPROM_I2C_24LC64
|
||||||
|
|
||||||
// More EEPROM for layers
|
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191
|
|
||||||
|
|
||||||
/* RGB Matrix */
|
/* RGB Matrix */
|
||||||
#define RGB_MATRIX_LED_COUNT 28
|
#define RGB_MATRIX_LED_COUNT 28
|
||||||
#define NOP_FUDGE 0.4
|
#define NOP_FUDGE 0.4
|
||||||
|
|
|
@ -35,10 +35,4 @@
|
||||||
#define I2C1_TIMINGR_SCLL 9U
|
#define I2C1_TIMINGR_SCLL 9U
|
||||||
|
|
||||||
// I2C EEPROM
|
// I2C EEPROM
|
||||||
// 24LC64
|
|
||||||
#define EEPROM_I2C_24LC64
|
#define EEPROM_I2C_24LC64
|
||||||
|
|
||||||
// Dynamic EEPROM
|
|
||||||
// Something sensible or else VIA may crash
|
|
||||||
// Users may enable more if they wish
|
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
|
|
||||||
|
|
|
@ -34,6 +34,3 @@
|
||||||
|
|
||||||
// I2C EEPROM
|
// I2C EEPROM
|
||||||
#define EEPROM_I2C_24LC64
|
#define EEPROM_I2C_24LC64
|
||||||
|
|
||||||
// More EEPROM for layers
|
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191
|
|
||||||
|
|
|
@ -34,9 +34,6 @@
|
||||||
// I2C EEPROM
|
// I2C EEPROM
|
||||||
#define EEPROM_I2C_24LC64
|
#define EEPROM_I2C_24LC64
|
||||||
|
|
||||||
// More EEPROM for layers
|
|
||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191
|
|
||||||
|
|
||||||
// RGBLIGHT
|
// RGBLIGHT
|
||||||
#define RGBLIGHT_LAYERS
|
#define RGBLIGHT_LAYERS
|
||||||
#define WS2812_EXTERNAL_PULLUP
|
#define WS2812_EXTERNAL_PULLUP
|
||||||
|
|
|
@ -24,11 +24,9 @@
|
||||||
|
|
||||||
// FRAM configuration
|
// FRAM configuration
|
||||||
#ifndef EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN
|
#ifndef EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN
|
||||||
|
# define EEPROM_SPI_MB85RS64V
|
||||||
# define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN PAL_LINE(GPIOA, 0)
|
# define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN PAL_LINE(GPIOA, 0)
|
||||||
# define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // 96MHz / 8 = 12MHz; max supported by MB85R64 is 20MHz
|
# define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // 96MHz / 8 = 12MHz; max supported by MB85R64 is 20MHz
|
||||||
# define EXTERNAL_EEPROM_BYTE_COUNT 8192
|
|
||||||
# define EXTERNAL_EEPROM_PAGE_SIZE 64 // does not matter for FRAM, just sets the RAM buffer size in STM32F chip
|
|
||||||
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// External flash configuration
|
// External flash configuration
|
||||||
|
|
Loading…
Reference in New Issue
Block a user