diff options
author | Florian Didron <fdidron@users.noreply.github.com> | 2020-01-21 13:50:53 +0900 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2020-02-26 10:15:12 +0900 |
commit | d3f23ecfbcd2a69714422ab68f346e51fcc2a6de (patch) | |
tree | c5c07493f4175738f623ca23f618682cc04b779a /tmk_core/common | |
parent | 0c676d6e471e3c1eabf3158fab5cb4645abd29ee (diff) |
Apollo (#246)
* Add External EEPROM driver
* Add keyboard
* Fix i2c address
* Revert i2c address for eeprom
* Reduce page size for 24LC128
* Disable External EEPROM for now
* Fix up RGB Matrix and layout
* Cleanup moonlander.c file
* Fix led array center
* Disable External EEPROM for now
* Cleanup and optimization of files
* Add and clean up mappings
* Enable "ZSA" defaults for Moonlander
* Update matrix to use i2c_readReg
* Disable render limit for rgb matrix
* Update pin controls to GPIO Commands
* Add proper changed mechanism
* Additional cleanup
* Run clang-format on moonlander files
* Align keymap
* Limit brightness for rgb matrix to 200
To prevent power draw issues
* Add USB-IF VID/PID
* Add RGB Matrix Sleep code
* Enable External EEPROM on Moonlander
* Port over Ergodox Expander error handling and retry code
* Re-init RGB Matrix drivers when half is reconnected
* Add threaded LED display
* Correct layer state settings after moonlander_led_task
* Update Moonlander to include Oryx configuration
* Add webUSB Stuff
* Update default keymap
* fix: merge conflict
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/arm_atsam/eeprom.c | 6 | ||||
-rw-r--r-- | tmk_core/common/chibios/eeprom_stm32.c | 6 | ||||
-rw-r--r-- | tmk_core/common/chibios/eeprom_teensy.c | 8 | ||||
-rw-r--r-- | tmk_core/common/eeconfig.c | 11 | ||||
-rw-r--r-- | tmk_core/common/eeprom.h | 9 | ||||
-rw-r--r-- | tmk_core/common/test/eeprom.c | 6 |
6 files changed, 29 insertions, 17 deletions
diff --git a/tmk_core/common/arm_atsam/eeprom.c b/tmk_core/common/arm_atsam/eeprom.c index 44a0bf4d76..5c8e69dae3 100644 --- a/tmk_core/common/arm_atsam/eeprom.c +++ b/tmk_core/common/arm_atsam/eeprom.c @@ -40,7 +40,7 @@ uint32_t eeprom_read_dword(const uint32_t *addr) { return eeprom_read_byte(p) | (eeprom_read_byte(p + 1) << 8) | (eeprom_read_byte(p + 2) << 16) | (eeprom_read_byte(p + 3) << 24); } -void eeprom_read_block(void *buf, const void *addr, uint32_t len) { +void eeprom_read_block(void *buf, const void *addr, size_t len) { const uint8_t *p = (const uint8_t *)addr; uint8_t * dest = (uint8_t *)buf; while (len--) { @@ -62,7 +62,7 @@ void eeprom_write_dword(uint32_t *addr, uint32_t value) { eeprom_write_byte(p, value >> 24); } -void eeprom_write_block(const void *buf, void *addr, uint32_t len) { +void eeprom_write_block(const void *buf, void *addr, size_t len) { uint8_t * p = (uint8_t *)addr; const uint8_t *src = (const uint8_t *)buf; while (len--) { @@ -86,7 +86,7 @@ void eeprom_update_dword(uint32_t *addr, uint32_t value) { eeprom_write_byte(p, value >> 24); } -void eeprom_update_block(const void *buf, void *addr, uint32_t len) { +void eeprom_update_block(const void *buf, void *addr, size_t len) { uint8_t * p = (uint8_t *)addr; const uint8_t *src = (const uint8_t *)buf; while (len--) { diff --git a/tmk_core/common/chibios/eeprom_stm32.c b/tmk_core/common/chibios/eeprom_stm32.c index 926b581c6b..ea51989728 100644 --- a/tmk_core/common/chibios/eeprom_stm32.c +++ b/tmk_core/common/chibios/eeprom_stm32.c @@ -173,7 +173,7 @@ void eeprom_update_dword(uint32_t *Address, uint32_t Value) { } } -void eeprom_read_block(void *buf, const void *addr, uint32_t len) { +void eeprom_read_block(void *buf, const void *addr, size_t len) { const uint8_t *p = (const uint8_t *)addr; uint8_t * dest = (uint8_t *)buf; while (len--) { @@ -181,7 +181,7 @@ void eeprom_read_block(void *buf, const void *addr, uint32_t len) { } } -void eeprom_write_block(const void *buf, void *addr, uint32_t len) { +void eeprom_write_block(const void *buf, void *addr, size_t len) { uint8_t * p = (uint8_t *)addr; const uint8_t *src = (const uint8_t *)buf; while (len--) { @@ -189,7 +189,7 @@ void eeprom_write_block(const void *buf, void *addr, uint32_t len) { } } -void eeprom_update_block(const void *buf, void *addr, uint32_t len) { +void eeprom_update_block(const void *buf, void *addr, size_t len) { uint8_t * p = (uint8_t *)addr; const uint8_t *src = (const uint8_t *)buf; while (len--) { diff --git a/tmk_core/common/chibios/eeprom_teensy.c b/tmk_core/common/chibios/eeprom_teensy.c index a4093fb3ba..45f9a530da 100644 --- a/tmk_core/common/chibios/eeprom_teensy.c +++ b/tmk_core/common/chibios/eeprom_teensy.c @@ -517,7 +517,7 @@ void eeprom_write_block(const void *buf, void *addr, uint32_t len) { #else // No EEPROM supported, so emulate it -# define EEPROM_SIZE 32 +# define EEPROM_SIZE 64 static uint8_t buffer[EEPROM_SIZE]; uint8_t eeprom_read_byte(const uint8_t *addr) { @@ -540,7 +540,7 @@ uint32_t eeprom_read_dword(const uint32_t *addr) { return eeprom_read_byte(p) | (eeprom_read_byte(p + 1) << 8) | (eeprom_read_byte(p + 2) << 16) | (eeprom_read_byte(p + 3) << 24); } -void eeprom_read_block(void *buf, const void *addr, uint32_t len) { +void eeprom_read_block(void *buf, const void *addr, size_t len) { const uint8_t *p = (const uint8_t *)addr; uint8_t * dest = (uint8_t *)buf; while (len--) { @@ -562,7 +562,7 @@ void eeprom_write_dword(uint32_t *addr, uint32_t value) { eeprom_write_byte(p, value >> 24); } -void eeprom_write_block(const void *buf, void *addr, uint32_t len) { +void eeprom_write_block(const void *buf, void *addr, size_t len) { uint8_t * p = (uint8_t *)addr; const uint8_t *src = (const uint8_t *)buf; while (len--) { @@ -589,7 +589,7 @@ void eeprom_update_dword(uint32_t *addr, uint32_t value) { eeprom_write_byte(p, value >> 24); } -void eeprom_update_block(const void *buf, void *addr, uint32_t len) { +void eeprom_update_block(const void *buf, void *addr, size_t len) { uint8_t * p = (uint8_t *)addr; const uint8_t *src = (const uint8_t *)buf; while (len--) { diff --git a/tmk_core/common/eeconfig.c b/tmk_core/common/eeconfig.c index 72f198d6ce..20d64438b1 100644 --- a/tmk_core/common/eeconfig.c +++ b/tmk_core/common/eeconfig.c @@ -9,6 +9,11 @@ # include "eeprom_stm32.h" #endif +#if defined(EEPROM_DRIVER) +# include "eeprom_driver.h" +#endif + +extern uint32_t default_layer_state; /** \brief eeconfig enable * * FIXME: needs doc @@ -32,6 +37,9 @@ void eeconfig_init_quantum(void) { #ifdef STM32_EEPROM_ENABLE EEPROM_Erase(); #endif +#if defined(EEPROM_DRIVER) + eeprom_driver_erase(); +#endif eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); eeprom_update_byte(EECONFIG_DEBUG, 0); eeprom_update_byte(EECONFIG_DEFAULT_LAYER, 0); @@ -81,6 +89,9 @@ void eeconfig_disable(void) { #ifdef STM32_EEPROM_ENABLE EEPROM_Erase(); #endif +#if defined(EEPROM_DRIVER) + eeprom_driver_erase(); +#endif eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER_OFF); } diff --git a/tmk_core/common/eeprom.h b/tmk_core/common/eeprom.h index fcd1667c06..8a81e70668 100644 --- a/tmk_core/common/eeprom.h +++ b/tmk_core/common/eeprom.h @@ -1,23 +1,24 @@ #ifndef TMK_CORE_COMMON_EEPROM_H_ #define TMK_CORE_COMMON_EEPROM_H_ -#if defined(__AVR__) +#if defined(__AVR__) && !defined(EEPROM_DRIVER) # include <avr/eeprom.h> #else # include <stdint.h> +# include <stdlib.h> uint8_t eeprom_read_byte(const uint8_t *__p); uint16_t eeprom_read_word(const uint16_t *__p); uint32_t eeprom_read_dword(const uint32_t *__p); -void eeprom_read_block(void *__dst, const void *__src, uint32_t __n); +void eeprom_read_block(void *__dst, const void *__src, size_t __n); void eeprom_write_byte(uint8_t *__p, uint8_t __value); void eeprom_write_word(uint16_t *__p, uint16_t __value); void eeprom_write_dword(uint32_t *__p, uint32_t __value); -void eeprom_write_block(const void *__src, void *__dst, uint32_t __n); +void eeprom_write_block(const void *__src, void *__dst, size_t __n); void eeprom_update_byte(uint8_t *__p, uint8_t __value); void eeprom_update_word(uint16_t *__p, uint16_t __value); void eeprom_update_dword(uint32_t *__p, uint32_t __value); -void eeprom_update_block(const void *__src, void *__dst, uint32_t __n); +void eeprom_update_block(const void *__src, void *__dst, size_t __n); #endif #endif /* TMK_CORE_COMMON_EEPROM_H_ */ diff --git a/tmk_core/common/test/eeprom.c b/tmk_core/common/test/eeprom.c index 44a0bf4d76..5c8e69dae3 100644 --- a/tmk_core/common/test/eeprom.c +++ b/tmk_core/common/test/eeprom.c @@ -40,7 +40,7 @@ uint32_t eeprom_read_dword(const uint32_t *addr) { return eeprom_read_byte(p) | (eeprom_read_byte(p + 1) << 8) | (eeprom_read_byte(p + 2) << 16) | (eeprom_read_byte(p + 3) << 24); } -void eeprom_read_block(void *buf, const void *addr, uint32_t len) { +void eeprom_read_block(void *buf, const void *addr, size_t len) { const uint8_t *p = (const uint8_t *)addr; uint8_t * dest = (uint8_t *)buf; while (len--) { @@ -62,7 +62,7 @@ void eeprom_write_dword(uint32_t *addr, uint32_t value) { eeprom_write_byte(p, value >> 24); } -void eeprom_write_block(const void *buf, void *addr, uint32_t len) { +void eeprom_write_block(const void *buf, void *addr, size_t len) { uint8_t * p = (uint8_t *)addr; const uint8_t *src = (const uint8_t *)buf; while (len--) { @@ -86,7 +86,7 @@ void eeprom_update_dword(uint32_t *addr, uint32_t value) { eeprom_write_byte(p, value >> 24); } -void eeprom_update_block(const void *buf, void *addr, uint32_t len) { +void eeprom_update_block(const void *buf, void *addr, size_t len) { uint8_t * p = (uint8_t *)addr; const uint8_t *src = (const uint8_t *)buf; while (len--) { |