mirror of
https://github.com/qmk/qmk_firmware
synced 2024-12-22 08:26:21 +00:00
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);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user