Format code according to conventions (#16322)
This commit is contained in:
parent
afcdd7079c
commit
63646e8906
@ -312,7 +312,9 @@ static bool ble_init(void) {
|
||||
return state.initialized;
|
||||
}
|
||||
|
||||
static inline uint8_t min(uint8_t a, uint8_t b) { return a < b ? a : b; }
|
||||
static inline uint8_t min(uint8_t a, uint8_t b) {
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
static bool read_response(char *resp, uint16_t resplen, bool verbose) {
|
||||
char *dest = resp;
|
||||
@ -424,7 +426,9 @@ bool at_command_P(const char *cmd, char *resp, uint16_t resplen, bool verbose) {
|
||||
return at_command(cmdbuf, resp, resplen, verbose);
|
||||
}
|
||||
|
||||
bool bluefruit_le_is_connected(void) { return state.is_connected; }
|
||||
bool bluefruit_le_is_connected(void) {
|
||||
return state.is_connected;
|
||||
}
|
||||
|
||||
bool bluefruit_le_enable_keyboard(void) {
|
||||
char resbuf[128];
|
||||
@ -671,7 +675,9 @@ void bluefruit_le_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan,
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t bluefruit_le_read_battery_voltage(void) { return state.vbat; }
|
||||
uint32_t bluefruit_le_read_battery_voltage(void) {
|
||||
return state.vbat;
|
||||
}
|
||||
|
||||
bool bluefruit_le_set_mode_leds(bool on) {
|
||||
if (!state.configured) {
|
||||
|
@ -61,7 +61,9 @@ static inline uint16_t rn42_consumer_usage_to_bitmap(uint16_t usage) {
|
||||
}
|
||||
}
|
||||
|
||||
void rn42_init(void) { uart_init(RN42_BAUD_RATE); }
|
||||
void rn42_init(void) {
|
||||
uart_init(RN42_BAUD_RATE);
|
||||
}
|
||||
|
||||
void rn42_send_keyboard(report_keyboard_t *report) {
|
||||
uart_write(0xFD);
|
||||
|
@ -37,11 +37,17 @@ uint32_t eeprom_read_dword(const uint32_t *addr) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void eeprom_write_byte(uint8_t *addr, uint8_t value) { eeprom_write_block(&value, addr, 1); }
|
||||
void eeprom_write_byte(uint8_t *addr, uint8_t value) {
|
||||
eeprom_write_block(&value, addr, 1);
|
||||
}
|
||||
|
||||
void eeprom_write_word(uint16_t *addr, uint16_t value) { eeprom_write_block(&value, addr, 2); }
|
||||
void eeprom_write_word(uint16_t *addr, uint16_t value) {
|
||||
eeprom_write_block(&value, addr, 2);
|
||||
}
|
||||
|
||||
void eeprom_write_dword(uint32_t *addr, uint32_t value) { eeprom_write_block(&value, addr, 4); }
|
||||
void eeprom_write_dword(uint32_t *addr, uint32_t value) {
|
||||
eeprom_write_block(&value, addr, 4);
|
||||
}
|
||||
|
||||
void eeprom_update_block(const void *buf, void *addr, size_t len) {
|
||||
uint8_t read_buf[len];
|
||||
|
@ -52,7 +52,9 @@
|
||||
# define EXTERNAL_EEPROM_SPI_TIMEOUT 100
|
||||
#endif
|
||||
|
||||
static bool spi_eeprom_start(void) { return spi_start(EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN, EXTERNAL_EEPROM_SPI_LSBFIRST, EXTERNAL_EEPROM_SPI_MODE, EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR); }
|
||||
static bool spi_eeprom_start(void) {
|
||||
return spi_start(EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN, EXTERNAL_EEPROM_SPI_LSBFIRST, EXTERNAL_EEPROM_SPI_MODE, EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR);
|
||||
}
|
||||
|
||||
static spi_status_t spi_eeprom_wait_while_busy(int timeout) {
|
||||
uint32_t deadline = timer_read32() + timeout;
|
||||
@ -80,7 +82,9 @@ static void spi_eeprom_transmit_address(uintptr_t addr) {
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void eeprom_driver_init(void) { spi_init(); }
|
||||
void eeprom_driver_init(void) {
|
||||
spi_init();
|
||||
}
|
||||
|
||||
void eeprom_driver_erase(void) {
|
||||
#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
|
||||
|
@ -30,9 +30,13 @@ size_t clamp_length(intptr_t offset, size_t len) {
|
||||
return len;
|
||||
}
|
||||
|
||||
void eeprom_driver_init(void) { eeprom_driver_erase(); }
|
||||
void eeprom_driver_init(void) {
|
||||
eeprom_driver_erase();
|
||||
}
|
||||
|
||||
void eeprom_driver_erase(void) { memset(transientBuffer, 0x00, TRANSIENT_EEPROM_SIZE); }
|
||||
void eeprom_driver_erase(void) {
|
||||
memset(transientBuffer, 0x00, TRANSIENT_EEPROM_SIZE);
|
||||
}
|
||||
|
||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
intptr_t offset = (intptr_t)addr;
|
||||
|
@ -65,7 +65,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// #define DEBUG_FLASH_SPI_OUTPUT
|
||||
|
||||
static bool spi_flash_start(void) { return spi_start(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN, EXTERNAL_FLASH_SPI_LSBFIRST, EXTERNAL_FLASH_SPI_MODE, EXTERNAL_FLASH_SPI_CLOCK_DIVISOR); }
|
||||
static bool spi_flash_start(void) {
|
||||
return spi_start(EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN, EXTERNAL_FLASH_SPI_LSBFIRST, EXTERNAL_FLASH_SPI_MODE, EXTERNAL_FLASH_SPI_CLOCK_DIVISOR);
|
||||
}
|
||||
|
||||
static flash_status_t spi_flash_wait_while_busy(void) {
|
||||
uint32_t deadline = timer_read32() + EXTERNAL_FLASH_SPI_TIMEOUT;
|
||||
@ -160,7 +162,9 @@ static flash_status_t spi_flash_transaction(uint8_t cmd, uint32_t addr, uint8_t
|
||||
return response;
|
||||
}
|
||||
|
||||
void flash_init(void) { spi_init(); }
|
||||
void flash_init(void) {
|
||||
spi_init();
|
||||
}
|
||||
|
||||
flash_status_t flash_erase_chip(void) {
|
||||
flash_status_t response = FLASH_STATUS_SUCCESS;
|
||||
|
@ -111,7 +111,9 @@ void DRV_rtp_init(void) {
|
||||
DRV_write(DRV_GO, 0x01);
|
||||
}
|
||||
|
||||
void DRV_amplitude(uint8_t amplitude) { DRV_write(DRV_RTP_INPUT, amplitude); }
|
||||
void DRV_amplitude(uint8_t amplitude) {
|
||||
DRV_write(DRV_RTP_INPUT, amplitude);
|
||||
}
|
||||
|
||||
void DRV_pulse(uint8_t sequence) {
|
||||
DRV_write(DRV_GO, 0x00);
|
||||
|
@ -28,13 +28,21 @@ uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL;
|
||||
|
||||
extern haptic_config_t haptic_config;
|
||||
|
||||
void solenoid_buzz_on(void) { haptic_set_buzz(1); }
|
||||
void solenoid_buzz_on(void) {
|
||||
haptic_set_buzz(1);
|
||||
}
|
||||
|
||||
void solenoid_buzz_off(void) { haptic_set_buzz(0); }
|
||||
void solenoid_buzz_off(void) {
|
||||
haptic_set_buzz(0);
|
||||
}
|
||||
|
||||
void solenoid_set_buzz(int buzz) { haptic_set_buzz(buzz); }
|
||||
void solenoid_set_buzz(int buzz) {
|
||||
haptic_set_buzz(buzz);
|
||||
}
|
||||
|
||||
void solenoid_set_dwell(uint8_t dwell) { solenoid_dwell = dwell; }
|
||||
void solenoid_set_dwell(uint8_t dwell) {
|
||||
solenoid_dwell = dwell;
|
||||
}
|
||||
|
||||
void solenoid_stop(void) {
|
||||
SOLENOID_PIN_WRITE_INACTIVE();
|
||||
@ -89,4 +97,6 @@ void solenoid_setup(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void solenoid_shutdown(void) { SOLENOID_PIN_WRITE_INACTIVE(); }
|
||||
void solenoid_shutdown(void) {
|
||||
SOLENOID_PIN_WRITE_INACTIVE();
|
||||
}
|
||||
|
@ -138,7 +138,9 @@ bool st7565_init(display_rotation_t rotation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) display_rotation_t st7565_init_user(display_rotation_t rotation) { return rotation; }
|
||||
__attribute__((weak)) display_rotation_t st7565_init_user(display_rotation_t rotation) {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
void st7565_clear(void) {
|
||||
memset(st7565_buffer, 0, sizeof(st7565_buffer));
|
||||
@ -212,7 +214,8 @@ void st7565_advance_page(bool clearPageRemainder) {
|
||||
remaining = remaining / ST7565_FONT_WIDTH;
|
||||
|
||||
// Write empty character until next line
|
||||
while (remaining--) st7565_write_char(' ', false);
|
||||
while (remaining--)
|
||||
st7565_write_char(' ', false);
|
||||
} else {
|
||||
// Next page index out of bounds?
|
||||
if (index + remaining >= ST7565_MATRIX_SIZE) {
|
||||
@ -429,7 +432,9 @@ bool st7565_off(void) {
|
||||
|
||||
__attribute__((weak)) void st7565_off_user(void) {}
|
||||
|
||||
bool st7565_is_on(void) { return st7565_active; }
|
||||
bool st7565_is_on(void) {
|
||||
return st7565_active;
|
||||
}
|
||||
|
||||
bool st7565_invert(bool invert) {
|
||||
if (!st7565_initialized) {
|
||||
@ -445,9 +450,13 @@ bool st7565_invert(bool invert) {
|
||||
return st7565_inverted;
|
||||
}
|
||||
|
||||
uint8_t st7565_max_chars(void) { return ST7565_DISPLAY_WIDTH / ST7565_FONT_WIDTH; }
|
||||
uint8_t st7565_max_chars(void) {
|
||||
return ST7565_DISPLAY_WIDTH / ST7565_FONT_WIDTH;
|
||||
}
|
||||
|
||||
uint8_t st7565_max_lines(void) { return ST7565_DISPLAY_HEIGHT / ST7565_FONT_HEIGHT; }
|
||||
uint8_t st7565_max_lines(void) {
|
||||
return ST7565_DISPLAY_HEIGHT / ST7565_FONT_HEIGHT;
|
||||
}
|
||||
|
||||
void st7565_task(void) {
|
||||
if (!st7565_initialized) {
|
||||
|
@ -72,7 +72,9 @@ void apa102_setleds(LED_TYPE *start_led, uint16_t num_leds) {
|
||||
}
|
||||
|
||||
// Overwrite the default rgblight_call_driver to use apa102 driver
|
||||
void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { apa102_setleds(start_led, num_leds); }
|
||||
void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) {
|
||||
apa102_setleds(start_led, num_leds);
|
||||
}
|
||||
|
||||
void static apa102_init(void) {
|
||||
setPinOutput(RGB_DI_PIN);
|
||||
|
@ -232,8 +232,12 @@ bool oled_init(oled_rotation_t rotation) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) { return rotation; }
|
||||
__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return rotation; }
|
||||
__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
|
||||
return rotation;
|
||||
}
|
||||
__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) {
|
||||
return rotation;
|
||||
}
|
||||
|
||||
void oled_clear(void) {
|
||||
memset(oled_buffer, 0, sizeof(oled_buffer));
|
||||
@ -368,7 +372,8 @@ void oled_advance_page(bool clearPageRemainder) {
|
||||
remaining = remaining / OLED_FONT_WIDTH;
|
||||
|
||||
// Write empty character until next line
|
||||
while (remaining--) oled_write_char(' ', false);
|
||||
while (remaining--)
|
||||
oled_write_char(' ', false);
|
||||
} else {
|
||||
// Next page index out of bounds?
|
||||
if (index + remaining >= OLED_MATRIX_SIZE) {
|
||||
@ -595,7 +600,9 @@ bool oled_off(void) {
|
||||
return !oled_active;
|
||||
}
|
||||
|
||||
bool is_oled_on(void) { return oled_active; }
|
||||
bool is_oled_on(void) {
|
||||
return oled_active;
|
||||
}
|
||||
|
||||
uint8_t oled_set_brightness(uint8_t level) {
|
||||
if (!oled_initialized) {
|
||||
@ -613,7 +620,9 @@ uint8_t oled_set_brightness(uint8_t level) {
|
||||
return oled_brightness;
|
||||
}
|
||||
|
||||
uint8_t oled_get_brightness(void) { return oled_brightness; }
|
||||
uint8_t oled_get_brightness(void) {
|
||||
return oled_brightness;
|
||||
}
|
||||
|
||||
// Set the specific 8 lines rows of the screen to scroll.
|
||||
// 0 is the default for start, and 7 for end, which is the entire
|
||||
@ -693,7 +702,9 @@ bool oled_scroll_off(void) {
|
||||
return !oled_scrolling;
|
||||
}
|
||||
|
||||
bool is_oled_scrolling(void) { return oled_scrolling; }
|
||||
bool is_oled_scrolling(void) {
|
||||
return oled_scrolling;
|
||||
}
|
||||
|
||||
bool oled_invert(bool invert) {
|
||||
if (!oled_initialized) {
|
||||
@ -777,5 +788,9 @@ void oled_task(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool oled_task_kb(void) { return oled_task_user(); }
|
||||
__attribute__((weak)) bool oled_task_user(void) { return true; }
|
||||
__attribute__((weak)) bool oled_task_kb(void) {
|
||||
return oled_task_user();
|
||||
}
|
||||
__attribute__((weak)) bool oled_task_user(void) {
|
||||
return true;
|
||||
}
|
||||
|
@ -71,7 +71,9 @@ static inline void pbuf_clear(void);
|
||||
|
||||
#if defined(PROTOCOL_CHIBIOS)
|
||||
void ps2_interrupt_service_routine(void);
|
||||
void palCallback(void *arg) { ps2_interrupt_service_routine(); }
|
||||
void palCallback(void *arg) {
|
||||
ps2_interrupt_service_routine();
|
||||
}
|
||||
|
||||
# define PS2_INT_INIT() \
|
||||
{ palSetLineMode(PS2_CLOCK_PIN, PAL_MODE_INPUT); } \
|
||||
@ -244,7 +246,9 @@ RETURN:
|
||||
}
|
||||
|
||||
#if defined(__AVR__)
|
||||
ISR(PS2_INT_VECT) { ps2_interrupt_service_routine(); }
|
||||
ISR(PS2_INT_VECT) {
|
||||
ps2_interrupt_service_routine();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* send LED state to keyboard */
|
||||
|
@ -113,9 +113,13 @@ void ps2_mouse_task(void) {
|
||||
ps2_mouse_clear_report(&mouse_report);
|
||||
}
|
||||
|
||||
void ps2_mouse_disable_data_reporting(void) { PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting"); }
|
||||
void ps2_mouse_disable_data_reporting(void) {
|
||||
PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
|
||||
}
|
||||
|
||||
void ps2_mouse_enable_data_reporting(void) { PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting"); }
|
||||
void ps2_mouse_enable_data_reporting(void) {
|
||||
PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting");
|
||||
}
|
||||
|
||||
void ps2_mouse_set_remote_mode(void) {
|
||||
PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
|
||||
@ -127,13 +131,21 @@ void ps2_mouse_set_stream_mode(void) {
|
||||
ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
|
||||
}
|
||||
|
||||
void ps2_mouse_set_scaling_2_1(void) { PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1"); }
|
||||
void ps2_mouse_set_scaling_2_1(void) {
|
||||
PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
|
||||
}
|
||||
|
||||
void ps2_mouse_set_scaling_1_1(void) { PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1"); }
|
||||
void ps2_mouse_set_scaling_1_1(void) {
|
||||
PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
|
||||
}
|
||||
|
||||
void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) { PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_RESOLUTION, resolution, "ps2 mouse set resolution"); }
|
||||
void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) {
|
||||
PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_RESOLUTION, resolution, "ps2 mouse set resolution");
|
||||
}
|
||||
|
||||
void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) { PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_SAMPLE_RATE, sample_rate, "ps2 mouse set sample rate"); }
|
||||
void ps2_mouse_set_sample_rate(ps2_mouse_sample_rate_t sample_rate) {
|
||||
PS2_MOUSE_SET_SAFE(PS2_MOUSE_SET_SAMPLE_RATE, sample_rate, "ps2 mouse set sample rate");
|
||||
}
|
||||
|
||||
/* ============================= HELPERS ============================ */
|
||||
|
||||
|
@ -74,9 +74,13 @@ void adns5050_sync(void) {
|
||||
writePinHigh(ADNS5050_CS_PIN);
|
||||
}
|
||||
|
||||
void adns5050_cs_select(void) { writePinLow(ADNS5050_CS_PIN); }
|
||||
void adns5050_cs_select(void) {
|
||||
writePinLow(ADNS5050_CS_PIN);
|
||||
}
|
||||
|
||||
void adns5050_cs_deselect(void) { writePinHigh(ADNS5050_CS_PIN); }
|
||||
void adns5050_cs_deselect(void) {
|
||||
writePinHigh(ADNS5050_CS_PIN);
|
||||
}
|
||||
|
||||
uint8_t adns5050_serial_read(void) {
|
||||
setPinInput(ADNS5050_SDIO_PIN);
|
||||
|
@ -77,7 +77,9 @@
|
||||
#define MSB1 0x80
|
||||
// clang-format on
|
||||
|
||||
void adns9800_spi_start(void) { spi_start(ADNS9800_CS_PIN, false, ADNS9800_SPI_MODE, ADNS9800_SPI_DIVISOR); }
|
||||
void adns9800_spi_start(void) {
|
||||
spi_start(ADNS9800_CS_PIN, false, ADNS9800_SPI_MODE, ADNS9800_SPI_DIVISOR);
|
||||
}
|
||||
|
||||
void adns9800_write(uint8_t reg_addr, uint8_t data) {
|
||||
adns9800_spi_start();
|
||||
|
@ -54,7 +54,9 @@ void RAP_ReadBytes(uint8_t address, uint8_t* data, uint8_t count);
|
||||
void RAP_Write(uint8_t address, uint8_t data);
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
void print_byte(uint8_t byte) { xprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
|
||||
void print_byte(uint8_t byte) {
|
||||
xprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0'));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Logical Scaling Functions */
|
||||
@ -73,8 +75,12 @@ void ClipCoordinates(pinnacle_data_t* coordinates) {
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t cirque_pinnacle_get_scale(void) { return scale_data; }
|
||||
void cirque_pinnacle_set_scale(uint16_t scale) { scale_data = scale; }
|
||||
uint16_t cirque_pinnacle_get_scale(void) {
|
||||
return scale_data;
|
||||
}
|
||||
void cirque_pinnacle_set_scale(uint16_t scale) {
|
||||
scale_data = scale;
|
||||
}
|
||||
|
||||
// Scales data to desired X & Y resolution
|
||||
void cirque_pinnacle_scale_data(pinnacle_data_t* coordinates, uint16_t xResolution, uint16_t yResolution) {
|
||||
|
@ -33,7 +33,9 @@
|
||||
|
||||
static uint16_t precision = 128;
|
||||
|
||||
uint16_t pimoroni_trackball_get_cpi(void) { return (precision * 125); }
|
||||
uint16_t pimoroni_trackball_get_cpi(void) {
|
||||
return (precision * 125);
|
||||
}
|
||||
/**
|
||||
* @brief Sets the scaling value for pimoroni trackball
|
||||
*
|
||||
|
@ -86,7 +86,9 @@
|
||||
bool _inBurst = false;
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
|
||||
void print_byte(uint8_t byte) {
|
||||
dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0'));
|
||||
}
|
||||
#endif
|
||||
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
|
||||
|
||||
|
@ -90,7 +90,9 @@
|
||||
bool _inBurst = false;
|
||||
|
||||
#ifdef CONSOLE_ENABLE
|
||||
void print_byte(uint8_t byte) { dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0')); }
|
||||
void print_byte(uint8_t byte) {
|
||||
dprintf("%c%c%c%c%c%c%c%c|", (byte & 0x80 ? '1' : '0'), (byte & 0x40 ? '1' : '0'), (byte & 0x20 ? '1' : '0'), (byte & 0x10 ? '1' : '0'), (byte & 0x08 ? '1' : '0'), (byte & 0x04 ? '1' : '0'), (byte & 0x02 ? '1' : '0'), (byte & 0x01 ? '1' : '0'));
|
||||
}
|
||||
#endif
|
||||
#define constrain(amt, low, high) ((amt) < (low) ? (low) : ((amt) > (high) ? (high) : (amt)))
|
||||
|
||||
|
@ -155,7 +155,9 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_update_byte(uint8_t *addr, uint8_t value) { eeprom_write_byte(addr, value); }
|
||||
void eeprom_update_byte(uint8_t *addr, uint8_t value) {
|
||||
eeprom_write_byte(addr, value);
|
||||
}
|
||||
|
||||
void eeprom_update_word(uint16_t *addr, uint16_t value) {
|
||||
uint8_t *p = (uint8_t *)addr;
|
||||
|
0
platforms/arm_atsam/eeprom_samd.h
Executable file → Normal file
0
platforms/arm_atsam/eeprom_samd.h
Executable file → Normal file
@ -2,18 +2,34 @@
|
||||
#include "timer.h"
|
||||
#include "tmk_core/protocol/arm_atsam/clks.h"
|
||||
|
||||
void set_time(uint64_t tset) { ms_clk = tset; }
|
||||
void set_time(uint64_t tset) {
|
||||
ms_clk = tset;
|
||||
}
|
||||
|
||||
void timer_init(void) { timer_clear(); }
|
||||
void timer_init(void) {
|
||||
timer_clear();
|
||||
}
|
||||
|
||||
uint16_t timer_read(void) { return (uint16_t)ms_clk; }
|
||||
uint16_t timer_read(void) {
|
||||
return (uint16_t)ms_clk;
|
||||
}
|
||||
|
||||
uint32_t timer_read32(void) { return (uint32_t)ms_clk; }
|
||||
uint32_t timer_read32(void) {
|
||||
return (uint32_t)ms_clk;
|
||||
}
|
||||
|
||||
uint64_t timer_read64(void) { return ms_clk; }
|
||||
uint64_t timer_read64(void) {
|
||||
return ms_clk;
|
||||
}
|
||||
|
||||
uint16_t timer_elapsed(uint16_t tlast) { return TIMER_DIFF_16(timer_read(), tlast); }
|
||||
uint16_t timer_elapsed(uint16_t tlast) {
|
||||
return TIMER_DIFF_16(timer_read(), tlast);
|
||||
}
|
||||
|
||||
uint32_t timer_elapsed32(uint32_t tlast) { return TIMER_DIFF_32(timer_read32(), tlast); }
|
||||
uint32_t timer_elapsed32(uint32_t tlast) {
|
||||
return TIMER_DIFF_32(timer_read32(), tlast);
|
||||
}
|
||||
|
||||
void timer_clear(void) { set_time(0); }
|
||||
void timer_clear(void) {
|
||||
set_time(0);
|
||||
}
|
||||
|
@ -21,9 +21,13 @@
|
||||
|
||||
static uint8_t aref = ADC_REF_POWER;
|
||||
|
||||
void analogReference(uint8_t mode) { aref = mode & (_BV(REFS1) | _BV(REFS0)); }
|
||||
void analogReference(uint8_t mode) {
|
||||
aref = mode & (_BV(REFS1) | _BV(REFS0));
|
||||
}
|
||||
|
||||
int16_t analogReadPin(pin_t pin) { return adc_read(pinToMux(pin)); }
|
||||
int16_t analogReadPin(pin_t pin) {
|
||||
return adc_read(pinToMux(pin));
|
||||
}
|
||||
|
||||
uint8_t pinToMux(pin_t pin) {
|
||||
switch (pin) {
|
||||
|
@ -202,7 +202,9 @@ void channel_2_set_frequency(float freq) {
|
||||
AUDIO2_OCRxy = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre / 100);
|
||||
}
|
||||
|
||||
float channel_2_get_frequency(void) { return channel_2_frequency; }
|
||||
float channel_2_get_frequency(void) {
|
||||
return channel_2_frequency;
|
||||
}
|
||||
|
||||
void channel_2_start(void) {
|
||||
AUDIO2_TIMSKx |= _BV(AUDIO2_OCIExy);
|
||||
|
@ -362,17 +362,23 @@ void lcd_gotoxy(uint8_t x, uint8_t y) {
|
||||
|
||||
/*************************************************************************
|
||||
*************************************************************************/
|
||||
int lcd_getxy(void) { return lcd_waitbusy(); }
|
||||
int lcd_getxy(void) {
|
||||
return lcd_waitbusy();
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Clear display and set cursor to home position
|
||||
*************************************************************************/
|
||||
void lcd_clrscr(void) { lcd_command(1 << LCD_CLR); }
|
||||
void lcd_clrscr(void) {
|
||||
lcd_command(1 << LCD_CLR);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Set cursor to home position
|
||||
*************************************************************************/
|
||||
void lcd_home(void) { lcd_command(1 << LCD_HOME); }
|
||||
void lcd_home(void) {
|
||||
lcd_command(1 << LCD_HOME);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Display character at current cursor position
|
||||
|
@ -23,7 +23,9 @@ void clock_lo(void) {
|
||||
setPinOutput(PS2_CLOCK_PIN);
|
||||
}
|
||||
|
||||
void clock_hi(void) { setPinInputHigh(PS2_CLOCK_PIN); }
|
||||
void clock_hi(void) {
|
||||
setPinInputHigh(PS2_CLOCK_PIN);
|
||||
}
|
||||
|
||||
bool clock_in(void) {
|
||||
setPinInputHigh(PS2_CLOCK_PIN);
|
||||
@ -42,7 +44,9 @@ void data_lo(void) {
|
||||
setPinOutput(PS2_DATA_PIN);
|
||||
}
|
||||
|
||||
void data_hi(void) { setPinInputHigh(PS2_DATA_PIN); }
|
||||
void data_hi(void) {
|
||||
setPinInputHigh(PS2_DATA_PIN);
|
||||
}
|
||||
|
||||
bool data_in(void) {
|
||||
setPinInputHigh(PS2_DATA_PIN);
|
||||
|
@ -223,29 +223,45 @@
|
||||
# define SLAVE_INT_ACK_WIDTH 4
|
||||
|
||||
inline static void serial_delay(void) ALWAYS_INLINE;
|
||||
inline static void serial_delay(void) { _delay_us(SERIAL_DELAY); }
|
||||
inline static void serial_delay(void) {
|
||||
_delay_us(SERIAL_DELAY);
|
||||
}
|
||||
|
||||
inline static void serial_delay_half1(void) ALWAYS_INLINE;
|
||||
inline static void serial_delay_half1(void) { _delay_us(SERIAL_DELAY_HALF1); }
|
||||
inline static void serial_delay_half1(void) {
|
||||
_delay_us(SERIAL_DELAY_HALF1);
|
||||
}
|
||||
|
||||
inline static void serial_delay_half2(void) ALWAYS_INLINE;
|
||||
inline static void serial_delay_half2(void) { _delay_us(SERIAL_DELAY_HALF2); }
|
||||
inline static void serial_delay_half2(void) {
|
||||
_delay_us(SERIAL_DELAY_HALF2);
|
||||
}
|
||||
|
||||
inline static void serial_output(void) ALWAYS_INLINE;
|
||||
inline static void serial_output(void) { setPinOutput(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_output(void) {
|
||||
setPinOutput(SOFT_SERIAL_PIN);
|
||||
}
|
||||
|
||||
// make the serial pin an input with pull-up resistor
|
||||
inline static void serial_input_with_pullup(void) ALWAYS_INLINE;
|
||||
inline static void serial_input_with_pullup(void) { setPinInputHigh(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_input_with_pullup(void) {
|
||||
setPinInputHigh(SOFT_SERIAL_PIN);
|
||||
}
|
||||
|
||||
inline static uint8_t serial_read_pin(void) ALWAYS_INLINE;
|
||||
inline static uint8_t serial_read_pin(void) { return !!readPin(SOFT_SERIAL_PIN); }
|
||||
inline static uint8_t serial_read_pin(void) {
|
||||
return !!readPin(SOFT_SERIAL_PIN);
|
||||
}
|
||||
|
||||
inline static void serial_low(void) ALWAYS_INLINE;
|
||||
inline static void serial_low(void) { writePinLow(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_low(void) {
|
||||
writePinLow(SOFT_SERIAL_PIN);
|
||||
}
|
||||
|
||||
inline static void serial_high(void) ALWAYS_INLINE;
|
||||
inline static void serial_high(void) { writePinHigh(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_high(void) {
|
||||
writePinHigh(SOFT_SERIAL_PIN);
|
||||
}
|
||||
|
||||
void soft_serial_initiator_init(void) {
|
||||
serial_output();
|
||||
|
@ -226,7 +226,9 @@ void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
|
||||
matrix_write_char_inner(matrix, c);
|
||||
}
|
||||
|
||||
void iota_gfx_write_char(uint8_t c) { matrix_write_char(&display, c); }
|
||||
void iota_gfx_write_char(uint8_t c) {
|
||||
matrix_write_char(&display, c);
|
||||
}
|
||||
|
||||
void matrix_write(struct CharacterMatrix *matrix, const char *data) {
|
||||
const char *end = data + strlen(data);
|
||||
@ -236,7 +238,9 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data) {
|
||||
}
|
||||
}
|
||||
|
||||
void iota_gfx_write(const char *data) { matrix_write(&display, data); }
|
||||
void iota_gfx_write(const char *data) {
|
||||
matrix_write(&display, data);
|
||||
}
|
||||
|
||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
|
||||
while (true) {
|
||||
@ -249,7 +253,9 @@ void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
|
||||
}
|
||||
}
|
||||
|
||||
void iota_gfx_write_P(const char *data) { matrix_write_P(&display, data); }
|
||||
void iota_gfx_write_P(const char *data) {
|
||||
matrix_write_P(&display, data);
|
||||
}
|
||||
|
||||
void matrix_clear(struct CharacterMatrix *matrix) {
|
||||
memset(matrix->display, ' ', sizeof(matrix->display));
|
||||
@ -257,7 +263,9 @@ void matrix_clear(struct CharacterMatrix *matrix) {
|
||||
matrix->dirty = true;
|
||||
}
|
||||
|
||||
void iota_gfx_clear_screen(void) { matrix_clear(&display); }
|
||||
void iota_gfx_clear_screen(void) {
|
||||
matrix_clear(&display);
|
||||
}
|
||||
|
||||
void matrix_render(struct CharacterMatrix *matrix) {
|
||||
last_flush = timer_read();
|
||||
@ -301,7 +309,9 @@ done:
|
||||
# endif
|
||||
}
|
||||
|
||||
void iota_gfx_flush(void) { matrix_render(&display); }
|
||||
void iota_gfx_flush(void) {
|
||||
matrix_render(&display);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void iota_gfx_task_user(void) {}
|
||||
|
||||
|
@ -13,7 +13,9 @@
|
||||
# define WS2812_TIMEOUT 100
|
||||
#endif
|
||||
|
||||
void ws2812_init(void) { i2c_init(); }
|
||||
void ws2812_init(void) {
|
||||
i2c_init();
|
||||
}
|
||||
|
||||
// Setleds for standard RGB
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
|
||||
|
@ -17,4 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "xprintf.h"
|
||||
#include "sendchar.h"
|
||||
|
||||
void print_set_sendchar(sendchar_func_t func) { xdev_out(func); }
|
||||
void print_set_sendchar(sendchar_func_t func) {
|
||||
xdev_out(func);
|
||||
}
|
||||
|
@ -73,7 +73,9 @@ void timer_init(void) {
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
inline void timer_clear(void) {
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { timer_count = 0; }
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
timer_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief timer read
|
||||
@ -83,7 +85,9 @@ inline void timer_clear(void) {
|
||||
inline uint16_t timer_read(void) {
|
||||
uint32_t t;
|
||||
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { t = timer_count; }
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
t = timer_count;
|
||||
}
|
||||
|
||||
return (t & 0xFFFF);
|
||||
}
|
||||
@ -95,7 +99,9 @@ inline uint16_t timer_read(void) {
|
||||
inline uint32_t timer_read32(void) {
|
||||
uint32_t t;
|
||||
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { t = timer_count; }
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
t = timer_count;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -107,7 +113,9 @@ inline uint32_t timer_read32(void) {
|
||||
inline uint16_t timer_elapsed(uint16_t last) {
|
||||
uint32_t t;
|
||||
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { t = timer_count; }
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
t = timer_count;
|
||||
}
|
||||
|
||||
return TIMER_DIFF_16((t & 0xFFFF), last);
|
||||
}
|
||||
@ -119,7 +127,9 @@ inline uint16_t timer_elapsed(uint16_t last) {
|
||||
inline uint32_t timer_elapsed32(uint32_t last) {
|
||||
uint32_t t;
|
||||
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { t = timer_count; }
|
||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||
t = timer_count;
|
||||
}
|
||||
|
||||
return TIMER_DIFF_32(t, last);
|
||||
}
|
||||
@ -130,4 +140,6 @@ inline uint32_t timer_elapsed32(uint32_t last) {
|
||||
#else
|
||||
# define TIMER_INTERRUPT_VECTOR TIMER0_COMP_vect
|
||||
#endif
|
||||
ISR(TIMER_INTERRUPT_VECTOR, ISR_NOBLOCK) { timer_count++; }
|
||||
ISR(TIMER_INTERRUPT_VECTOR, ISR_NOBLOCK) {
|
||||
timer_count++;
|
||||
}
|
||||
|
@ -18,4 +18,6 @@
|
||||
|
||||
#include <ch.h>
|
||||
|
||||
__attribute__((weak)) void bootloader_jump(void) { NVIC_SystemReset(); }
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
@ -28,7 +28,9 @@ typedef struct {
|
||||
uint8_t adc;
|
||||
} adc_mux;
|
||||
#define TO_MUX(i, a) \
|
||||
(adc_mux) { i, a }
|
||||
(adc_mux) { \
|
||||
i, a \
|
||||
}
|
||||
|
||||
int16_t analogReadPin(pin_t pin);
|
||||
int16_t analogReadPinAdc(pin_t pin, uint8_t adc);
|
||||
|
@ -321,7 +321,9 @@ void audio_driver_initialize() {
|
||||
gptStart(&GPTD6, &gpt6cfg1);
|
||||
}
|
||||
|
||||
void audio_driver_stop(void) { state = OUTPUT_SHOULD_STOP; }
|
||||
void audio_driver_stop(void) {
|
||||
state = OUTPUT_SHOULD_STOP;
|
||||
}
|
||||
|
||||
void audio_driver_start(void) {
|
||||
gptStartContinuous(&GPTD6, 2U);
|
||||
|
@ -121,7 +121,9 @@ void channel_1_set_frequency(float freq) {
|
||||
gpt6cfg1.frequency = 2 * freq * AUDIO_DAC_BUFFER_SIZE;
|
||||
channel_1_start();
|
||||
}
|
||||
float channel_1_get_frequency(void) { return channel_1_frequency; }
|
||||
float channel_1_get_frequency(void) {
|
||||
return channel_1_frequency;
|
||||
}
|
||||
|
||||
void channel_2_start(void) {
|
||||
gptStart(&GPTD7, &gpt7cfg1);
|
||||
@ -146,7 +148,9 @@ void channel_2_set_frequency(float freq) {
|
||||
gpt7cfg1.frequency = 2 * freq * AUDIO_DAC_BUFFER_SIZE;
|
||||
channel_2_start();
|
||||
}
|
||||
float channel_2_get_frequency(void) { return channel_2_frequency; }
|
||||
float channel_2_get_frequency(void) {
|
||||
return channel_2_frequency;
|
||||
}
|
||||
|
||||
static void gpt_audio_state_cb(GPTDriver *gptp) {
|
||||
if (audio_update_state()) {
|
||||
|
@ -82,14 +82,18 @@ void channel_1_set_frequency(float freq) {
|
||||
PWM_PERCENTAGE_TO_WIDTH(&AUDIO_PWM_DRIVER, (100 - note_timbre) * 100));
|
||||
}
|
||||
|
||||
float channel_1_get_frequency(void) { return channel_1_frequency; }
|
||||
float channel_1_get_frequency(void) {
|
||||
return channel_1_frequency;
|
||||
}
|
||||
|
||||
void channel_1_start(void) {
|
||||
pwmStop(&AUDIO_PWM_DRIVER);
|
||||
pwmStart(&AUDIO_PWM_DRIVER, &pwmCFG);
|
||||
}
|
||||
|
||||
void channel_1_stop(void) { pwmStop(&AUDIO_PWM_DRIVER); }
|
||||
void channel_1_stop(void) {
|
||||
pwmStop(&AUDIO_PWM_DRIVER);
|
||||
}
|
||||
|
||||
static void gpt_callback(GPTDriver *gptp);
|
||||
GPTConfig gptCFG = {
|
||||
|
@ -68,7 +68,9 @@ void channel_1_set_frequency(float freq) {
|
||||
PWM_PERCENTAGE_TO_WIDTH(&AUDIO_PWM_DRIVER, (100 - note_timbre) * 100));
|
||||
}
|
||||
|
||||
float channel_1_get_frequency(void) { return channel_1_frequency; }
|
||||
float channel_1_get_frequency(void) {
|
||||
return channel_1_frequency;
|
||||
}
|
||||
|
||||
void channel_1_start(void) {
|
||||
pwmStop(&AUDIO_PWM_DRIVER);
|
||||
|
@ -203,4 +203,6 @@ i2c_status_t i2c_readReg16(uint8_t devaddr, uint16_t regaddr, uint8_t* data, uin
|
||||
return chibios_to_qmk(&status);
|
||||
}
|
||||
|
||||
void i2c_stop(void) { i2cStop(&I2C_DRIVER); }
|
||||
void i2c_stop(void) {
|
||||
i2cStop(&I2C_DRIVER);
|
||||
}
|
||||
|
@ -50,14 +50,30 @@
|
||||
# error invalid SELECT_SOFT_SERIAL_SPEED value
|
||||
#endif
|
||||
|
||||
inline static void serial_delay(void) { wait_us(SERIAL_DELAY); }
|
||||
inline static void serial_delay_half(void) { wait_us(SERIAL_DELAY / 2); }
|
||||
inline static void serial_delay_blip(void) { wait_us(1); }
|
||||
inline static void serial_output(void) { setPinOutput(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_input(void) { setPinInputHigh(SOFT_SERIAL_PIN); }
|
||||
inline static bool serial_read_pin(void) { return !!readPin(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_low(void) { writePinLow(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_high(void) { writePinHigh(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_delay(void) {
|
||||
wait_us(SERIAL_DELAY);
|
||||
}
|
||||
inline static void serial_delay_half(void) {
|
||||
wait_us(SERIAL_DELAY / 2);
|
||||
}
|
||||
inline static void serial_delay_blip(void) {
|
||||
wait_us(1);
|
||||
}
|
||||
inline static void serial_output(void) {
|
||||
setPinOutput(SOFT_SERIAL_PIN);
|
||||
}
|
||||
inline static void serial_input(void) {
|
||||
setPinInputHigh(SOFT_SERIAL_PIN);
|
||||
}
|
||||
inline static bool serial_read_pin(void) {
|
||||
return !!readPin(SOFT_SERIAL_PIN);
|
||||
}
|
||||
inline static void serial_low(void) {
|
||||
writePinLow(SOFT_SERIAL_PIN);
|
||||
}
|
||||
inline static void serial_high(void) {
|
||||
writePinHigh(SOFT_SERIAL_PIN);
|
||||
}
|
||||
|
||||
void interrupt_handler(void *arg);
|
||||
|
||||
|
@ -43,7 +43,9 @@ void uart_init(uint32_t baud) {
|
||||
}
|
||||
}
|
||||
|
||||
void uart_write(uint8_t data) { sdPut(&SERIAL_DRIVER, c); }
|
||||
void uart_write(uint8_t data) {
|
||||
sdPut(&SERIAL_DRIVER, c);
|
||||
}
|
||||
|
||||
uint8_t uart_read(void) {
|
||||
msg_t res = sdGet(&SERIAL_DRIVER);
|
||||
@ -51,8 +53,14 @@ uint8_t uart_read(void) {
|
||||
return (uint8_t)res;
|
||||
}
|
||||
|
||||
void uart_transmit(const uint8_t *data, uint16_t length) { sdWrite(&SERIAL_DRIVER, data, length); }
|
||||
void uart_transmit(const uint8_t *data, uint16_t length) {
|
||||
sdWrite(&SERIAL_DRIVER, data, length);
|
||||
}
|
||||
|
||||
void uart_receive(uint8_t *data, uint16_t length) { sdRead(&SERIAL_DRIVER, data, length); }
|
||||
void uart_receive(uint8_t *data, uint16_t length) {
|
||||
sdRead(&SERIAL_DRIVER, data, length);
|
||||
}
|
||||
|
||||
bool uart_available(void) { return !sdGetWouldBlock(&SERIAL_DRIVER); }
|
||||
bool uart_available(void) {
|
||||
return !sdGetWouldBlock(&SERIAL_DRIVER);
|
||||
}
|
||||
|
@ -67,7 +67,9 @@ void sendByte(uint8_t byte) {
|
||||
}
|
||||
}
|
||||
|
||||
void ws2812_init(void) { palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE); }
|
||||
void ws2812_init(void) {
|
||||
palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE);
|
||||
}
|
||||
|
||||
// Setleds for standard RGB
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
|
||||
|
@ -259,8 +259,10 @@ write/read to/from the other buffer).
|
||||
void ws2812_init(void) {
|
||||
// Initialize led frame buffer
|
||||
uint32_t i;
|
||||
for (i = 0; i < WS2812_COLOR_BIT_N; i++) ws2812_frame_buffer[i] = WS2812_DUTYCYCLE_0; // All color bits are zero duty cycle
|
||||
for (i = 0; i < WS2812_RESET_BIT_N; i++) ws2812_frame_buffer[i + WS2812_COLOR_BIT_N] = 0; // All reset bits are zero
|
||||
for (i = 0; i < WS2812_COLOR_BIT_N; i++)
|
||||
ws2812_frame_buffer[i] = WS2812_DUTYCYCLE_0; // All color bits are zero duty cycle
|
||||
for (i = 0; i < WS2812_RESET_BIT_N; i++)
|
||||
ws2812_frame_buffer[i + WS2812_COLOR_BIT_N] = 0; // All reset bits are zero
|
||||
|
||||
palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE);
|
||||
|
||||
|
@ -104,20 +104,30 @@ static void set_led_color_rgb(LED_TYPE color, int pos) {
|
||||
uint8_t* tx_start = &txbuf[PREAMBLE_SIZE];
|
||||
|
||||
#if (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_GRB)
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.g, j);
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.r, j);
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.b, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.g, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.r, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.b, j);
|
||||
#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_RGB)
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.r, j);
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.g, j);
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.b, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.r, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.g, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.b, j);
|
||||
#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_BGR)
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.b, j);
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.g, j);
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.r, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.b, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.g, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.r, j);
|
||||
#endif
|
||||
#ifdef RGBW
|
||||
for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 4 + j] = get_protocol_eq(color.w, j);
|
||||
for (int j = 0; j < 4; j++)
|
||||
tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 4 + j] = get_protocol_eq(color.w, j);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -560,9 +560,13 @@ uint16_t EEPROM_ReadDataWord(uint16_t Address) {
|
||||
/*****************************************************************************
|
||||
* Bind to eeprom_driver.c
|
||||
*******************************************************************************/
|
||||
void eeprom_driver_init(void) { EEPROM_Init(); }
|
||||
void eeprom_driver_init(void) {
|
||||
EEPROM_Init();
|
||||
}
|
||||
|
||||
void eeprom_driver_erase(void) { EEPROM_Erase(); }
|
||||
void eeprom_driver_erase(void) {
|
||||
EEPROM_Erase();
|
||||
}
|
||||
|
||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
const uint8_t *src = (const uint8_t *)addr;
|
||||
|
@ -162,7 +162,9 @@ void eeprom_read_block(void *buf, const void *addr, uint32_t len) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
int eeprom_is_ready(void) { return (FTFL->FCNFG & FTFL_FCNFG_EEERDY) ? 1 : 0; }
|
||||
int eeprom_is_ready(void) {
|
||||
return (FTFL->FCNFG & FTFL_FCNFG_EEERDY) ? 1 : 0;
|
||||
}
|
||||
|
||||
/** \brief flexram wait
|
||||
*
|
||||
@ -486,7 +488,9 @@ void eeprom_read_block(void *buf, const void *addr, uint32_t len) {
|
||||
}
|
||||
}
|
||||
|
||||
int eeprom_is_ready(void) { return 1; }
|
||||
int eeprom_is_ready(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void eeprom_write_word(uint16_t *addr, uint16_t value) {
|
||||
uint8_t *p = (uint8_t *)addr;
|
||||
@ -515,7 +519,9 @@ void eeprom_write_block(const void *buf, void *addr, uint32_t len) {
|
||||
#endif /* chip selection */
|
||||
// The update functions just calls write for now, but could probably be optimized
|
||||
|
||||
void eeprom_update_byte(uint8_t *addr, uint8_t value) { eeprom_write_byte(addr, value); }
|
||||
void eeprom_update_byte(uint8_t *addr, uint8_t value) {
|
||||
eeprom_write_byte(addr, value);
|
||||
}
|
||||
|
||||
void eeprom_update_word(uint16_t *addr, uint16_t value) {
|
||||
uint8_t *p = (uint8_t *)addr;
|
||||
|
@ -169,21 +169,33 @@ static void gptTimerCallback(GPTDriver *gptp) {
|
||||
static const GPTConfig gptcfg = {1000000, gptTimerCallback, 0, 0};
|
||||
|
||||
/* Initialise the timer */
|
||||
void sleep_led_init(void) { gptStart(&SLEEP_LED_GPT_DRIVER, &gptcfg); }
|
||||
void sleep_led_init(void) {
|
||||
gptStart(&SLEEP_LED_GPT_DRIVER, &gptcfg);
|
||||
}
|
||||
|
||||
void sleep_led_enable(void) { gptStartContinuous(&SLEEP_LED_GPT_DRIVER, gptcfg.frequency / 0xFFFF); }
|
||||
void sleep_led_enable(void) {
|
||||
gptStartContinuous(&SLEEP_LED_GPT_DRIVER, gptcfg.frequency / 0xFFFF);
|
||||
}
|
||||
|
||||
void sleep_led_disable(void) { gptStopTimer(&SLEEP_LED_GPT_DRIVER); }
|
||||
void sleep_led_disable(void) {
|
||||
gptStopTimer(&SLEEP_LED_GPT_DRIVER);
|
||||
}
|
||||
|
||||
void sleep_led_toggle(void) { (SLEEP_LED_GPT_DRIVER.state == GPT_READY) ? sleep_led_enable() : sleep_led_disable(); }
|
||||
void sleep_led_toggle(void) {
|
||||
(SLEEP_LED_GPT_DRIVER.state == GPT_READY) ? sleep_led_enable() : sleep_led_disable();
|
||||
}
|
||||
|
||||
#else /* platform selection: not on familiar chips */
|
||||
|
||||
void sleep_led_init(void) {}
|
||||
|
||||
void sleep_led_enable(void) { led_set(1 << USB_LED_CAPS_LOCK); }
|
||||
void sleep_led_enable(void) {
|
||||
led_set(1 << USB_LED_CAPS_LOCK);
|
||||
}
|
||||
|
||||
void sleep_led_disable(void) { led_set(0); }
|
||||
void sleep_led_disable(void) {
|
||||
led_set(0);
|
||||
}
|
||||
|
||||
void sleep_led_toggle(void) {
|
||||
// not implemented
|
||||
|
@ -87,9 +87,13 @@ __attribute__((weak, used)) int _kill(int pid, int sig) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
__attribute__((weak, used)) pid_t _getpid(void) { return 1; }
|
||||
__attribute__((weak, used)) pid_t _getpid(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
__attribute__((weak, used)) void _fini(void) { return; }
|
||||
__attribute__((weak, used)) void _fini(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
__attribute__((weak, used, noreturn)) void _exit(int i) {
|
||||
while (1)
|
||||
|
@ -73,7 +73,9 @@ void timer_clear(void) {
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
uint16_t timer_read(void) { return (uint16_t)timer_read32(); }
|
||||
uint16_t timer_read(void) {
|
||||
return (uint16_t)timer_read32();
|
||||
}
|
||||
|
||||
uint32_t timer_read32(void) {
|
||||
chSysLock();
|
||||
@ -96,6 +98,10 @@ uint32_t timer_read32(void) {
|
||||
return (uint32_t)TIME_I2MS(ticks) + ms_offset_copy;
|
||||
}
|
||||
|
||||
uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); }
|
||||
uint16_t timer_elapsed(uint16_t last) {
|
||||
return TIMER_DIFF_16(timer_read(), last);
|
||||
}
|
||||
|
||||
uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); }
|
||||
uint32_t timer_elapsed32(uint32_t last) {
|
||||
return TIMER_DIFF_32(timer_read32(), last);
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ __attribute__((weak)) void suspend_power_down_user(void) {}
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
__attribute__((weak)) void suspend_power_down_kb(void) { suspend_power_down_user(); }
|
||||
__attribute__((weak)) void suspend_power_down_kb(void) {
|
||||
suspend_power_down_user();
|
||||
}
|
||||
|
||||
/** \brief run user level code immediately after wakeup
|
||||
*
|
||||
@ -30,7 +32,9 @@ __attribute__((weak)) void suspend_wakeup_init_user(void) {}
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
__attribute__((weak)) void suspend_wakeup_init_kb(void) { suspend_wakeup_init_user(); }
|
||||
__attribute__((weak)) void suspend_wakeup_init_kb(void) {
|
||||
suspend_wakeup_init_user();
|
||||
}
|
||||
|
||||
/** \brief suspend wakeup condition
|
||||
*
|
||||
|
@ -68,7 +68,9 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_update_byte(uint8_t *addr, uint8_t value) { eeprom_write_byte(addr, value); }
|
||||
void eeprom_update_byte(uint8_t *addr, uint8_t value) {
|
||||
eeprom_write_byte(addr, value);
|
||||
}
|
||||
|
||||
void eeprom_update_word(uint16_t *addr, uint16_t value) {
|
||||
uint8_t *p = (uint8_t *)addr;
|
||||
|
@ -60,7 +60,9 @@ class EepromStm32Test : public testing::Test {
|
||||
~EepromStm32Test() {}
|
||||
|
||||
protected:
|
||||
void SetUp() override { EEPROM_Erase(); }
|
||||
void SetUp() override {
|
||||
EEPROM_Erase();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
#ifdef EEPROM_DEBUG
|
||||
|
@ -44,6 +44,12 @@ FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data) {
|
||||
}
|
||||
}
|
||||
|
||||
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout) { return FLASH_COMPLETE; }
|
||||
void FLASH_Unlock(void) { flash_locked = false; }
|
||||
void FLASH_Lock(void) { flash_locked = true; }
|
||||
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout) {
|
||||
return FLASH_COMPLETE;
|
||||
}
|
||||
void FLASH_Unlock(void) {
|
||||
flash_locked = false;
|
||||
}
|
||||
void FLASH_Lock(void) {
|
||||
flash_locked = true;
|
||||
}
|
||||
|
@ -18,16 +18,34 @@
|
||||
|
||||
static uint32_t current_time = 0;
|
||||
|
||||
void timer_init(void) { current_time = 0; }
|
||||
void timer_init(void) {
|
||||
current_time = 0;
|
||||
}
|
||||
|
||||
void timer_clear(void) { current_time = 0; }
|
||||
void timer_clear(void) {
|
||||
current_time = 0;
|
||||
}
|
||||
|
||||
uint16_t timer_read(void) { return current_time & 0xFFFF; }
|
||||
uint32_t timer_read32(void) { return current_time; }
|
||||
uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); }
|
||||
uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); }
|
||||
uint16_t timer_read(void) {
|
||||
return current_time & 0xFFFF;
|
||||
}
|
||||
uint32_t timer_read32(void) {
|
||||
return current_time;
|
||||
}
|
||||
uint16_t timer_elapsed(uint16_t last) {
|
||||
return TIMER_DIFF_16(timer_read(), last);
|
||||
}
|
||||
uint32_t timer_elapsed32(uint32_t last) {
|
||||
return TIMER_DIFF_32(timer_read32(), last);
|
||||
}
|
||||
|
||||
void set_time(uint32_t t) { current_time = t; }
|
||||
void advance_time(uint32_t ms) { current_time += ms; }
|
||||
void set_time(uint32_t t) {
|
||||
current_time = t;
|
||||
}
|
||||
void advance_time(uint32_t ms) {
|
||||
current_time += ms;
|
||||
}
|
||||
|
||||
void wait_ms(uint32_t ms) { advance_time(ms); }
|
||||
void wait_ms(uint32_t ms) {
|
||||
advance_time(ms);
|
||||
}
|
||||
|
@ -52,14 +52,22 @@ uint32_t timer_elapsed32(uint32_t last);
|
||||
# define TIMER_DIFF_FAST(a, b) TIMER_DIFF_16(a, b)
|
||||
# define timer_expired_fast(current, future) timer_expired(current, future)
|
||||
typedef uint16_t fast_timer_t;
|
||||
fast_timer_t inline timer_read_fast(void) { return timer_read(); }
|
||||
fast_timer_t inline timer_elapsed_fast(fast_timer_t last) { return timer_elapsed(last); }
|
||||
fast_timer_t inline timer_read_fast(void) {
|
||||
return timer_read();
|
||||
}
|
||||
fast_timer_t inline timer_elapsed_fast(fast_timer_t last) {
|
||||
return timer_elapsed(last);
|
||||
}
|
||||
#else
|
||||
# define TIMER_DIFF_FAST(a, b) TIMER_DIFF_32(a, b)
|
||||
# define timer_expired_fast(current, future) timer_expired32(current, future)
|
||||
typedef uint32_t fast_timer_t;
|
||||
fast_timer_t inline timer_read_fast(void) { return timer_read32(); }
|
||||
fast_timer_t inline timer_elapsed_fast(fast_timer_t last) { return timer_elapsed32(last); }
|
||||
fast_timer_t inline timer_read_fast(void) {
|
||||
return timer_read32();
|
||||
}
|
||||
fast_timer_t inline timer_elapsed_fast(fast_timer_t last) {
|
||||
return timer_elapsed32(last);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -53,14 +53,20 @@ int retro_tapping_counter = 0;
|
||||
#endif
|
||||
|
||||
#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY
|
||||
__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { return false; }
|
||||
__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RETRO_TAPPING_PER_KEY
|
||||
__attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { return false; }
|
||||
__attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { return true; }
|
||||
__attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Called to execute an action.
|
||||
*
|
||||
@ -163,10 +169,14 @@ void process_record_nocache(keyrecord_t *record) {
|
||||
disable_action_cache = false;
|
||||
}
|
||||
#else
|
||||
void process_record_nocache(keyrecord_t *record) { process_record(record); }
|
||||
void process_record_nocache(keyrecord_t *record) {
|
||||
process_record(record);
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) bool process_record_quantum(keyrecord_t *record) { return true; }
|
||||
__attribute__((weak)) bool process_record_quantum(keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void post_process_record_quantum(keyrecord_t *record) {}
|
||||
|
||||
@ -862,9 +872,13 @@ __attribute__((weak)) void register_code(uint8_t code) {
|
||||
}
|
||||
#ifdef EXTRAKEY_ENABLE
|
||||
else if
|
||||
IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); }
|
||||
IS_SYSTEM(code) {
|
||||
host_system_send(KEYCODE2SYSTEM(code));
|
||||
}
|
||||
else if
|
||||
IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); }
|
||||
IS_CONSUMER(code) {
|
||||
host_consumer_send(KEYCODE2CONSUMER(code));
|
||||
}
|
||||
#endif
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
else if
|
||||
@ -927,9 +941,13 @@ __attribute__((weak)) void unregister_code(uint8_t code) {
|
||||
send_keyboard_report();
|
||||
}
|
||||
else if
|
||||
IS_SYSTEM(code) { host_system_send(0); }
|
||||
IS_SYSTEM(code) {
|
||||
host_system_send(0);
|
||||
}
|
||||
else if
|
||||
IS_CONSUMER(code) { host_consumer_send(0); }
|
||||
IS_CONSUMER(code) {
|
||||
host_consumer_send(0);
|
||||
}
|
||||
#ifdef MOUSEKEY_ENABLE
|
||||
else if
|
||||
IS_MOUSEKEY(code) {
|
||||
@ -956,7 +974,9 @@ __attribute__((weak)) void tap_code_delay(uint8_t code, uint16_t delay) {
|
||||
*
|
||||
* \param code The basic keycode to tap. If `code` is `KC_CAPS_LOCK`, the delay will be `TAP_HOLD_CAPS_DELAY`, otherwise `TAP_CODE_DELAY`, if defined.
|
||||
*/
|
||||
__attribute__((weak)) void tap_code(uint8_t code) { tap_code_delay(code, code == KC_CAPS_LOCK ? TAP_HOLD_CAPS_DELAY : TAP_CODE_DELAY); }
|
||||
__attribute__((weak)) void tap_code(uint8_t code) {
|
||||
tap_code_delay(code, code == KC_CAPS_LOCK ? TAP_HOLD_CAPS_DELAY : TAP_CODE_DELAY);
|
||||
}
|
||||
|
||||
/** \brief Adds the given physically pressed modifiers and sends a keyboard report immediately.
|
||||
*
|
||||
@ -1100,7 +1120,9 @@ bool is_tap_action(action_t action) {
|
||||
*
|
||||
* FIXME: Needs documentation.
|
||||
*/
|
||||
void debug_event(keyevent_t event) { dprintf("%04X%c(%u)", (event.key.row << 8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time); }
|
||||
void debug_event(keyevent_t event) {
|
||||
dprintf("%04X%c(%u)", (event.key.row << 8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time);
|
||||
}
|
||||
/** \brief Debug print (FIXME: Needs better description)
|
||||
*
|
||||
* FIXME: Needs documentation.
|
||||
|
@ -18,13 +18,17 @@ layer_state_t default_layer_state = 0;
|
||||
*
|
||||
* Run user code on default layer state change
|
||||
*/
|
||||
__attribute__((weak)) layer_state_t default_layer_state_set_user(layer_state_t state) { return state; }
|
||||
__attribute__((weak)) layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
/** \brief Default Layer State Set At Keyboard Level
|
||||
*
|
||||
* Run keyboard code on default layer state change
|
||||
*/
|
||||
__attribute__((weak)) layer_state_t default_layer_state_set_kb(layer_state_t state) { return default_layer_state_set_user(state); }
|
||||
__attribute__((weak)) layer_state_t default_layer_state_set_kb(layer_state_t state) {
|
||||
return default_layer_state_set_user(state);
|
||||
}
|
||||
|
||||
/** \brief Default Layer State Set
|
||||
*
|
||||
@ -49,30 +53,40 @@ static void default_layer_state_set(layer_state_t state) {
|
||||
*
|
||||
* Print out the hex value of the 32-bit default layer state, as well as the value of the highest bit.
|
||||
*/
|
||||
void default_layer_debug(void) { dprintf("%08lX(%u)", default_layer_state, get_highest_layer(default_layer_state)); }
|
||||
void default_layer_debug(void) {
|
||||
dprintf("%08lX(%u)", default_layer_state, get_highest_layer(default_layer_state));
|
||||
}
|
||||
|
||||
/** \brief Default Layer Set
|
||||
*
|
||||
* Sets the default layer state.
|
||||
*/
|
||||
void default_layer_set(layer_state_t state) { default_layer_state_set(state); }
|
||||
void default_layer_set(layer_state_t state) {
|
||||
default_layer_state_set(state);
|
||||
}
|
||||
|
||||
#ifndef NO_ACTION_LAYER
|
||||
/** \brief Default Layer Or
|
||||
*
|
||||
* Turns on the default layer based on matching bits between specifed layer and existing layer state
|
||||
*/
|
||||
void default_layer_or(layer_state_t state) { default_layer_state_set(default_layer_state | state); }
|
||||
void default_layer_or(layer_state_t state) {
|
||||
default_layer_state_set(default_layer_state | state);
|
||||
}
|
||||
/** \brief Default Layer And
|
||||
*
|
||||
* Turns on default layer based on matching enabled bits between specifed layer and existing layer state
|
||||
*/
|
||||
void default_layer_and(layer_state_t state) { default_layer_state_set(default_layer_state & state); }
|
||||
void default_layer_and(layer_state_t state) {
|
||||
default_layer_state_set(default_layer_state & state);
|
||||
}
|
||||
/** \brief Default Layer Xor
|
||||
*
|
||||
* Turns on default layer based on non-matching bits between specifed layer and existing layer state
|
||||
*/
|
||||
void default_layer_xor(layer_state_t state) { default_layer_state_set(default_layer_state ^ state); }
|
||||
void default_layer_xor(layer_state_t state) {
|
||||
default_layer_state_set(default_layer_state ^ state);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_ACTION_LAYER
|
||||
@ -84,13 +98,17 @@ layer_state_t layer_state = 0;
|
||||
*
|
||||
* Runs user code on layer state change
|
||||
*/
|
||||
__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { return state; }
|
||||
__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
/** \brief Layer state set keyboard
|
||||
*
|
||||
* Runs keyboard code on layer state change
|
||||
*/
|
||||
__attribute__((weak)) layer_state_t layer_state_set_kb(layer_state_t state) { return layer_state_set_user(state); }
|
||||
__attribute__((weak)) layer_state_t layer_state_set_kb(layer_state_t state) {
|
||||
return layer_state_set_user(state);
|
||||
}
|
||||
|
||||
/** \brief Layer state set
|
||||
*
|
||||
@ -115,13 +133,17 @@ void layer_state_set(layer_state_t state) {
|
||||
*
|
||||
* Turn off all layers
|
||||
*/
|
||||
void layer_clear(void) { layer_state_set(0); }
|
||||
void layer_clear(void) {
|
||||
layer_state_set(0);
|
||||
}
|
||||
|
||||
/** \brief Layer state is
|
||||
*
|
||||
* Return whether the given state is on (it might still be shadowed by a higher state, though)
|
||||
*/
|
||||
bool layer_state_is(uint8_t layer) { return layer_state_cmp(layer_state, layer); }
|
||||
bool layer_state_is(uint8_t layer) {
|
||||
return layer_state_cmp(layer_state, layer);
|
||||
}
|
||||
|
||||
/** \brief Layer state compare
|
||||
*
|
||||
@ -138,47 +160,63 @@ bool layer_state_cmp(layer_state_t cmp_layer_state, uint8_t layer) {
|
||||
*
|
||||
* Turns on the given layer and turn off all other layers
|
||||
*/
|
||||
void layer_move(uint8_t layer) { layer_state_set((layer_state_t)1 << layer); }
|
||||
void layer_move(uint8_t layer) {
|
||||
layer_state_set((layer_state_t)1 << layer);
|
||||
}
|
||||
|
||||
/** \brief Layer on
|
||||
*
|
||||
* Turns on given layer
|
||||
*/
|
||||
void layer_on(uint8_t layer) { layer_state_set(layer_state | ((layer_state_t)1 << layer)); }
|
||||
void layer_on(uint8_t layer) {
|
||||
layer_state_set(layer_state | ((layer_state_t)1 << layer));
|
||||
}
|
||||
|
||||
/** \brief Layer off
|
||||
*
|
||||
* Turns off given layer
|
||||
*/
|
||||
void layer_off(uint8_t layer) { layer_state_set(layer_state & ~((layer_state_t)1 << layer)); }
|
||||
void layer_off(uint8_t layer) {
|
||||
layer_state_set(layer_state & ~((layer_state_t)1 << layer));
|
||||
}
|
||||
|
||||
/** \brief Layer invert
|
||||
*
|
||||
* Toggle the given layer (set it if it's unset, or unset it if it's set)
|
||||
*/
|
||||
void layer_invert(uint8_t layer) { layer_state_set(layer_state ^ ((layer_state_t)1 << layer)); }
|
||||
void layer_invert(uint8_t layer) {
|
||||
layer_state_set(layer_state ^ ((layer_state_t)1 << layer));
|
||||
}
|
||||
|
||||
/** \brief Layer or
|
||||
*
|
||||
* Turns on layers based on matching bits between specifed layer and existing layer state
|
||||
*/
|
||||
void layer_or(layer_state_t state) { layer_state_set(layer_state | state); }
|
||||
void layer_or(layer_state_t state) {
|
||||
layer_state_set(layer_state | state);
|
||||
}
|
||||
/** \brief Layer and
|
||||
*
|
||||
* Turns on layers based on matching enabled bits between specifed layer and existing layer state
|
||||
*/
|
||||
void layer_and(layer_state_t state) { layer_state_set(layer_state & state); }
|
||||
void layer_and(layer_state_t state) {
|
||||
layer_state_set(layer_state & state);
|
||||
}
|
||||
/** \brief Layer xor
|
||||
*
|
||||
* Turns on layers based on non-matching bits between specifed layer and existing layer state
|
||||
*/
|
||||
void layer_xor(layer_state_t state) { layer_state_set(layer_state ^ state); }
|
||||
void layer_xor(layer_state_t state) {
|
||||
layer_state_set(layer_state ^ state);
|
||||
}
|
||||
|
||||
/** \brief Layer debug printing
|
||||
*
|
||||
* Print out the hex value of the 32-bit layer state, as well as the value of the highest bit.
|
||||
*/
|
||||
void layer_debug(void) { dprintf("%08lX(%u)", layer_state, get_highest_layer(layer_state)); }
|
||||
void layer_debug(void) {
|
||||
dprintf("%08lX(%u)", layer_state, get_highest_layer(layer_state));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
|
||||
@ -276,4 +314,6 @@ uint8_t layer_switch_get_layer(keypos_t key) {
|
||||
*
|
||||
* Gets action code based on key position
|
||||
*/
|
||||
action_t layer_switch_get_action(keypos_t key) { return action_for_key(layer_switch_get_layer(key), key); }
|
||||
action_t layer_switch_get_action(keypos_t key) {
|
||||
return action_for_key(layer_switch_get_layer(key), key);
|
||||
}
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
uint16_t g_tapping_term = TAPPING_TERM;
|
||||
|
||||
__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return g_tapping_term; }
|
||||
__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
|
||||
return g_tapping_term;
|
||||
}
|
||||
|
||||
# ifdef TAPPING_TERM_PER_KEY
|
||||
# define WITHIN_TAPPING_TERM(e) (TIMER_DIFF_16(e.time, tapping_key.event.time) < get_tapping_term(get_record_keycode(&tapping_key, false), &tapping_key))
|
||||
@ -35,15 +37,21 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *r
|
||||
# endif
|
||||
|
||||
# ifdef TAPPING_FORCE_HOLD_PER_KEY
|
||||
__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { return false; }
|
||||
__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef PERMISSIVE_HOLD_PER_KEY
|
||||
__attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { return false; }
|
||||
__attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY
|
||||
__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) { return false; }
|
||||
__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
|
||||
# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)
|
||||
|
@ -43,7 +43,9 @@ extern inline void clear_keys(void);
|
||||
#ifndef NO_ACTION_ONESHOT
|
||||
static uint8_t oneshot_mods = 0;
|
||||
static uint8_t oneshot_locked_mods = 0;
|
||||
uint8_t get_oneshot_locked_mods(void) { return oneshot_locked_mods; }
|
||||
uint8_t get_oneshot_locked_mods(void) {
|
||||
return oneshot_locked_mods;
|
||||
}
|
||||
void set_oneshot_locked_mods(uint8_t mods) {
|
||||
if (mods != oneshot_locked_mods) {
|
||||
oneshot_locked_mods = mods;
|
||||
@ -58,9 +60,13 @@ void clear_oneshot_locked_mods(void) {
|
||||
}
|
||||
# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
|
||||
static uint16_t oneshot_time = 0;
|
||||
bool has_oneshot_mods_timed_out(void) { return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT; }
|
||||
bool has_oneshot_mods_timed_out(void) {
|
||||
return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT;
|
||||
}
|
||||
# else
|
||||
bool has_oneshot_mods_timed_out(void) { return false; }
|
||||
bool has_oneshot_mods_timed_out(void) {
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -74,8 +80,12 @@ bool has_oneshot_mods_timed_out(void) { return false; }
|
||||
*/
|
||||
static int8_t oneshot_layer_data = 0;
|
||||
|
||||
inline uint8_t get_oneshot_layer(void) { return oneshot_layer_data >> 3; }
|
||||
inline uint8_t get_oneshot_layer_state(void) { return oneshot_layer_data & 0b111; }
|
||||
inline uint8_t get_oneshot_layer(void) {
|
||||
return oneshot_layer_data >> 3;
|
||||
}
|
||||
inline uint8_t get_oneshot_layer_state(void) {
|
||||
return oneshot_layer_data & 0b111;
|
||||
}
|
||||
|
||||
# ifdef SWAP_HANDS_ENABLE
|
||||
enum {
|
||||
@ -88,10 +98,14 @@ enum {
|
||||
|
||||
# if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
|
||||
static uint16_t oneshot_layer_time = 0;
|
||||
inline bool has_oneshot_layer_timed_out() { return TIMER_DIFF_16(timer_read(), oneshot_layer_time) >= ONESHOT_TIMEOUT && !(get_oneshot_layer_state() & ONESHOT_TOGGLED); }
|
||||
inline bool has_oneshot_layer_timed_out() {
|
||||
return TIMER_DIFF_16(timer_read(), oneshot_layer_time) >= ONESHOT_TIMEOUT && !(get_oneshot_layer_state() & ONESHOT_TOGGLED);
|
||||
}
|
||||
# ifdef SWAP_HANDS_ENABLE
|
||||
static uint16_t oneshot_swaphands_time = 0;
|
||||
inline bool has_oneshot_swaphands_timed_out() { return TIMER_DIFF_16(timer_read(), oneshot_swaphands_time) >= ONESHOT_TIMEOUT && (swap_hands_oneshot == SHO_ACTIVE); }
|
||||
inline bool has_oneshot_swaphands_timed_out() {
|
||||
return TIMER_DIFF_16(timer_read(), oneshot_swaphands_time) >= ONESHOT_TIMEOUT && (swap_hands_oneshot == SHO_ACTIVE);
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@ -179,7 +193,9 @@ void clear_oneshot_layer_state(oneshot_fullfillment_t state) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
bool is_oneshot_layer_active(void) { return get_oneshot_layer_state(); }
|
||||
bool is_oneshot_layer_active(void) {
|
||||
return get_oneshot_layer_state();
|
||||
}
|
||||
|
||||
/** \brief set oneshot
|
||||
*
|
||||
@ -198,21 +214,29 @@ void oneshot_set(bool active) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void oneshot_toggle(void) { oneshot_set(!keymap_config.oneshot_disable); }
|
||||
void oneshot_toggle(void) {
|
||||
oneshot_set(!keymap_config.oneshot_disable);
|
||||
}
|
||||
|
||||
/** \brief enable oneshot
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void oneshot_enable(void) { oneshot_set(true); }
|
||||
void oneshot_enable(void) {
|
||||
oneshot_set(true);
|
||||
}
|
||||
|
||||
/** \brief disable oneshot
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void oneshot_disable(void) { oneshot_set(false); }
|
||||
void oneshot_disable(void) {
|
||||
oneshot_set(false);
|
||||
}
|
||||
|
||||
bool is_oneshot_enabled(void) { return keymap_config.oneshot_disable; }
|
||||
bool is_oneshot_enabled(void) {
|
||||
return keymap_config.oneshot_disable;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -259,68 +283,96 @@ void send_keyboard_report(void) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t get_mods(void) { return real_mods; }
|
||||
uint8_t get_mods(void) {
|
||||
return real_mods;
|
||||
}
|
||||
/** \brief add mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void add_mods(uint8_t mods) { real_mods |= mods; }
|
||||
void add_mods(uint8_t mods) {
|
||||
real_mods |= mods;
|
||||
}
|
||||
/** \brief del mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void del_mods(uint8_t mods) { real_mods &= ~mods; }
|
||||
void del_mods(uint8_t mods) {
|
||||
real_mods &= ~mods;
|
||||
}
|
||||
/** \brief set mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void set_mods(uint8_t mods) { real_mods = mods; }
|
||||
void set_mods(uint8_t mods) {
|
||||
real_mods = mods;
|
||||
}
|
||||
/** \brief clear mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void clear_mods(void) { real_mods = 0; }
|
||||
void clear_mods(void) {
|
||||
real_mods = 0;
|
||||
}
|
||||
|
||||
/** \brief get weak mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t get_weak_mods(void) { return weak_mods; }
|
||||
uint8_t get_weak_mods(void) {
|
||||
return weak_mods;
|
||||
}
|
||||
/** \brief add weak mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void add_weak_mods(uint8_t mods) { weak_mods |= mods; }
|
||||
void add_weak_mods(uint8_t mods) {
|
||||
weak_mods |= mods;
|
||||
}
|
||||
/** \brief del weak mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void del_weak_mods(uint8_t mods) { weak_mods &= ~mods; }
|
||||
void del_weak_mods(uint8_t mods) {
|
||||
weak_mods &= ~mods;
|
||||
}
|
||||
/** \brief set weak mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void set_weak_mods(uint8_t mods) { weak_mods = mods; }
|
||||
void set_weak_mods(uint8_t mods) {
|
||||
weak_mods = mods;
|
||||
}
|
||||
/** \brief clear weak mods
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void clear_weak_mods(void) { weak_mods = 0; }
|
||||
void clear_weak_mods(void) {
|
||||
weak_mods = 0;
|
||||
}
|
||||
|
||||
#ifdef KEY_OVERRIDE_ENABLE
|
||||
/** \brief set weak mods used by key overrides. DO not call this manually
|
||||
*/
|
||||
void set_weak_override_mods(uint8_t mods) { weak_override_mods = mods; }
|
||||
void set_weak_override_mods(uint8_t mods) {
|
||||
weak_override_mods = mods;
|
||||
}
|
||||
/** \brief clear weak mods used by key overrides. DO not call this manually
|
||||
*/
|
||||
void clear_weak_override_mods(void) { weak_override_mods = 0; }
|
||||
void clear_weak_override_mods(void) {
|
||||
weak_override_mods = 0;
|
||||
}
|
||||
|
||||
/** \brief set suppressed mods used by key overrides. DO not call this manually
|
||||
*/
|
||||
void set_suppressed_override_mods(uint8_t mods) { suppressed_mods = mods; }
|
||||
void set_suppressed_override_mods(uint8_t mods) {
|
||||
suppressed_mods = mods;
|
||||
}
|
||||
/** \brief clear suppressed mods used by key overrides. DO not call this manually
|
||||
*/
|
||||
void clear_suppressed_override_mods(void) { suppressed_mods = 0; }
|
||||
void clear_suppressed_override_mods(void) {
|
||||
suppressed_mods = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_ACTION_ONESHOT
|
||||
@ -328,7 +380,9 @@ void clear_suppressed_override_mods(void) { suppressed_mods = 0; }
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t get_oneshot_mods(void) { return oneshot_mods; }
|
||||
uint8_t get_oneshot_mods(void) {
|
||||
return oneshot_mods;
|
||||
}
|
||||
|
||||
void add_oneshot_mods(uint8_t mods) {
|
||||
if ((oneshot_mods & mods) != mods) {
|
||||
@ -391,7 +445,9 @@ __attribute__((weak)) void oneshot_locked_mods_changed_user(uint8_t mods) {}
|
||||
*
|
||||
* \param mods Contains the active modifiers active after the change.
|
||||
*/
|
||||
__attribute__((weak)) void oneshot_locked_mods_changed_kb(uint8_t mods) { oneshot_locked_mods_changed_user(mods); }
|
||||
__attribute__((weak)) void oneshot_locked_mods_changed_kb(uint8_t mods) {
|
||||
oneshot_locked_mods_changed_user(mods);
|
||||
}
|
||||
|
||||
/** \brief Called when the one shot modifiers have been changed.
|
||||
*
|
||||
@ -403,7 +459,9 @@ __attribute__((weak)) void oneshot_mods_changed_user(uint8_t mods) {}
|
||||
*
|
||||
* \param mods Contains the active modifiers active after the change.
|
||||
*/
|
||||
__attribute__((weak)) void oneshot_mods_changed_kb(uint8_t mods) { oneshot_mods_changed_user(mods); }
|
||||
__attribute__((weak)) void oneshot_mods_changed_kb(uint8_t mods) {
|
||||
oneshot_mods_changed_user(mods);
|
||||
}
|
||||
|
||||
/** \brief Called when the one shot layers have been changed.
|
||||
*
|
||||
@ -415,10 +473,14 @@ __attribute__((weak)) void oneshot_layer_changed_user(uint8_t layer) {}
|
||||
*
|
||||
* \param layer Contains the layer that is toggled on, or zero when toggled off.
|
||||
*/
|
||||
__attribute__((weak)) void oneshot_layer_changed_kb(uint8_t layer) { oneshot_layer_changed_user(layer); }
|
||||
__attribute__((weak)) void oneshot_layer_changed_kb(uint8_t layer) {
|
||||
oneshot_layer_changed_user(layer);
|
||||
}
|
||||
|
||||
/** \brief inspect keyboard state
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t has_anymod(void) { return bitpop(real_mods); }
|
||||
uint8_t has_anymod(void) {
|
||||
return bitpop(real_mods);
|
||||
}
|
||||
|
@ -29,11 +29,17 @@ extern report_keyboard_t *keyboard_report;
|
||||
void send_keyboard_report(void);
|
||||
|
||||
/* key */
|
||||
inline void add_key(uint8_t key) { add_key_to_report(keyboard_report, key); }
|
||||
inline void add_key(uint8_t key) {
|
||||
add_key_to_report(keyboard_report, key);
|
||||
}
|
||||
|
||||
inline void del_key(uint8_t key) { del_key_from_report(keyboard_report, key); }
|
||||
inline void del_key(uint8_t key) {
|
||||
del_key_from_report(keyboard_report, key);
|
||||
}
|
||||
|
||||
inline void clear_keys(void) { clear_keys_from_report(keyboard_report); }
|
||||
inline void clear_keys(void) {
|
||||
clear_keys_from_report(keyboard_report);
|
||||
}
|
||||
|
||||
/* modifier */
|
||||
uint8_t get_mods(void);
|
||||
|
@ -181,7 +181,9 @@ void audio_off(void) {
|
||||
eeconfig_update_audio(audio_config.raw);
|
||||
}
|
||||
|
||||
bool audio_is_on(void) { return (audio_config.enable != 0); }
|
||||
bool audio_is_on(void) {
|
||||
return (audio_config.enable != 0);
|
||||
}
|
||||
|
||||
void audio_stop_all() {
|
||||
if (audio_driver_stopped) {
|
||||
@ -294,7 +296,9 @@ void audio_play_note(float pitch, uint16_t duration) {
|
||||
}
|
||||
}
|
||||
|
||||
void audio_play_tone(float pitch) { audio_play_note(pitch, 0xffff); }
|
||||
void audio_play_tone(float pitch) {
|
||||
audio_play_note(pitch, 0xffff);
|
||||
}
|
||||
|
||||
void audio_play_melody(float (*np)[][2], uint16_t n_count, bool n_repeat) {
|
||||
if (!audio_config.enable) {
|
||||
@ -347,11 +351,17 @@ void audio_play_click(uint16_t delay, float pitch, uint16_t duration) {
|
||||
}
|
||||
}
|
||||
|
||||
bool audio_is_playing_note(void) { return playing_note; }
|
||||
bool audio_is_playing_note(void) {
|
||||
return playing_note;
|
||||
}
|
||||
|
||||
bool audio_is_playing_melody(void) { return playing_melody; }
|
||||
bool audio_is_playing_melody(void) {
|
||||
return playing_melody;
|
||||
}
|
||||
|
||||
uint8_t audio_get_number_of_active_tones(void) { return active_tones; }
|
||||
uint8_t audio_get_number_of_active_tones(void) {
|
||||
return active_tones;
|
||||
}
|
||||
|
||||
float audio_get_frequency(uint8_t tone_index) {
|
||||
if (tone_index >= active_tones) {
|
||||
@ -487,9 +497,15 @@ bool audio_update_state(void) {
|
||||
|
||||
// Tone-multiplexing functions
|
||||
#ifdef AUDIO_ENABLE_TONE_MULTIPLEXING
|
||||
void audio_set_tone_multiplexing_rate(uint16_t rate) { tone_multiplexing_rate = rate; }
|
||||
void audio_enable_tone_multiplexing(void) { tone_multiplexing_rate = AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT; }
|
||||
void audio_disable_tone_multiplexing(void) { tone_multiplexing_rate = 0; }
|
||||
void audio_set_tone_multiplexing_rate(uint16_t rate) {
|
||||
tone_multiplexing_rate = rate;
|
||||
}
|
||||
void audio_enable_tone_multiplexing(void) {
|
||||
tone_multiplexing_rate = AUDIO_TONE_MULTIPLEXING_RATE_DEFAULT;
|
||||
}
|
||||
void audio_disable_tone_multiplexing(void) {
|
||||
tone_multiplexing_rate = 0;
|
||||
}
|
||||
void audio_increase_tone_multiplexing_rate(uint16_t change) {
|
||||
if ((0xffff - change) > tone_multiplexing_rate) {
|
||||
tone_multiplexing_rate += change;
|
||||
|
@ -32,11 +32,17 @@ voice_type voice = AUDIO_VOICE_DEFAULT;
|
||||
voice_type voice = default_voice;
|
||||
#endif
|
||||
|
||||
void set_voice(voice_type v) { voice = v; }
|
||||
void set_voice(voice_type v) {
|
||||
voice = v;
|
||||
}
|
||||
|
||||
void voice_iterate() { voice = (voice + 1) % number_of_voices; }
|
||||
void voice_iterate() {
|
||||
voice = (voice + 1) % number_of_voices;
|
||||
}
|
||||
|
||||
void voice_deiterate() { voice = (voice - 1 + number_of_voices) % number_of_voices; }
|
||||
void voice_deiterate() {
|
||||
voice = (voice - 1 + number_of_voices) % number_of_voices;
|
||||
}
|
||||
|
||||
#ifdef AUDIO_VOICES
|
||||
float mod(float a, int b) {
|
||||
@ -325,12 +331,24 @@ float voice_envelope(float frequency) {
|
||||
|
||||
// Vibrato functions
|
||||
|
||||
void voice_set_vibrato_rate(float rate) { vibrato_rate = rate; }
|
||||
void voice_increase_vibrato_rate(float change) { vibrato_rate *= change; }
|
||||
void voice_decrease_vibrato_rate(float change) { vibrato_rate /= change; }
|
||||
void voice_set_vibrato_strength(float strength) { vibrato_strength = strength; }
|
||||
void voice_increase_vibrato_strength(float change) { vibrato_strength *= change; }
|
||||
void voice_decrease_vibrato_strength(float change) { vibrato_strength /= change; }
|
||||
void voice_set_vibrato_rate(float rate) {
|
||||
vibrato_rate = rate;
|
||||
}
|
||||
void voice_increase_vibrato_rate(float change) {
|
||||
vibrato_rate *= change;
|
||||
}
|
||||
void voice_decrease_vibrato_rate(float change) {
|
||||
vibrato_rate /= change;
|
||||
}
|
||||
void voice_set_vibrato_strength(float strength) {
|
||||
vibrato_strength = strength;
|
||||
}
|
||||
void voice_increase_vibrato_strength(float change) {
|
||||
vibrato_strength *= change;
|
||||
}
|
||||
void voice_decrease_vibrato_strength(float change) {
|
||||
vibrato_strength /= change;
|
||||
}
|
||||
|
||||
// Timbre functions
|
||||
|
||||
@ -339,4 +357,6 @@ void voice_set_timbre(uint8_t timbre) {
|
||||
note_timbre = timbre;
|
||||
}
|
||||
}
|
||||
uint8_t voice_get_timbre(void) { return note_timbre; }
|
||||
uint8_t voice_get_timbre(void) {
|
||||
return note_timbre;
|
||||
}
|
||||
|
@ -122,7 +122,9 @@ void backlight_disable(void) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
bool is_backlight_enabled(void) { return backlight_config.enable; }
|
||||
bool is_backlight_enabled(void) {
|
||||
return backlight_config.enable;
|
||||
}
|
||||
|
||||
/** \brief Backlight step through levels
|
||||
*
|
||||
@ -158,11 +160,17 @@ void backlight_level(uint8_t level) {
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
}
|
||||
|
||||
uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); }
|
||||
uint8_t eeconfig_read_backlight(void) {
|
||||
return eeprom_read_byte(EECONFIG_BACKLIGHT);
|
||||
}
|
||||
|
||||
void eeconfig_update_backlight(uint8_t val) { eeprom_update_byte(EECONFIG_BACKLIGHT, val); }
|
||||
void eeconfig_update_backlight(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_BACKLIGHT, val);
|
||||
}
|
||||
|
||||
void eeconfig_update_backlight_current(void) { eeconfig_update_backlight(backlight_config.raw); }
|
||||
void eeconfig_update_backlight_current(void) {
|
||||
eeconfig_update_backlight(backlight_config.raw);
|
||||
}
|
||||
|
||||
void eeconfig_update_backlight_default(void) {
|
||||
backlight_config.enable = 1;
|
||||
@ -179,7 +187,9 @@ void eeconfig_update_backlight_default(void) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t get_backlight_level(void) { return backlight_config.level; }
|
||||
uint8_t get_backlight_level(void) {
|
||||
return backlight_config.level;
|
||||
}
|
||||
|
||||
#ifdef BACKLIGHT_BREATHING
|
||||
/** \brief Backlight breathing toggle
|
||||
@ -225,18 +235,30 @@ void backlight_disable_breathing(void) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
bool is_backlight_breathing(void) { return backlight_config.breathing; }
|
||||
bool is_backlight_breathing(void) {
|
||||
return backlight_config.breathing;
|
||||
}
|
||||
|
||||
// following are marked as weak purely for backwards compatibility
|
||||
__attribute__((weak)) void breathing_period_set(uint8_t value) { breathing_period = value ? value : 1; }
|
||||
__attribute__((weak)) void breathing_period_set(uint8_t value) {
|
||||
breathing_period = value ? value : 1;
|
||||
}
|
||||
|
||||
__attribute__((weak)) uint8_t get_breathing_period(void) { return breathing_period; }
|
||||
__attribute__((weak)) uint8_t get_breathing_period(void) {
|
||||
return breathing_period;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void breathing_period_default(void) { breathing_period_set(BREATHING_PERIOD); }
|
||||
__attribute__((weak)) void breathing_period_default(void) {
|
||||
breathing_period_set(BREATHING_PERIOD);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void breathing_period_inc(void) { breathing_period_set(breathing_period + 1); }
|
||||
__attribute__((weak)) void breathing_period_inc(void) {
|
||||
breathing_period_set(breathing_period + 1);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void breathing_period_dec(void) { breathing_period_set(breathing_period - 1); }
|
||||
__attribute__((weak)) void breathing_period_dec(void) {
|
||||
breathing_period_set(breathing_period - 1);
|
||||
}
|
||||
|
||||
__attribute__((weak)) void breathing_toggle(void) {
|
||||
if (is_breathing())
|
||||
|
@ -203,7 +203,9 @@ static inline void disable_pwm(void) {
|
||||
// or F_CPU/BACKLIGHT_CUSTOM_RESOLUTION if used.
|
||||
|
||||
// Triggered when the counter reaches the OCRx value
|
||||
ISR(TIMERx_COMPA_vect) { backlight_pins_off(); }
|
||||
ISR(TIMERx_COMPA_vect) {
|
||||
backlight_pins_off();
|
||||
}
|
||||
|
||||
// Triggered when the counter reaches the TOP value
|
||||
// this one triggers at F_CPU/ICRx = 16MHz/65536 =~ 244 Hz
|
||||
@ -249,10 +251,14 @@ static uint16_t cie_lightness(uint16_t v) {
|
||||
}
|
||||
|
||||
// rescale the supplied backlight value to be in terms of the value limit // range for val is [0..ICRx]. PWM pin is high while the timer count is below val.
|
||||
static uint32_t rescale_limit_val(uint32_t val) { return (val * (BACKLIGHT_LIMIT_VAL + 1)) / 256; }
|
||||
static uint32_t rescale_limit_val(uint32_t val) {
|
||||
return (val * (BACKLIGHT_LIMIT_VAL + 1)) / 256;
|
||||
}
|
||||
|
||||
// range for val is [0..ICRx]. PWM pin is high while the timer count is below val.
|
||||
static inline void set_pwm(uint16_t val) { OCRxx = val; }
|
||||
static inline void set_pwm(uint16_t val) {
|
||||
OCRxx = val;
|
||||
}
|
||||
|
||||
void backlight_set(uint8_t level) {
|
||||
if (level > BACKLIGHT_LEVELS) level = BACKLIGHT_LEVELS;
|
||||
@ -303,7 +309,9 @@ static uint16_t breathing_freq_scale_factor = 2;
|
||||
# ifdef BACKLIGHT_PWM_TIMER
|
||||
static bool breathing = false;
|
||||
|
||||
bool is_breathing(void) { return breathing; }
|
||||
bool is_breathing(void) {
|
||||
return breathing;
|
||||
}
|
||||
|
||||
# define breathing_interrupt_enable() \
|
||||
do { \
|
||||
@ -315,7 +323,9 @@ bool is_breathing(void) { return breathing; }
|
||||
} while (0)
|
||||
# else
|
||||
|
||||
bool is_breathing(void) { return !!(TIMSKx & _BV(TOIEx)); }
|
||||
bool is_breathing(void) {
|
||||
return !!(TIMSKx & _BV(TOIEx));
|
||||
}
|
||||
|
||||
# define breathing_interrupt_enable() \
|
||||
do { \
|
||||
@ -370,7 +380,9 @@ void breathing_self_disable(void) {
|
||||
static const uint8_t breathing_table[BREATHING_STEPS] PROGMEM = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
// Use this before the cie_lightness function.
|
||||
static inline uint16_t scale_backlight(uint16_t v) { return v / BACKLIGHT_LEVELS * get_backlight_level(); }
|
||||
static inline uint16_t scale_backlight(uint16_t v) {
|
||||
return v / BACKLIGHT_LEVELS * get_backlight_level();
|
||||
}
|
||||
|
||||
# ifdef BACKLIGHT_PWM_TIMER
|
||||
void breathing_task(void)
|
||||
|
@ -117,7 +117,9 @@ static const uint8_t breathing_table[BREATHING_STEPS] = {0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
void breathing_callback(PWMDriver *pwmp);
|
||||
|
||||
bool is_breathing(void) { return pwmCFG.callback != NULL; }
|
||||
bool is_breathing(void) {
|
||||
return pwmCFG.callback != NULL;
|
||||
}
|
||||
|
||||
void breathing_enable(void) {
|
||||
pwmCFG.callback = breathing_callback;
|
||||
@ -133,7 +135,9 @@ void breathing_disable(void) {
|
||||
}
|
||||
|
||||
// Use this before the cie_lightness function.
|
||||
static inline uint16_t scale_backlight(uint16_t v) { return v / BACKLIGHT_LEVELS * get_backlight_level(); }
|
||||
static inline uint16_t scale_backlight(uint16_t v) {
|
||||
return v / BACKLIGHT_LEVELS * get_backlight_level();
|
||||
}
|
||||
|
||||
void breathing_callback(PWMDriver *pwmp) {
|
||||
uint8_t breathing_period = get_breathing_period();
|
||||
|
@ -44,6 +44,10 @@ void backlight_pins_init(void) {
|
||||
FOR_EACH_LED(setPinOutput(backlight_pin); backlight_off(backlight_pin);)
|
||||
}
|
||||
|
||||
void backlight_pins_on(void) { FOR_EACH_LED(backlight_on(backlight_pin);) }
|
||||
void backlight_pins_on(void) {
|
||||
FOR_EACH_LED(backlight_on(backlight_pin);)
|
||||
}
|
||||
|
||||
void backlight_pins_off(void) { FOR_EACH_LED(backlight_off(backlight_pin);) }
|
||||
void backlight_pins_off(void) {
|
||||
FOR_EACH_LED(backlight_off(backlight_pin);)
|
||||
}
|
||||
|
@ -30,11 +30,17 @@ static const uint16_t backlight_duty_table[] = {
|
||||
|
||||
// clang-format on
|
||||
|
||||
static uint8_t scale_backlight(uint8_t v) { return v * (backlight_duty_table_size - 1) / BACKLIGHT_LEVELS; }
|
||||
static uint8_t scale_backlight(uint8_t v) {
|
||||
return v * (backlight_duty_table_size - 1) / BACKLIGHT_LEVELS;
|
||||
}
|
||||
|
||||
void backlight_init_ports(void) { backlight_pins_init(); }
|
||||
void backlight_init_ports(void) {
|
||||
backlight_pins_init();
|
||||
}
|
||||
|
||||
void backlight_set(uint8_t level) { s_duty_pattern = backlight_duty_table[scale_backlight(level)]; }
|
||||
void backlight_set(uint8_t level) {
|
||||
s_duty_pattern = backlight_duty_table[scale_backlight(level)];
|
||||
}
|
||||
|
||||
void backlight_task(void) {
|
||||
static uint8_t backlight_tick = 0;
|
||||
|
@ -61,7 +61,9 @@ static void backlight_timer_top(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void backlight_timer_cmp(void) { backlight_pins_off(); }
|
||||
static void backlight_timer_cmp(void) {
|
||||
backlight_pins_off();
|
||||
}
|
||||
|
||||
void backlight_task(void) {}
|
||||
|
||||
@ -77,7 +79,9 @@ static uint16_t breathing_counter = 0;
|
||||
static const uint8_t breathing_table[BREATHING_STEPS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 17, 20, 24, 28, 32, 36, 41, 46, 51, 57, 63, 70, 76, 83, 91, 98, 106, 113, 121, 129, 138, 146, 154, 162, 170, 178, 185, 193, 200, 207, 213, 220, 225, 231, 235, 240, 244, 247, 250, 252, 253, 254, 255, 254, 253, 252, 250, 247, 244, 240, 235, 231, 225, 220, 213, 207, 200, 193, 185, 178, 170, 162, 154, 146, 138, 129, 121, 113, 106, 98, 91, 83, 76, 70, 63, 57, 51, 46, 41, 36, 32, 28, 24, 20, 17, 15, 12, 10, 8, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
// Use this before the cie_lightness function.
|
||||
static inline uint16_t scale_backlight(uint16_t v) { return v / BACKLIGHT_LEVELS * get_backlight_level(); }
|
||||
static inline uint16_t scale_backlight(uint16_t v) {
|
||||
return v / BACKLIGHT_LEVELS * get_backlight_level();
|
||||
}
|
||||
|
||||
void breathing_task(void) {
|
||||
uint8_t breathing_period = get_breathing_period();
|
||||
@ -91,13 +95,17 @@ void breathing_task(void) {
|
||||
backlight_timer_set_duty(cie_lightness(scale_backlight((uint16_t)breathing_table[index] * 256)));
|
||||
}
|
||||
|
||||
bool is_breathing(void) { return breathing; }
|
||||
bool is_breathing(void) {
|
||||
return breathing;
|
||||
}
|
||||
|
||||
void breathing_enable(void) {
|
||||
breathing_counter = 0;
|
||||
breathing = true;
|
||||
}
|
||||
void breathing_disable(void) { breathing = false; }
|
||||
void breathing_disable(void) {
|
||||
breathing = false;
|
||||
}
|
||||
|
||||
void breathing_pulse(void) {
|
||||
backlight_set(is_backlight_enabled() ? 0 : BACKLIGHT_LEVELS);
|
||||
@ -140,8 +148,12 @@ static void timerCallback(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void backlight_timer_set_duty(uint16_t duty) { s_duty = duty; }
|
||||
static uint16_t backlight_timer_get_duty(void) { return s_duty; }
|
||||
static void backlight_timer_set_duty(uint16_t duty) {
|
||||
s_duty = duty;
|
||||
}
|
||||
static uint16_t backlight_timer_get_duty(void) {
|
||||
return s_duty;
|
||||
}
|
||||
|
||||
// ChibiOS - Map GPT timer onto Software PWM
|
||||
static void gptTimerCallback(GPTDriver *gptp) {
|
||||
|
@ -20,7 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// bit population - return number of on-bit
|
||||
__attribute__((noinline)) uint8_t bitpop(uint8_t bits) {
|
||||
uint8_t c;
|
||||
for (c = 0; bits; c++) bits &= bits - 1;
|
||||
for (c = 0; bits; c++)
|
||||
bits &= bits - 1;
|
||||
return c;
|
||||
/*
|
||||
const uint8_t bit_count[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
|
||||
@ -30,13 +31,15 @@ __attribute__((noinline)) uint8_t bitpop(uint8_t bits) {
|
||||
|
||||
uint8_t bitpop16(uint16_t bits) {
|
||||
uint8_t c;
|
||||
for (c = 0; bits; c++) bits &= bits - 1;
|
||||
for (c = 0; bits; c++)
|
||||
bits &= bits - 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
uint8_t bitpop32(uint32_t bits) {
|
||||
uint8_t c;
|
||||
for (c = 0; bits; c++) bits &= bits - 1;
|
||||
for (c = 0; bits; c++)
|
||||
bits &= bits - 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,9 @@
|
||||
*
|
||||
* ...just incase someone wants to only change the eeprom behaviour
|
||||
*/
|
||||
__attribute__((weak)) void bootmagic_lite_reset_eeprom(void) { eeconfig_disable(); }
|
||||
__attribute__((weak)) void bootmagic_lite_reset_eeprom(void) {
|
||||
eeconfig_disable();
|
||||
}
|
||||
|
||||
/** \brief The lite version of TMK's bootmagic based on Wilba.
|
||||
*
|
||||
@ -57,4 +59,6 @@ __attribute__((weak)) void bootmagic_lite(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void bootmagic(void) { bootmagic_lite(); }
|
||||
void bootmagic(void) {
|
||||
bootmagic_lite();
|
||||
}
|
||||
|
@ -104,7 +104,9 @@ RGB hsv_to_rgb(HSV hsv) {
|
||||
#endif
|
||||
}
|
||||
|
||||
RGB hsv_to_rgb_nocie(HSV hsv) { return hsv_to_rgb_impl(hsv, false); }
|
||||
RGB hsv_to_rgb_nocie(HSV hsv) {
|
||||
return hsv_to_rgb_impl(hsv, false);
|
||||
}
|
||||
|
||||
#ifdef RGBW
|
||||
# ifndef MIN
|
||||
|
@ -69,4 +69,6 @@ void debounce(matrix_row_t raw[], matrix_row_t cooked[], uint8_t num_rows, bool
|
||||
}
|
||||
}
|
||||
|
||||
bool debounce_active(void) { return true; }
|
||||
bool debounce_active(void) {
|
||||
return true;
|
||||
}
|
||||
|
@ -31,7 +31,9 @@ void set_time(uint32_t t);
|
||||
void advance_time(uint32_t ms);
|
||||
}
|
||||
|
||||
void DebounceTest::addEvents(std::initializer_list<DebounceTestEvent> events) { events_.insert(events_.end(), events.begin(), events.end()); }
|
||||
void DebounceTest::addEvents(std::initializer_list<DebounceTestEvent> events) {
|
||||
events_.insert(events_.end(), events.begin(), events.end());
|
||||
}
|
||||
|
||||
void DebounceTest::runEvents() {
|
||||
/* Run the test multiple times, from 1kHz to 10kHz scan rate */
|
||||
|
@ -157,7 +157,15 @@ void deferred_exec_advanced_task(deferred_executor_t *table, size_t table_count,
|
||||
static uint32_t last_deferred_exec_check = 0;
|
||||
static deferred_executor_t basic_executors[MAX_DEFERRED_EXECUTORS] = {0};
|
||||
|
||||
deferred_token defer_exec(uint32_t delay_ms, deferred_exec_callback callback, void *cb_arg) { return defer_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, delay_ms, callback, cb_arg); }
|
||||
bool extend_deferred_exec(deferred_token token, uint32_t delay_ms) { return extend_deferred_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, token, delay_ms); }
|
||||
bool cancel_deferred_exec(deferred_token token) { return cancel_deferred_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, token); }
|
||||
void deferred_exec_task(void) { deferred_exec_advanced_task(basic_executors, MAX_DEFERRED_EXECUTORS, &last_deferred_exec_check); }
|
||||
deferred_token defer_exec(uint32_t delay_ms, deferred_exec_callback callback, void *cb_arg) {
|
||||
return defer_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, delay_ms, callback, cb_arg);
|
||||
}
|
||||
bool extend_deferred_exec(deferred_token token, uint32_t delay_ms) {
|
||||
return extend_deferred_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, token, delay_ms);
|
||||
}
|
||||
bool cancel_deferred_exec(deferred_token token) {
|
||||
return cancel_deferred_exec_advanced(basic_executors, MAX_DEFERRED_EXECUTORS, token);
|
||||
}
|
||||
void deferred_exec_task(void) {
|
||||
deferred_exec_advanced_task(basic_executors, MAX_DEFERRED_EXECUTORS, &last_deferred_exec_check);
|
||||
}
|
||||
|
@ -24,9 +24,13 @@ __attribute__((weak)) void digitizer_send(void) {
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak)) void digitizer_task(void) { digitizer_send(); }
|
||||
__attribute__((weak)) void digitizer_task(void) {
|
||||
digitizer_send();
|
||||
}
|
||||
|
||||
digitizer_t digitizer_get_report(void) { return digitizerReport; }
|
||||
digitizer_t digitizer_get_report(void) {
|
||||
return digitizerReport;
|
||||
}
|
||||
|
||||
void digitizer_set_report(digitizer_t newDigitizerReport) {
|
||||
digitizerReport = newDigitizerReport;
|
||||
|
@ -52,13 +52,21 @@ static uint16_t scan_count;
|
||||
static bool dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0};
|
||||
static bool last_dip_switch_state[NUMBER_OF_DIP_SWITCHES] = {0};
|
||||
|
||||
__attribute__((weak)) bool dip_switch_update_user(uint8_t index, bool active) { return true; }
|
||||
__attribute__((weak)) bool dip_switch_update_user(uint8_t index, bool active) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dip_switch_update_kb(uint8_t index, bool active) { return dip_switch_update_user(index, active); }
|
||||
__attribute__((weak)) bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||
return dip_switch_update_user(index, active);
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dip_switch_update_mask_user(uint32_t state) { return true; }
|
||||
__attribute__((weak)) bool dip_switch_update_mask_user(uint32_t state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) { return dip_switch_update_mask_user(state); }
|
||||
__attribute__((weak)) bool dip_switch_update_mask_kb(uint32_t state) {
|
||||
return dip_switch_update_mask_user(state);
|
||||
}
|
||||
|
||||
void dip_switch_init(void) {
|
||||
#ifdef DIP_SWITCH_PINS
|
||||
|
@ -79,7 +79,9 @@
|
||||
# define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE (DYNAMIC_KEYMAP_EEPROM_MAX_ADDR - DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + 1)
|
||||
#endif
|
||||
|
||||
uint8_t dynamic_keymap_get_layer_count(void) { return DYNAMIC_KEYMAP_LAYER_COUNT; }
|
||||
uint8_t dynamic_keymap_get_layer_count(void) {
|
||||
return DYNAMIC_KEYMAP_LAYER_COUNT;
|
||||
}
|
||||
|
||||
void *dynamic_keymap_key_to_eeprom_address(uint8_t layer, uint8_t row, uint8_t column) {
|
||||
// TODO: optimize this with some left shifts
|
||||
@ -151,9 +153,13 @@ uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) {
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t dynamic_keymap_macro_get_count(void) { return DYNAMIC_KEYMAP_MACRO_COUNT; }
|
||||
uint8_t dynamic_keymap_macro_get_count(void) {
|
||||
return DYNAMIC_KEYMAP_MACRO_COUNT;
|
||||
}
|
||||
|
||||
uint16_t dynamic_keymap_macro_get_buffer_size(void) { return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE; }
|
||||
uint16_t dynamic_keymap_macro_get_buffer_size(void) {
|
||||
return DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE;
|
||||
}
|
||||
|
||||
void dynamic_keymap_macro_get_buffer(uint16_t offset, uint16_t size, uint8_t *data) {
|
||||
void * source = (void *)(DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + offset);
|
||||
|
@ -90,13 +90,17 @@ void eeconfig_init_quantum(void) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_init(void) { eeconfig_init_quantum(); }
|
||||
void eeconfig_init(void) {
|
||||
eeconfig_init_quantum();
|
||||
}
|
||||
|
||||
/** \brief eeconfig enable
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_enable(void) { eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER); }
|
||||
void eeconfig_enable(void) {
|
||||
eeprom_update_word(EECONFIG_MAGIC, EECONFIG_MAGIC_NUMBER);
|
||||
}
|
||||
|
||||
/** \brief eeconfig disable
|
||||
*
|
||||
@ -141,29 +145,39 @@ bool eeconfig_is_disabled(void) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t eeconfig_read_debug(void) { return eeprom_read_byte(EECONFIG_DEBUG); }
|
||||
uint8_t eeconfig_read_debug(void) {
|
||||
return eeprom_read_byte(EECONFIG_DEBUG);
|
||||
}
|
||||
/** \brief eeconfig update debug
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_update_debug(uint8_t val) { eeprom_update_byte(EECONFIG_DEBUG, val); }
|
||||
void eeconfig_update_debug(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_DEBUG, val);
|
||||
}
|
||||
|
||||
/** \brief eeconfig read default layer
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t eeconfig_read_default_layer(void) { return eeprom_read_byte(EECONFIG_DEFAULT_LAYER); }
|
||||
uint8_t eeconfig_read_default_layer(void) {
|
||||
return eeprom_read_byte(EECONFIG_DEFAULT_LAYER);
|
||||
}
|
||||
/** \brief eeconfig update default layer
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_update_default_layer(uint8_t val) { eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val); }
|
||||
void eeconfig_update_default_layer(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_DEFAULT_LAYER, val);
|
||||
}
|
||||
|
||||
/** \brief eeconfig read keymap
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint16_t eeconfig_read_keymap(void) { return (eeprom_read_byte(EECONFIG_KEYMAP_LOWER_BYTE) | (eeprom_read_byte(EECONFIG_KEYMAP_UPPER_BYTE) << 8)); }
|
||||
uint16_t eeconfig_read_keymap(void) {
|
||||
return (eeprom_read_byte(EECONFIG_KEYMAP_LOWER_BYTE) | (eeprom_read_byte(EECONFIG_KEYMAP_UPPER_BYTE) << 8));
|
||||
}
|
||||
/** \brief eeconfig update keymap
|
||||
*
|
||||
* FIXME: needs doc
|
||||
@ -177,53 +191,73 @@ void eeconfig_update_keymap(uint16_t val) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); }
|
||||
uint8_t eeconfig_read_audio(void) {
|
||||
return eeprom_read_byte(EECONFIG_AUDIO);
|
||||
}
|
||||
/** \brief eeconfig update audio
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_update_audio(uint8_t val) { eeprom_update_byte(EECONFIG_AUDIO, val); }
|
||||
void eeconfig_update_audio(uint8_t val) {
|
||||
eeprom_update_byte(EECONFIG_AUDIO, val);
|
||||
}
|
||||
|
||||
/** \brief eeconfig read kb
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint32_t eeconfig_read_kb(void) { return eeprom_read_dword(EECONFIG_KEYBOARD); }
|
||||
uint32_t eeconfig_read_kb(void) {
|
||||
return eeprom_read_dword(EECONFIG_KEYBOARD);
|
||||
}
|
||||
/** \brief eeconfig update kb
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_update_kb(uint32_t val) { eeprom_update_dword(EECONFIG_KEYBOARD, val); }
|
||||
void eeconfig_update_kb(uint32_t val) {
|
||||
eeprom_update_dword(EECONFIG_KEYBOARD, val);
|
||||
}
|
||||
|
||||
/** \brief eeconfig read user
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint32_t eeconfig_read_user(void) { return eeprom_read_dword(EECONFIG_USER); }
|
||||
uint32_t eeconfig_read_user(void) {
|
||||
return eeprom_read_dword(EECONFIG_USER);
|
||||
}
|
||||
/** \brief eeconfig update user
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_update_user(uint32_t val) { eeprom_update_dword(EECONFIG_USER, val); }
|
||||
void eeconfig_update_user(uint32_t val) {
|
||||
eeprom_update_dword(EECONFIG_USER, val);
|
||||
}
|
||||
|
||||
/** \brief eeconfig read haptic
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
uint32_t eeconfig_read_haptic(void) { return eeprom_read_dword(EECONFIG_HAPTIC); }
|
||||
uint32_t eeconfig_read_haptic(void) {
|
||||
return eeprom_read_dword(EECONFIG_HAPTIC);
|
||||
}
|
||||
/** \brief eeconfig update haptic
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_update_haptic(uint32_t val) { eeprom_update_dword(EECONFIG_HAPTIC, val); }
|
||||
void eeconfig_update_haptic(uint32_t val) {
|
||||
eeprom_update_dword(EECONFIG_HAPTIC, val);
|
||||
}
|
||||
|
||||
/** \brief eeconfig read split handedness
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
bool eeconfig_read_handedness(void) { return !!eeprom_read_byte(EECONFIG_HANDEDNESS); }
|
||||
bool eeconfig_read_handedness(void) {
|
||||
return !!eeprom_read_byte(EECONFIG_HANDEDNESS);
|
||||
}
|
||||
/** \brief eeconfig update split handedness
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
void eeconfig_update_handedness(bool val) { eeprom_update_byte(EECONFIG_HANDEDNESS, !!val); }
|
||||
void eeconfig_update_handedness(bool val) {
|
||||
eeprom_update_byte(EECONFIG_HANDEDNESS, !!val);
|
||||
}
|
||||
|
@ -132,7 +132,9 @@ void eeconfig_update_handedness(bool val);
|
||||
flush_timer = timer_read(); \
|
||||
} \
|
||||
} \
|
||||
static inline void eeconfig_flag_##name(bool v) { dirty_##name |= v; } \
|
||||
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); \
|
||||
|
@ -59,9 +59,13 @@ static uint8_t thisHand, thatHand;
|
||||
static uint8_t encoder_value[NUMBER_OF_ENCODERS] = {0};
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { return true; }
|
||||
__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) { return encoder_update_user(index, clockwise); }
|
||||
__attribute__((weak)) bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
return encoder_update_user(index, clockwise);
|
||||
}
|
||||
|
||||
void encoder_init(void) {
|
||||
#if defined(SPLIT_KEYBOARD) && defined(ENCODERS_PAD_A_RIGHT) && defined(ENCODERS_PAD_B_RIGHT)
|
||||
@ -140,7 +144,9 @@ bool encoder_read(void) {
|
||||
#ifdef SPLIT_KEYBOARD
|
||||
void last_encoder_activity_trigger(void);
|
||||
|
||||
void encoder_state_raw(uint8_t* slave_state) { memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS); }
|
||||
void encoder_state_raw(uint8_t* slave_state) {
|
||||
memcpy(slave_state, &encoder_value[thisHand], sizeof(uint8_t) * NUMBER_OF_ENCODERS);
|
||||
}
|
||||
|
||||
void encoder_update_raw(uint8_t* slave_state) {
|
||||
bool changed = false;
|
||||
|
@ -26,7 +26,9 @@ uint8_t mockSetPinInputHigh(pin_t pin) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool mockReadPin(pin_t pin) { return pins[pin]; }
|
||||
bool mockReadPin(pin_t pin) {
|
||||
return pins[pin];
|
||||
}
|
||||
|
||||
bool setPin(pin_t pin, bool val) {
|
||||
pins[pin] = val;
|
||||
|
@ -26,7 +26,9 @@ uint8_t mockSetPinInputHigh(pin_t pin) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool mockReadPin(pin_t pin) { return pins[pin]; }
|
||||
bool mockReadPin(pin_t pin) {
|
||||
return pins[pin];
|
||||
}
|
||||
|
||||
bool setPin(pin_t pin, bool val) {
|
||||
pins[pin] = val;
|
||||
|
@ -247,7 +247,9 @@ void haptic_set_dwell(uint8_t dwell) {
|
||||
xprintf("haptic_config.dwell = %u\n", haptic_config.dwell);
|
||||
}
|
||||
|
||||
uint8_t haptic_get_enable(void) { return haptic_config.enable; }
|
||||
uint8_t haptic_get_enable(void) {
|
||||
return haptic_config.enable;
|
||||
}
|
||||
|
||||
uint8_t haptic_get_mode(void) {
|
||||
if (!haptic_config.enable) {
|
||||
|
@ -110,18 +110,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endif
|
||||
|
||||
static uint32_t last_input_modification_time = 0;
|
||||
uint32_t last_input_activity_time(void) { return last_input_modification_time; }
|
||||
uint32_t last_input_activity_elapsed(void) { return timer_elapsed32(last_input_modification_time); }
|
||||
uint32_t last_input_activity_time(void) {
|
||||
return last_input_modification_time;
|
||||
}
|
||||
uint32_t last_input_activity_elapsed(void) {
|
||||
return timer_elapsed32(last_input_modification_time);
|
||||
}
|
||||
|
||||
static uint32_t last_matrix_modification_time = 0;
|
||||
uint32_t last_matrix_activity_time(void) { return last_matrix_modification_time; }
|
||||
uint32_t last_matrix_activity_elapsed(void) { return timer_elapsed32(last_matrix_modification_time); }
|
||||
void last_matrix_activity_trigger(void) { last_matrix_modification_time = last_input_modification_time = timer_read32(); }
|
||||
uint32_t last_matrix_activity_time(void) {
|
||||
return last_matrix_modification_time;
|
||||
}
|
||||
uint32_t last_matrix_activity_elapsed(void) {
|
||||
return timer_elapsed32(last_matrix_modification_time);
|
||||
}
|
||||
void last_matrix_activity_trigger(void) {
|
||||
last_matrix_modification_time = last_input_modification_time = timer_read32();
|
||||
}
|
||||
|
||||
static uint32_t last_encoder_modification_time = 0;
|
||||
uint32_t last_encoder_activity_time(void) { return last_encoder_modification_time; }
|
||||
uint32_t last_encoder_activity_elapsed(void) { return timer_elapsed32(last_encoder_modification_time); }
|
||||
void last_encoder_activity_trigger(void) { last_encoder_modification_time = last_input_modification_time = timer_read32(); }
|
||||
uint32_t last_encoder_activity_time(void) {
|
||||
return last_encoder_modification_time;
|
||||
}
|
||||
uint32_t last_encoder_activity_elapsed(void) {
|
||||
return timer_elapsed32(last_encoder_modification_time);
|
||||
}
|
||||
void last_encoder_activity_trigger(void) {
|
||||
last_encoder_modification_time = last_input_modification_time = timer_read32();
|
||||
}
|
||||
|
||||
// Only enable this if console is enabled to print to
|
||||
#if defined(DEBUG_MATRIX_SCAN_RATE)
|
||||
@ -143,7 +159,9 @@ void matrix_scan_perf_task(void) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t get_matrix_scan_rate(void) { return last_matrix_scan_count; }
|
||||
uint32_t get_matrix_scan_rate(void) {
|
||||
return last_matrix_scan_count;
|
||||
}
|
||||
#else
|
||||
# define matrix_scan_perf_task()
|
||||
#endif
|
||||
@ -220,7 +238,9 @@ __attribute__((weak)) void keyboard_pre_init_user(void) {}
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
__attribute__((weak)) void keyboard_pre_init_kb(void) { keyboard_pre_init_user(); }
|
||||
__attribute__((weak)) void keyboard_pre_init_kb(void) {
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
/** \brief keyboard_post_init_user
|
||||
*
|
||||
@ -234,7 +254,9 @@ __attribute__((weak)) void keyboard_post_init_user() {}
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
|
||||
__attribute__((weak)) void keyboard_post_init_kb(void) { keyboard_post_init_user(); }
|
||||
__attribute__((weak)) void keyboard_post_init_kb(void) {
|
||||
keyboard_post_init_user();
|
||||
}
|
||||
|
||||
/** \brief keyboard_setup
|
||||
*
|
||||
@ -258,13 +280,17 @@ void keyboard_setup(void) {
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
__attribute__((weak)) bool is_keyboard_master(void) { return true; }
|
||||
__attribute__((weak)) bool is_keyboard_master(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief is_keyboard_left
|
||||
*
|
||||
* FIXME: needs doc
|
||||
*/
|
||||
__attribute__((weak)) bool is_keyboard_left(void) { return true; }
|
||||
__attribute__((weak)) bool is_keyboard_left(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -273,7 +299,9 @@ __attribute__((weak)) bool is_keyboard_left(void) { return true; }
|
||||
* Override this function if you have a condition where keypresses processing should change:
|
||||
* - splits where the slave side needs to process for rgb/oled functionality
|
||||
*/
|
||||
__attribute__((weak)) bool should_process_keypress(void) { return is_keyboard_master(); }
|
||||
__attribute__((weak)) bool should_process_keypress(void) {
|
||||
return is_keyboard_master();
|
||||
}
|
||||
|
||||
/** \brief housekeeping_task_kb
|
||||
*
|
||||
|
@ -44,13 +44,21 @@ typedef struct {
|
||||
* 1) (time == 0) to handle (keyevent_t){} as empty event
|
||||
* 2) Matrix(255, 255) to make TICK event available
|
||||
*/
|
||||
static inline bool IS_NOEVENT(keyevent_t event) { return event.time == 0 || (event.key.row == 255 && event.key.col == 255); }
|
||||
static inline bool IS_PRESSED(keyevent_t event) { return (!IS_NOEVENT(event) && event.pressed); }
|
||||
static inline bool IS_RELEASED(keyevent_t event) { return (!IS_NOEVENT(event) && !event.pressed); }
|
||||
static inline bool IS_NOEVENT(keyevent_t event) {
|
||||
return event.time == 0 || (event.key.row == 255 && event.key.col == 255);
|
||||
}
|
||||
static inline bool IS_PRESSED(keyevent_t event) {
|
||||
return (!IS_NOEVENT(event) && event.pressed);
|
||||
}
|
||||
static inline bool IS_RELEASED(keyevent_t event) {
|
||||
return (!IS_NOEVENT(event) && !event.pressed);
|
||||
}
|
||||
|
||||
/* Tick event */
|
||||
#define TICK \
|
||||
(keyevent_t) { .key = (keypos_t){.row = 255, .col = 255}, .pressed = false, .time = (timer_read() | 1) }
|
||||
(keyevent_t) { \
|
||||
.key = (keypos_t){.row = 255, .col = 255}, .pressed = false, .time = (timer_read() | 1) \
|
||||
}
|
||||
|
||||
/* it runs once at early stage of startup before keyboard_init. */
|
||||
void keyboard_setup(void);
|
||||
|
@ -64,13 +64,17 @@ __attribute__((weak)) void led_set_user(uint8_t usb_led) {}
|
||||
*
|
||||
* \deprecated Use led_update_kb() instead.
|
||||
*/
|
||||
__attribute__((weak)) void led_set_kb(uint8_t usb_led) { led_set_user(usb_led); }
|
||||
__attribute__((weak)) void led_set_kb(uint8_t usb_led) {
|
||||
led_set_user(usb_led);
|
||||
}
|
||||
|
||||
/** \brief Lock LED update callback - keymap/user level
|
||||
*
|
||||
* \return True if led_update_kb() should run its own code, false otherwise.
|
||||
*/
|
||||
__attribute__((weak)) bool led_update_user(led_t led_state) { return true; }
|
||||
__attribute__((weak)) bool led_update_user(led_t led_state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief Lock LED update callback - keyboard level
|
||||
*
|
||||
@ -156,7 +160,9 @@ void led_suspend(void) {
|
||||
|
||||
/** \brief Trigger behaviour on transition from suspend
|
||||
*/
|
||||
void led_wakeup(void) { led_set(host_keyboard_leds()); }
|
||||
void led_wakeup(void) {
|
||||
led_set(host_keyboard_leds());
|
||||
}
|
||||
|
||||
/** \brief set host led state
|
||||
*
|
||||
|
@ -7,7 +7,9 @@ static uint8_t BAND_math(uint8_t val, uint8_t i, uint8_t time) {
|
||||
return scale8(v < 0 ? 0 : v, val);
|
||||
}
|
||||
|
||||
bool BAND(effect_params_t* params) { return effect_runner_i(params, &BAND_math); }
|
||||
bool BAND(effect_params_t* params) {
|
||||
return effect_runner_i(params, &BAND_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_BAND
|
||||
|
@ -2,9 +2,13 @@
|
||||
LED_MATRIX_EFFECT(BAND_PINWHEEL)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t time) { return scale8(val - time - atan2_8(dy, dx) * 3, val); }
|
||||
static uint8_t BAND_PINWHEEL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t time) {
|
||||
return scale8(val - time - atan2_8(dy, dx) * 3, val);
|
||||
}
|
||||
|
||||
bool BAND_PINWHEEL(effect_params_t* params) { return effect_runner_dx_dy(params, &BAND_PINWHEEL_math); }
|
||||
bool BAND_PINWHEEL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy(params, &BAND_PINWHEEL_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_BAND_PINWHEEL
|
||||
|
@ -2,9 +2,13 @@
|
||||
LED_MATRIX_EFFECT(BAND_SPIRAL)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { return scale8(val + dist - time - atan2_8(dy, dx), val); }
|
||||
static uint8_t BAND_SPIRAL_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
return scale8(val + dist - time - atan2_8(dy, dx), val);
|
||||
}
|
||||
|
||||
bool BAND_SPIRAL(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math); }
|
||||
bool BAND_SPIRAL(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &BAND_SPIRAL_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_BAND_SPIRAL
|
||||
|
@ -2,9 +2,13 @@
|
||||
LED_MATRIX_EFFECT(CYCLE_LEFT_RIGHT)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(g_led_config.point[i].x - time, val); }
|
||||
static uint8_t CYCLE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) {
|
||||
return scale8(g_led_config.point[i].x - time, val);
|
||||
}
|
||||
|
||||
bool CYCLE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math); }
|
||||
bool CYCLE_LEFT_RIGHT(effect_params_t* params) {
|
||||
return effect_runner_i(params, &CYCLE_LEFT_RIGHT_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_CYCLE_LEFT_RIGHT
|
||||
|
@ -2,9 +2,13 @@
|
||||
LED_MATRIX_EFFECT(CYCLE_OUT_IN)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) { return scale8(3 * dist / 2 + time, val); }
|
||||
static uint8_t CYCLE_OUT_IN_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uint8_t time) {
|
||||
return scale8(3 * dist / 2 + time, val);
|
||||
}
|
||||
|
||||
bool CYCLE_OUT_IN(effect_params_t* params) { return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math); }
|
||||
bool CYCLE_OUT_IN(effect_params_t* params) {
|
||||
return effect_runner_dx_dy_dist(params, &CYCLE_OUT_IN_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_CYCLE_OUT_IN
|
||||
|
@ -2,9 +2,13 @@
|
||||
LED_MATRIX_EFFECT(CYCLE_UP_DOWN)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(g_led_config.point[i].y - time, val); }
|
||||
static uint8_t CYCLE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) {
|
||||
return scale8(g_led_config.point[i].y - time, val);
|
||||
}
|
||||
|
||||
bool CYCLE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &CYCLE_UP_DOWN_math); }
|
||||
bool CYCLE_UP_DOWN(effect_params_t* params) {
|
||||
return effect_runner_i(params, &CYCLE_UP_DOWN_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_CYCLE_UP_DOWN
|
||||
|
@ -2,9 +2,13 @@
|
||||
LED_MATRIX_EFFECT(DUAL_BEACON)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time) { return scale8(((g_led_config.point[i].y - k_led_matrix_center.y) * cos + (g_led_config.point[i].x - k_led_matrix_center.x) * sin) / 128, val); }
|
||||
static uint8_t DUAL_BEACON_math(uint8_t val, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
|
||||
return scale8(((g_led_config.point[i].y - k_led_matrix_center.y) * cos + (g_led_config.point[i].x - k_led_matrix_center.x) * sin) / 128, val);
|
||||
}
|
||||
|
||||
bool DUAL_BEACON(effect_params_t* params) { return effect_runner_sin_cos_i(params, &DUAL_BEACON_math); }
|
||||
bool DUAL_BEACON(effect_params_t* params) {
|
||||
return effect_runner_sin_cos_i(params, &DUAL_BEACON_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_DUAL_BEACON
|
||||
|
@ -23,11 +23,15 @@ static uint8_t SOLID_REACTIVE_CROSS_math(uint8_t val, int16_t dx, int16_t dy, ui
|
||||
}
|
||||
|
||||
# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_CROSS
|
||||
bool SOLID_REACTIVE_CROSS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math); }
|
||||
bool SOLID_REACTIVE_CROSS(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_CROSS_math);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTICROSS
|
||||
bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math); }
|
||||
bool SOLID_REACTIVE_MULTICROSS(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_CROSS_math);
|
||||
}
|
||||
# endif
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
@ -20,11 +20,15 @@ static uint8_t SOLID_REACTIVE_NEXUS_math(uint8_t val, int16_t dx, int16_t dy, ui
|
||||
}
|
||||
|
||||
# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_NEXUS
|
||||
bool SOLID_REACTIVE_NEXUS(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math); }
|
||||
bool SOLID_REACTIVE_NEXUS(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_NEXUS_math);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTINEXUS
|
||||
bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math); }
|
||||
bool SOLID_REACTIVE_MULTINEXUS(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_NEXUS_math);
|
||||
}
|
||||
# endif
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
@ -3,9 +3,13 @@
|
||||
LED_MATRIX_EFFECT(SOLID_REACTIVE_SIMPLE)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) { return scale8(255 - offset, val); }
|
||||
static uint8_t SOLID_REACTIVE_SIMPLE_math(uint8_t val, uint16_t offset) {
|
||||
return scale8(255 - offset, val);
|
||||
}
|
||||
|
||||
bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) { return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math); }
|
||||
bool SOLID_REACTIVE_SIMPLE(effect_params_t* params) {
|
||||
return effect_runner_reactive(params, &SOLID_REACTIVE_SIMPLE_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
# endif // ENABLE_LED_MATRIX_SOLID_REACTIVE_SIMPLE
|
||||
|
@ -18,11 +18,15 @@ static uint8_t SOLID_REACTIVE_WIDE_math(uint8_t val, int16_t dx, int16_t dy, uin
|
||||
}
|
||||
|
||||
# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_WIDE
|
||||
bool SOLID_REACTIVE_WIDE(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math); }
|
||||
bool SOLID_REACTIVE_WIDE(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_REACTIVE_WIDE_math);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef ENABLE_LED_MATRIX_SOLID_REACTIVE_MULTIWIDE
|
||||
bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math); }
|
||||
bool SOLID_REACTIVE_MULTIWIDE(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SOLID_REACTIVE_WIDE_math);
|
||||
}
|
||||
# endif
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
@ -18,11 +18,15 @@ uint8_t SOLID_SPLASH_math(uint8_t val, int16_t dx, int16_t dy, uint8_t dist, uin
|
||||
}
|
||||
|
||||
# ifdef ENABLE_LED_MATRIX_SOLID_SPLASH
|
||||
bool SOLID_SPLASH(effect_params_t* params) { return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math); }
|
||||
bool SOLID_SPLASH(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(qsub8(g_last_hit_tracker.count, 1), params, &SOLID_SPLASH_math);
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef ENABLE_LED_MATRIX_SOLID_MULTISPLASH
|
||||
bool SOLID_MULTISPLASH(effect_params_t* params) { return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math); }
|
||||
bool SOLID_MULTISPLASH(effect_params_t* params) {
|
||||
return effect_runner_reactive_splash(0, params, &SOLID_SPLASH_math);
|
||||
}
|
||||
# endif
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
@ -2,9 +2,13 @@
|
||||
LED_MATRIX_EFFECT(WAVE_LEFT_RIGHT)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(sin8(g_led_config.point[i].x - time), val); }
|
||||
static uint8_t WAVE_LEFT_RIGHT_math(uint8_t val, uint8_t i, uint8_t time) {
|
||||
return scale8(sin8(g_led_config.point[i].x - time), val);
|
||||
}
|
||||
|
||||
bool WAVE_LEFT_RIGHT(effect_params_t* params) { return effect_runner_i(params, &WAVE_LEFT_RIGHT_math); }
|
||||
bool WAVE_LEFT_RIGHT(effect_params_t* params) {
|
||||
return effect_runner_i(params, &WAVE_LEFT_RIGHT_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_WAVE_LEFT_RIGHT
|
||||
|
@ -2,9 +2,13 @@
|
||||
LED_MATRIX_EFFECT(WAVE_UP_DOWN)
|
||||
# ifdef LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
|
||||
static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) { return scale8(sin8(g_led_config.point[i].y - time), val); }
|
||||
static uint8_t WAVE_UP_DOWN_math(uint8_t val, uint8_t i, uint8_t time) {
|
||||
return scale8(sin8(g_led_config.point[i].y - time), val);
|
||||
}
|
||||
|
||||
bool WAVE_UP_DOWN(effect_params_t* params) { return effect_runner_i(params, &WAVE_UP_DOWN_math); }
|
||||
bool WAVE_UP_DOWN(effect_params_t* params) {
|
||||
return effect_runner_i(params, &WAVE_UP_DOWN_math);
|
||||
}
|
||||
|
||||
# endif // LED_MATRIX_CUSTOM_EFFECT_IMPLS
|
||||
#endif // ENABLE_LED_MATRIX_WAVE_UP_DOWN
|
||||
|
@ -120,7 +120,9 @@ const uint8_t k_led_matrix_split[2] = LED_MATRIX_SPLIT;
|
||||
|
||||
EECONFIG_DEBOUNCE_HELPER(led_matrix, EECONFIG_LED_MATRIX, led_matrix_eeconfig);
|
||||
|
||||
void eeconfig_update_led_matrix(void) { eeconfig_flush_led_matrix(true); }
|
||||
void eeconfig_update_led_matrix(void) {
|
||||
eeconfig_flush_led_matrix(true);
|
||||
}
|
||||
|
||||
void eeconfig_update_led_matrix_default(void) {
|
||||
dprintf("eeconfig_update_led_matrix_default\n");
|
||||
@ -141,7 +143,9 @@ void eeconfig_debug_led_matrix(void) {
|
||||
dprintf("led_matrix_eeconfig.flags = %d\n", led_matrix_eeconfig.flags);
|
||||
}
|
||||
|
||||
__attribute__((weak)) uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { return 0; }
|
||||
__attribute__((weak)) uint8_t led_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *led_i) {
|
||||
uint8_t led_count = led_matrix_map_row_column_to_led_kb(row, column, led_i);
|
||||
@ -153,7 +157,9 @@ uint8_t led_matrix_map_row_column_to_led(uint8_t row, uint8_t column, uint8_t *l
|
||||
return led_count;
|
||||
}
|
||||
|
||||
void led_matrix_update_pwm_buffers(void) { led_matrix_driver.flush(); }
|
||||
void led_matrix_update_pwm_buffers(void) {
|
||||
led_matrix_driver.flush();
|
||||
}
|
||||
|
||||
void led_matrix_set_value(int index, uint8_t value) {
|
||||
#ifdef USE_CIE1931_CURVE
|
||||
@ -164,7 +170,8 @@ void led_matrix_set_value(int index, uint8_t value) {
|
||||
|
||||
void led_matrix_set_value_all(uint8_t value) {
|
||||
#if defined(LED_MATRIX_ENABLE) && defined(LED_MATRIX_SPLIT)
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) led_matrix_set_value(i, value);
|
||||
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++)
|
||||
led_matrix_set_value(i, value);
|
||||
#else
|
||||
# ifdef USE_CIE1931_CURVE
|
||||
led_matrix_driver.set_value_all(pgm_read_byte(&CIE1931_CURVE[value]));
|
||||
@ -447,7 +454,9 @@ void led_matrix_set_suspend_state(bool state) {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool led_matrix_get_suspend_state(void) { return suspend_state; }
|
||||
bool led_matrix_get_suspend_state(void) {
|
||||
return suspend_state;
|
||||
}
|
||||
|
||||
void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
|
||||
led_matrix_eeconfig.enable ^= 1;
|
||||
@ -455,8 +464,12 @@ void led_matrix_toggle_eeprom_helper(bool write_to_eeprom) {
|
||||
eeconfig_flag_led_matrix(write_to_eeprom);
|
||||
dprintf("led matrix toggle [%s]: led_matrix_eeconfig.enable = %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.enable);
|
||||
}
|
||||
void led_matrix_toggle_noeeprom(void) { led_matrix_toggle_eeprom_helper(false); }
|
||||
void led_matrix_toggle(void) { led_matrix_toggle_eeprom_helper(true); }
|
||||
void led_matrix_toggle_noeeprom(void) {
|
||||
led_matrix_toggle_eeprom_helper(false);
|
||||
}
|
||||
void led_matrix_toggle(void) {
|
||||
led_matrix_toggle_eeprom_helper(true);
|
||||
}
|
||||
|
||||
void led_matrix_enable(void) {
|
||||
led_matrix_enable_noeeprom();
|
||||
@ -478,7 +491,9 @@ void led_matrix_disable_noeeprom(void) {
|
||||
led_matrix_eeconfig.enable = 0;
|
||||
}
|
||||
|
||||
uint8_t led_matrix_is_enabled(void) { return led_matrix_eeconfig.enable; }
|
||||
uint8_t led_matrix_is_enabled(void) {
|
||||
return led_matrix_eeconfig.enable;
|
||||
}
|
||||
|
||||
void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
|
||||
if (!led_matrix_eeconfig.enable) {
|
||||
@ -495,24 +510,38 @@ void led_matrix_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
|
||||
eeconfig_flag_led_matrix(write_to_eeprom);
|
||||
dprintf("led matrix mode [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.mode);
|
||||
}
|
||||
void led_matrix_mode_noeeprom(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, false); }
|
||||
void led_matrix_mode(uint8_t mode) { led_matrix_mode_eeprom_helper(mode, true); }
|
||||
void led_matrix_mode_noeeprom(uint8_t mode) {
|
||||
led_matrix_mode_eeprom_helper(mode, false);
|
||||
}
|
||||
void led_matrix_mode(uint8_t mode) {
|
||||
led_matrix_mode_eeprom_helper(mode, true);
|
||||
}
|
||||
|
||||
uint8_t led_matrix_get_mode(void) { return led_matrix_eeconfig.mode; }
|
||||
uint8_t led_matrix_get_mode(void) {
|
||||
return led_matrix_eeconfig.mode;
|
||||
}
|
||||
|
||||
void led_matrix_step_helper(bool write_to_eeprom) {
|
||||
uint8_t mode = led_matrix_eeconfig.mode + 1;
|
||||
led_matrix_mode_eeprom_helper((mode < LED_MATRIX_EFFECT_MAX) ? mode : 1, write_to_eeprom);
|
||||
}
|
||||
void led_matrix_step_noeeprom(void) { led_matrix_step_helper(false); }
|
||||
void led_matrix_step(void) { led_matrix_step_helper(true); }
|
||||
void led_matrix_step_noeeprom(void) {
|
||||
led_matrix_step_helper(false);
|
||||
}
|
||||
void led_matrix_step(void) {
|
||||
led_matrix_step_helper(true);
|
||||
}
|
||||
|
||||
void led_matrix_step_reverse_helper(bool write_to_eeprom) {
|
||||
uint8_t mode = led_matrix_eeconfig.mode - 1;
|
||||
led_matrix_mode_eeprom_helper((mode < 1) ? LED_MATRIX_EFFECT_MAX - 1 : mode, write_to_eeprom);
|
||||
}
|
||||
void led_matrix_step_reverse_noeeprom(void) { led_matrix_step_reverse_helper(false); }
|
||||
void led_matrix_step_reverse(void) { led_matrix_step_reverse_helper(true); }
|
||||
void led_matrix_step_reverse_noeeprom(void) {
|
||||
led_matrix_step_reverse_helper(false);
|
||||
}
|
||||
void led_matrix_step_reverse(void) {
|
||||
led_matrix_step_reverse_helper(true);
|
||||
}
|
||||
|
||||
void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) {
|
||||
if (!led_matrix_eeconfig.enable) {
|
||||
@ -522,37 +551,77 @@ void led_matrix_set_val_eeprom_helper(uint8_t val, bool write_to_eeprom) {
|
||||
eeconfig_flag_led_matrix(write_to_eeprom);
|
||||
dprintf("led matrix set val [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.val);
|
||||
}
|
||||
void led_matrix_set_val_noeeprom(uint8_t val) { led_matrix_set_val_eeprom_helper(val, false); }
|
||||
void led_matrix_set_val(uint8_t val) { led_matrix_set_val_eeprom_helper(val, true); }
|
||||
void led_matrix_set_val_noeeprom(uint8_t val) {
|
||||
led_matrix_set_val_eeprom_helper(val, false);
|
||||
}
|
||||
void led_matrix_set_val(uint8_t val) {
|
||||
led_matrix_set_val_eeprom_helper(val, true);
|
||||
}
|
||||
|
||||
uint8_t led_matrix_get_val(void) { return led_matrix_eeconfig.val; }
|
||||
uint8_t led_matrix_get_val(void) {
|
||||
return led_matrix_eeconfig.val;
|
||||
}
|
||||
|
||||
void led_matrix_increase_val_helper(bool write_to_eeprom) { led_matrix_set_val_eeprom_helper(qadd8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); }
|
||||
void led_matrix_increase_val_noeeprom(void) { led_matrix_increase_val_helper(false); }
|
||||
void led_matrix_increase_val(void) { led_matrix_increase_val_helper(true); }
|
||||
void led_matrix_increase_val_helper(bool write_to_eeprom) {
|
||||
led_matrix_set_val_eeprom_helper(qadd8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom);
|
||||
}
|
||||
void led_matrix_increase_val_noeeprom(void) {
|
||||
led_matrix_increase_val_helper(false);
|
||||
}
|
||||
void led_matrix_increase_val(void) {
|
||||
led_matrix_increase_val_helper(true);
|
||||
}
|
||||
|
||||
void led_matrix_decrease_val_helper(bool write_to_eeprom) { led_matrix_set_val_eeprom_helper(qsub8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom); }
|
||||
void led_matrix_decrease_val_noeeprom(void) { led_matrix_decrease_val_helper(false); }
|
||||
void led_matrix_decrease_val(void) { led_matrix_decrease_val_helper(true); }
|
||||
void led_matrix_decrease_val_helper(bool write_to_eeprom) {
|
||||
led_matrix_set_val_eeprom_helper(qsub8(led_matrix_eeconfig.val, LED_MATRIX_VAL_STEP), write_to_eeprom);
|
||||
}
|
||||
void led_matrix_decrease_val_noeeprom(void) {
|
||||
led_matrix_decrease_val_helper(false);
|
||||
}
|
||||
void led_matrix_decrease_val(void) {
|
||||
led_matrix_decrease_val_helper(true);
|
||||
}
|
||||
|
||||
void led_matrix_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) {
|
||||
led_matrix_eeconfig.speed = speed;
|
||||
eeconfig_flag_led_matrix(write_to_eeprom);
|
||||
dprintf("led matrix set speed [%s]: %u\n", (write_to_eeprom) ? "EEPROM" : "NOEEPROM", led_matrix_eeconfig.speed);
|
||||
}
|
||||
void led_matrix_set_speed_noeeprom(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, false); }
|
||||
void led_matrix_set_speed(uint8_t speed) { led_matrix_set_speed_eeprom_helper(speed, true); }
|
||||
void led_matrix_set_speed_noeeprom(uint8_t speed) {
|
||||
led_matrix_set_speed_eeprom_helper(speed, false);
|
||||
}
|
||||
void led_matrix_set_speed(uint8_t speed) {
|
||||
led_matrix_set_speed_eeprom_helper(speed, true);
|
||||
}
|
||||
|
||||
uint8_t led_matrix_get_speed(void) { return led_matrix_eeconfig.speed; }
|
||||
uint8_t led_matrix_get_speed(void) {
|
||||
return led_matrix_eeconfig.speed;
|
||||
}
|
||||
|
||||
void led_matrix_increase_speed_helper(bool write_to_eeprom) { led_matrix_set_speed_eeprom_helper(qadd8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); }
|
||||
void led_matrix_increase_speed_noeeprom(void) { led_matrix_increase_speed_helper(false); }
|
||||
void led_matrix_increase_speed(void) { led_matrix_increase_speed_helper(true); }
|
||||
void led_matrix_increase_speed_helper(bool write_to_eeprom) {
|
||||
led_matrix_set_speed_eeprom_helper(qadd8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom);
|
||||
}
|
||||
void led_matrix_increase_speed_noeeprom(void) {
|
||||
led_matrix_increase_speed_helper(false);
|
||||
}
|
||||
void led_matrix_increase_speed(void) {
|
||||
led_matrix_increase_speed_helper(true);
|
||||
}
|
||||
|
||||
void led_matrix_decrease_speed_helper(bool write_to_eeprom) { led_matrix_set_speed_eeprom_helper(qsub8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom); }
|
||||
void led_matrix_decrease_speed_noeeprom(void) { led_matrix_decrease_speed_helper(false); }
|
||||
void led_matrix_decrease_speed(void) { led_matrix_decrease_speed_helper(true); }
|
||||
void led_matrix_decrease_speed_helper(bool write_to_eeprom) {
|
||||
led_matrix_set_speed_eeprom_helper(qsub8(led_matrix_eeconfig.speed, LED_MATRIX_SPD_STEP), write_to_eeprom);
|
||||
}
|
||||
void led_matrix_decrease_speed_noeeprom(void) {
|
||||
led_matrix_decrease_speed_helper(false);
|
||||
}
|
||||
void led_matrix_decrease_speed(void) {
|
||||
led_matrix_decrease_speed_helper(true);
|
||||
}
|
||||
|
||||
led_flags_t led_matrix_get_flags(void) { return led_matrix_eeconfig.flags; }
|
||||
led_flags_t led_matrix_get_flags(void) {
|
||||
return led_matrix_eeconfig.flags;
|
||||
}
|
||||
|
||||
void led_matrix_set_flags(led_flags_t flags) { led_matrix_eeconfig.flags = flags; }
|
||||
void led_matrix_set_flags(led_flags_t flags) {
|
||||
led_matrix_eeconfig.flags = flags;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user