Format code according to conventions (#16322)
This commit is contained in:
		
							parent
							
								
									afcdd7079c
								
							
						
					
					
						commit
						63646e8906
					
				
					 345 changed files with 4916 additions and 3229 deletions
				
			
		| 
						 | 
				
			
			@ -21,7 +21,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
#ifndef EECONFIG_MAGIC_NUMBER
 | 
			
		||||
#    define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE9  // When changing, decrement this value to avoid future re-init issues
 | 
			
		||||
#    define EECONFIG_MAGIC_NUMBER (uint16_t)0xFEE9 // When changing, decrement this value to avoid future re-init issues
 | 
			
		||||
#endif
 | 
			
		||||
#define EECONFIG_MAGIC_NUMBER_OFF (uint16_t)0xFFFF
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -112,28 +112,30 @@ void     eeconfig_update_haptic(uint32_t val);
 | 
			
		|||
bool eeconfig_read_handedness(void);
 | 
			
		||||
void eeconfig_update_handedness(bool val);
 | 
			
		||||
 | 
			
		||||
#define EECONFIG_DEBOUNCE_HELPER(name, offset, config)                     \
 | 
			
		||||
    static uint8_t dirty_##name = false;                                   \
 | 
			
		||||
                                                                           \
 | 
			
		||||
    static inline void eeconfig_init_##name(void) {                        \
 | 
			
		||||
        eeprom_read_block(&config, offset, sizeof(config));                \
 | 
			
		||||
        dirty_##name = false;                                              \
 | 
			
		||||
    }                                                                      \
 | 
			
		||||
    static inline void eeconfig_flush_##name(bool force) {                 \
 | 
			
		||||
        if (force || dirty_##name) {                                       \
 | 
			
		||||
            eeprom_update_block(&config, offset, sizeof(config));          \
 | 
			
		||||
            dirty_##name = false;                                          \
 | 
			
		||||
        }                                                                  \
 | 
			
		||||
    }                                                                      \
 | 
			
		||||
    static inline void eeconfig_flush_##name##_task(uint16_t timeout) {    \
 | 
			
		||||
        static uint16_t flush_timer = 0;                                   \
 | 
			
		||||
        if (timer_elapsed(flush_timer) > timeout) {                        \
 | 
			
		||||
            eeconfig_flush_##name(false);                                  \
 | 
			
		||||
            flush_timer = timer_read();                                    \
 | 
			
		||||
        }                                                                  \
 | 
			
		||||
    }                                                                      \
 | 
			
		||||
    static inline void eeconfig_flag_##name(bool v) { dirty_##name |= v; } \
 | 
			
		||||
    static inline void eeconfig_write_##name(typeof(config) conf) {        \
 | 
			
		||||
        memcpy(&config, &conf, sizeof(config));                            \
 | 
			
		||||
        eeconfig_flag_##name(true);                                        \
 | 
			
		||||
#define EECONFIG_DEBOUNCE_HELPER(name, offset, config)                  \
 | 
			
		||||
    static uint8_t dirty_##name = false;                                \
 | 
			
		||||
                                                                        \
 | 
			
		||||
    static inline void eeconfig_init_##name(void) {                     \
 | 
			
		||||
        eeprom_read_block(&config, offset, sizeof(config));             \
 | 
			
		||||
        dirty_##name = false;                                           \
 | 
			
		||||
    }                                                                   \
 | 
			
		||||
    static inline void eeconfig_flush_##name(bool force) {              \
 | 
			
		||||
        if (force || dirty_##name) {                                    \
 | 
			
		||||
            eeprom_update_block(&config, offset, sizeof(config));       \
 | 
			
		||||
            dirty_##name = false;                                       \
 | 
			
		||||
        }                                                               \
 | 
			
		||||
    }                                                                   \
 | 
			
		||||
    static inline void eeconfig_flush_##name##_task(uint16_t timeout) { \
 | 
			
		||||
        static uint16_t flush_timer = 0;                                \
 | 
			
		||||
        if (timer_elapsed(flush_timer) > timeout) {                     \
 | 
			
		||||
            eeconfig_flush_##name(false);                               \
 | 
			
		||||
            flush_timer = timer_read();                                 \
 | 
			
		||||
        }                                                               \
 | 
			
		||||
    }                                                                   \
 | 
			
		||||
    static inline void eeconfig_flag_##name(bool v) {                   \
 | 
			
		||||
        dirty_##name |= v;                                              \
 | 
			
		||||
    }                                                                   \
 | 
			
		||||
    static inline void eeconfig_write_##name(typeof(config) conf) {     \
 | 
			
		||||
        memcpy(&config, &conf, sizeof(config));                         \
 | 
			
		||||
        eeconfig_flag_##name(true);                                     \
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue