Clang formatter changes

This commit is contained in:
Megamind 2022-02-06 16:18:35 +08:00
parent f357aeddc8
commit ace8cc307e
4 changed files with 49 additions and 58 deletions

View file

@ -21,4 +21,3 @@ typedef struct _split_data_t {
int zmk_split_position_pressed(uint8_t position); int zmk_split_position_pressed(uint8_t position);
int zmk_split_position_released(uint8_t position); int zmk_split_position_released(uint8_t position);

View file

@ -29,17 +29,16 @@ static int uart_ready = 0;
static void split_serial_receive_thread(void *unused, void *unused1, void *unused2); static void split_serial_receive_thread(void *unused, void *unused1, void *unused2);
K_MEM_SLAB_DEFINE(split_memory_slab, sizeof(split_data_t), \ K_MEM_SLAB_DEFINE(split_memory_slab, sizeof(split_data_t),
CONFIG_ZMK_SPLIT_SERIAL_THREAD_QUEUE_SIZE, 4); CONFIG_ZMK_SPLIT_SERIAL_THREAD_QUEUE_SIZE, 4);
K_MSGQ_DEFINE(peripheral_event_msgq, sizeof(struct zmk_position_state_changed), \ K_MSGQ_DEFINE(peripheral_event_msgq, sizeof(struct zmk_position_state_changed),
CONFIG_ZMK_SPLIT_SERIAL_THREAD_QUEUE_SIZE, 4); CONFIG_ZMK_SPLIT_SERIAL_THREAD_QUEUE_SIZE, 4);
K_THREAD_DEFINE(split_central, CONFIG_ZMK_SPLIT_SERIAL_THREAD_STACK_SIZE, K_THREAD_DEFINE(split_central, CONFIG_ZMK_SPLIT_SERIAL_THREAD_STACK_SIZE,
split_serial_receive_thread, NULL, NULL, NULL, split_serial_receive_thread, NULL, NULL, NULL,
K_PRIO_PREEMPT(CONFIG_ZMK_SPLIT_SERIAL_THREAD_PRIORITY), 0, 0); K_PRIO_PREEMPT(CONFIG_ZMK_SPLIT_SERIAL_THREAD_PRIORITY), 0, 0);
static void peripheral_event_work_callback(struct k_work *work) { static void peripheral_event_work_callback(struct k_work *work) {
struct zmk_position_state_changed ev; struct zmk_position_state_changed ev;
while (k_msgq_get(&peripheral_event_msgq, &ev, K_NO_WAIT) == 0) { while (k_msgq_get(&peripheral_event_msgq, &ev, K_NO_WAIT) == 0) {
@ -64,7 +63,6 @@ static uint8_t split_central_notify_func(const void *data, uint16_t length) {
return 0; return 0;
} }
for (int i = 0; i < SPLIT_DATA_LEN; i++) { for (int i = 0; i < SPLIT_DATA_LEN; i++) {
changed_positions[i] = split_data->data[i] ^ position_state[i]; changed_positions[i] = split_data->data[i] ^ position_state[i];
position_state[i] = split_data->data[i]; position_state[i] = split_data->data[i];
@ -102,12 +100,10 @@ static char *alloc_position_state_buffer() {
return block_ptr; return block_ptr;
} }
static void free_position_state_buffer(char *block_ptr) { static void free_position_state_buffer(char *block_ptr) {
k_mem_slab_free(&split_memory_slab, (void **)&block_ptr); k_mem_slab_free(&split_memory_slab, (void **)&block_ptr);
} }
static void uart_callback(const struct device *dev, struct uart_event *evt, void *user_data) { static void uart_callback(const struct device *dev, struct uart_event *evt, void *user_data) {
char *buf = NULL; char *buf = NULL;
@ -146,7 +142,6 @@ static void uart_callback(const struct device *dev, struct uart_event *evt, void
return; return;
} }
static void split_serial_receive_thread(void *unused, void *unused1, void *unused2) { static void split_serial_receive_thread(void *unused, void *unused1, void *unused2) {
if (!device_is_ready(serial_dev)) { if (!device_is_ready(serial_dev)) {
LOG_WRN("UART device:%s not ready", serial_dev->name); LOG_WRN("UART device:%s not ready", serial_dev->name);
@ -182,4 +177,3 @@ static void split_serial_receive_thread(void *unused, void *unused1, void *unuse
} }
}; };
} }

View file

@ -35,7 +35,6 @@ struct k_work_q service_work_q;
K_MSGQ_DEFINE(position_state_msgq, sizeof(char[SPLIT_DATA_LEN]), K_MSGQ_DEFINE(position_state_msgq, sizeof(char[SPLIT_DATA_LEN]),
CONFIG_ZMK_SPLIT_SERIAL_THREAD_QUEUE_SIZE, 4); CONFIG_ZMK_SPLIT_SERIAL_THREAD_QUEUE_SIZE, 4);
void send_data_via_uart(const struct device *dev, char *data, size_t len) { void send_data_via_uart(const struct device *dev, char *data, size_t len) {
if (!uart_ready) { if (!uart_ready) {
return; return;
@ -103,4 +102,3 @@ int service_init(const struct device *_arg) {
} }
SYS_INIT(service_init, APPLICATION, CONFIG_ZMK_USB_INIT_PRIORITY); SYS_INIT(service_init, APPLICATION, CONFIG_ZMK_USB_INIT_PRIORITY);