summaryrefslogtreecommitdiff
path: root/app/include
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2020-09-13 22:53:24 -0400
committerPete Johanson <peter@peterjohanson.com>2020-09-14 00:10:34 -0400
commit191a2d755ad4761bd04a30a113e05119ad7aa61e (patch)
tree5901165a6cd01427b55cda059f8587bc04b3e089 /app/include
parent296a89ce6364fd97099d694dddcbb30e8b0925c0 (diff)
chore: clang-format the codebase.
* Use the LLVM style * Override indent width (8) and column limit (100) * Fixes #142.
Diffstat (limited to 'app/include')
-rw-r--r--app/include/drivers/behavior.h69
-rw-r--r--app/include/dt-bindings/zmk/bt.h16
-rw-r--r--app/include/dt-bindings/zmk/keys.h6
-rw-r--r--app/include/dt-bindings/zmk/reset.h9
-rw-r--r--app/include/zmk/event-manager.h77
-rw-r--r--app/include/zmk/events/ble-active-profile-changed.h1
-rw-r--r--app/include/zmk/events/keycode-state-changed.h6
-rw-r--r--app/include/zmk/events/modifiers-state-changed.h8
-rw-r--r--app/include/zmk/hid.h12
-rw-r--r--app/include/zmk/keys.h3
-rw-r--r--app/include/zmk/matrix.h18
-rw-r--r--app/include/zmk/split/bluetooth/uuid.h5
12 files changed, 109 insertions, 121 deletions
diff --git a/app/include/drivers/behavior.h b/app/include/drivers/behavior.h
index 617b5ab..45b8bea 100644
--- a/app/include/drivers/behavior.h
+++ b/app/include/drivers/behavior.h
@@ -19,19 +19,20 @@
* (Internal use only.)
*/
-typedef int (*behavior_keymap_binding_callback_t)(struct device *dev, u32_t position, u32_t param1, u32_t param2);
-typedef int (*behavior_sensor_keymap_binding_callback_t)(struct device *dev, struct device *sensor, u32_t param1, u32_t param2);
+typedef int (*behavior_keymap_binding_callback_t)(struct device *dev, u32_t position, u32_t param1,
+ u32_t param2);
+typedef int (*behavior_sensor_keymap_binding_callback_t)(struct device *dev, struct device *sensor,
+ u32_t param1, u32_t param2);
__subsystem struct behavior_driver_api {
- behavior_keymap_binding_callback_t binding_pressed;
- behavior_keymap_binding_callback_t binding_released;
- behavior_sensor_keymap_binding_callback_t sensor_binding_triggered;
+ behavior_keymap_binding_callback_t binding_pressed;
+ behavior_keymap_binding_callback_t binding_released;
+ behavior_sensor_keymap_binding_callback_t sensor_binding_triggered;
};
/**
* @endcond
*/
-
/**
* @brief Handle the keymap binding being pressed
* @param dev Pointer to the device structure for the driver instance.
@@ -41,18 +42,18 @@ __subsystem struct behavior_driver_api {
* @retval 0 If successful.
* @retval Negative errno code if failure.
*/
-__syscall int behavior_keymap_binding_pressed(struct device *dev, u32_t position, u32_t param1, u32_t param2);
+__syscall int behavior_keymap_binding_pressed(struct device *dev, u32_t position, u32_t param1,
+ u32_t param2);
-static inline int z_impl_behavior_keymap_binding_pressed(struct device *dev, u32_t position, u32_t param1, u32_t param2)
-{
- const struct behavior_driver_api *api =
- (const struct behavior_driver_api *)dev->driver_api;
+static inline int z_impl_behavior_keymap_binding_pressed(struct device *dev, u32_t position,
+ u32_t param1, u32_t param2) {
+ const struct behavior_driver_api *api = (const struct behavior_driver_api *)dev->driver_api;
- if (api->binding_pressed == NULL) {
- return -ENOTSUP;
- }
+ if (api->binding_pressed == NULL) {
+ return -ENOTSUP;
+ }
- return api->binding_pressed(dev, position, param1, param2);
+ return api->binding_pressed(dev, position, param1, param2);
}
/**
@@ -63,18 +64,18 @@ static inline int z_impl_behavior_keymap_binding_pressed(struct device *dev, u32
* @retval 0 If successful.
* @retval Negative errno code if failure.
*/
-__syscall int behavior_keymap_binding_released(struct device *dev, u32_t position, u32_t param1, u32_t param2);
+__syscall int behavior_keymap_binding_released(struct device *dev, u32_t position, u32_t param1,
+ u32_t param2);
-static inline int z_impl_behavior_keymap_binding_released(struct device *dev, u32_t position, u32_t param1, u32_t param2)
-{
- const struct behavior_driver_api *api =
- (const struct behavior_driver_api *)dev->driver_api;
+static inline int z_impl_behavior_keymap_binding_released(struct device *dev, u32_t position,
+ u32_t param1, u32_t param2) {
+ const struct behavior_driver_api *api = (const struct behavior_driver_api *)dev->driver_api;
- if (api->binding_released == NULL) {
- return -ENOTSUP;
- }
+ if (api->binding_released == NULL) {
+ return -ENOTSUP;
+ }
- return api->binding_released(dev, position, param1, param2);
+ return api->binding_released(dev, position, param1, param2);
}
/**
@@ -87,21 +88,21 @@ static inline int z_impl_behavior_keymap_binding_released(struct device *dev, u3
* @retval 0 If successful.
* @retval Negative errno code if failure.
*/
-__syscall int behavior_sensor_keymap_binding_triggered(struct device *dev, struct device *sensor, u32_t param1, u32_t param2);
+__syscall int behavior_sensor_keymap_binding_triggered(struct device *dev, struct device *sensor,
+ u32_t param1, u32_t param2);
-static inline int z_impl_behavior_sensor_keymap_binding_triggered(struct device *dev, struct device *sensor, u32_t param1, u32_t param2)
-{
- const struct behavior_driver_api *api =
- (const struct behavior_driver_api *)dev->driver_api;
+static inline int z_impl_behavior_sensor_keymap_binding_triggered(struct device *dev,
+ struct device *sensor,
+ u32_t param1, u32_t param2) {
+ const struct behavior_driver_api *api = (const struct behavior_driver_api *)dev->driver_api;
- if (api->sensor_binding_triggered == NULL) {
- return -ENOTSUP;
- }
+ if (api->sensor_binding_triggered == NULL) {
+ return -ENOTSUP;
+ }
- return api->sensor_binding_triggered(dev, sensor, param1, param2);
+ return api->sensor_binding_triggered(dev, sensor, param1, param2);
}
-
/**
* @}
*/
diff --git a/app/include/dt-bindings/zmk/bt.h b/app/include/dt-bindings/zmk/bt.h
index bf8b4f5..05fd65c 100644
--- a/app/include/dt-bindings/zmk/bt.h
+++ b/app/include/dt-bindings/zmk/bt.h
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: MIT
*/
-#define BT_CLR_CMD 0
-#define BT_NXT_CMD 1
-#define BT_PRV_CMD 2
-#define BT_SEL_CMD 3
+#define BT_CLR_CMD 0
+#define BT_NXT_CMD 1
+#define BT_PRV_CMD 2
+#define BT_SEL_CMD 3
// #define BT_FULL_RESET_CMD 4
/*
@@ -15,7 +15,7 @@ Note: Some future commands will include additional parameters, so we
defines these aliases up front.
*/
-#define BT_CLR BT_CLR_CMD 0
-#define BT_NXT BT_NXT_CMD 0
-#define BT_PRV BT_PRV_CMD 0
-#define BT_SEL BT_SEL_CMD \ No newline at end of file
+#define BT_CLR BT_CLR_CMD 0
+#define BT_NXT BT_NXT_CMD 0
+#define BT_PRV BT_PRV_CMD 0
+#define BT_SEL BT_SEL_CMD \ No newline at end of file
diff --git a/app/include/dt-bindings/zmk/keys.h b/app/include/dt-bindings/zmk/keys.h
index cd9261d..d3dd634 100644
--- a/app/include/dt-bindings/zmk/keys.h
+++ b/app/include/dt-bindings/zmk/keys.h
@@ -55,7 +55,7 @@
#define QUOT 0x34
#define GRAV 0x35
#define CMMA 0x36
-#define DOT 0x37
+#define DOT 0x37
#define FSLH 0x38
#define CLCK 0x39
#define F1 0x3A
@@ -77,8 +77,8 @@
#define INS 0x49
#define HOME 0x4A
#define PGUP 0x4B
-#define DEL 0x4C
-#define END 0x4D
+#define DEL 0x4C
+#define END 0x4D
#define PGDN 0x4E
#define RARW 0x4F
#define LARW 0x50
diff --git a/app/include/dt-bindings/zmk/reset.h b/app/include/dt-bindings/zmk/reset.h
index 683f965..2b3d876 100644
--- a/app/include/dt-bindings/zmk/reset.h
+++ b/app/include/dt-bindings/zmk/reset.h
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: MIT
*/
-#define RST_WARM 0x00
-#define RST_COLD 0x01
+#define RST_WARM 0x00
+#define RST_COLD 0x01
-// AdaFruit nrf52 Bootloader Specific. See https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107
+// AdaFruit nrf52 Bootloader Specific. See
+// https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107
-#define RST_UF2 0x57 \ No newline at end of file
+#define RST_UF2 0x57 \ No newline at end of file
diff --git a/app/include/zmk/event-manager.h b/app/include/zmk/event-manager.h
index 9da6602..4b8f72c 100644
--- a/app/include/zmk/event-manager.h
+++ b/app/include/zmk/event-manager.h
@@ -3,20 +3,19 @@
*
* SPDX-License-Identifier: MIT
*/
-
+
#pragma once
#include <stddef.h>
#include <kernel.h>
#include <zephyr/types.h>
-struct zmk_event_type
-{
+struct zmk_event_type {
const char *name;
};
struct zmk_event_header {
- const struct zmk_event_type* event;
+ const struct zmk_event_type *event;
u8_t last_listener_index;
};
@@ -24,8 +23,7 @@ struct zmk_event_header {
#define ZMK_EV_EVENT_CAPTURED 2
typedef int (*zmk_listener_callback_t)(const struct zmk_event_header *eh);
-struct zmk_listener
-{
+struct zmk_listener {
zmk_listener_callback_t callback;
};
@@ -34,55 +32,50 @@ struct zmk_event_subscription {
const struct zmk_listener *listener;
};
-#define ZMK_EVENT_DECLARE(event_type) \
- struct event_type* new_##event_type(); \
- bool is_##event_type(const struct zmk_event_header *eh); \
- struct event_type* cast_##event_type(const struct zmk_event_header *eh); \
+#define ZMK_EVENT_DECLARE(event_type) \
+ struct event_type *new_##event_type(); \
+ bool is_##event_type(const struct zmk_event_header *eh); \
+ struct event_type *cast_##event_type(const struct zmk_event_header *eh); \
extern const struct zmk_event_type zmk_event_##event_type;
-#define ZMK_EVENT_IMPL(event_type) \
- const struct zmk_event_type zmk_event_##event_type = { \
- .name = STRINGIFY(event_type) \
- }; \
- const struct zmk_event_type* zmk_event_ref_##event_type __used __attribute__((__section__(".event_type"))) = &zmk_event_##event_type; \
- struct event_type* new_##event_type() { \
- struct event_type* ev = (struct event_type *) k_malloc(sizeof(struct event_type)); \
- ev->header.event = &zmk_event_##event_type; \
- return ev; \
- }; \
- bool is_##event_type(const struct zmk_event_header *eh) { \
- return eh->event == &zmk_event_##event_type; \
- }; \
- struct event_type* cast_##event_type(const struct zmk_event_header *eh) {\
- return (struct event_type*)eh; \
+#define ZMK_EVENT_IMPL(event_type) \
+ const struct zmk_event_type zmk_event_##event_type = {.name = STRINGIFY(event_type)}; \
+ const struct zmk_event_type *zmk_event_ref_##event_type __used \
+ __attribute__((__section__(".event_type"))) = &zmk_event_##event_type; \
+ struct event_type *new_##event_type() { \
+ struct event_type *ev = (struct event_type *)k_malloc(sizeof(struct event_type)); \
+ ev->header.event = &zmk_event_##event_type; \
+ return ev; \
+ }; \
+ bool is_##event_type(const struct zmk_event_header *eh) { \
+ return eh->event == &zmk_event_##event_type; \
+ }; \
+ struct event_type *cast_##event_type(const struct zmk_event_header *eh) { \
+ return (struct event_type *)eh; \
};
-
-#define ZMK_LISTENER(mod, cb) \
- const struct zmk_listener zmk_listener_##mod = { \
- .callback = cb \
- };
+#define ZMK_LISTENER(mod, cb) const struct zmk_listener zmk_listener_##mod = {.callback = cb};
-#define ZMK_SUBSCRIPTION(mod, ev_type) \
- const Z_DECL_ALIGN(struct zmk_event_subscription) _CONCAT(_CONCAT(zmk_event_sub_,mod),ev_type) __used __attribute__((__section__(".event_subscription"))) = { \
- .event_type = &zmk_event_##ev_type, \
- .listener = &zmk_listener_##mod, \
+#define ZMK_SUBSCRIPTION(mod, ev_type) \
+ const Z_DECL_ALIGN(struct zmk_event_subscription) \
+ _CONCAT(_CONCAT(zmk_event_sub_, mod), ev_type) __used \
+ __attribute__((__section__(".event_subscription"))) = { \
+ .event_type = &zmk_event_##ev_type, \
+ .listener = &zmk_listener_##mod, \
};
-#define ZMK_EVENT_RAISE(ev) \
- zmk_event_manager_raise((struct zmk_event_header *)ev);
+#define ZMK_EVENT_RAISE(ev) zmk_event_manager_raise((struct zmk_event_header *)ev);
-#define ZMK_EVENT_RAISE_AFTER(ev, mod) \
+#define ZMK_EVENT_RAISE_AFTER(ev, mod) \
zmk_event_manager_raise_after((struct zmk_event_header *)ev, &zmk_listener_##mod);
-
-#define ZMK_EVENT_RAISE_AT(ev, mod) \
+#define ZMK_EVENT_RAISE_AT(ev, mod) \
zmk_event_manager_raise_at((struct zmk_event_header *)ev, &zmk_listener_##mod);
-#define ZMK_EVENT_RELEASE(ev) \
- zmk_event_manager_release((struct zmk_event_header *)ev);
+#define ZMK_EVENT_RELEASE(ev) zmk_event_manager_release((struct zmk_event_header *)ev);
int zmk_event_manager_raise(struct zmk_event_header *event);
-int zmk_event_manager_raise_after(struct zmk_event_header *event, const struct zmk_listener *listener);
+int zmk_event_manager_raise_after(struct zmk_event_header *event,
+ const struct zmk_listener *listener);
int zmk_event_manager_raise_at(struct zmk_event_header *event, const struct zmk_listener *listener);
int zmk_event_manager_release(struct zmk_event_header *event);
diff --git a/app/include/zmk/events/ble-active-profile-changed.h b/app/include/zmk/events/ble-active-profile-changed.h
index c464236..66f40c7 100644
--- a/app/include/zmk/events/ble-active-profile-changed.h
+++ b/app/include/zmk/events/ble-active-profile-changed.h
@@ -12,7 +12,6 @@
#include <zmk/ble/profile.h>
-
struct ble_active_profile_changed {
struct zmk_event_header header;
u8_t index;
diff --git a/app/include/zmk/events/keycode-state-changed.h b/app/include/zmk/events/keycode-state-changed.h
index fc37946..4c00654 100644
--- a/app/include/zmk/events/keycode-state-changed.h
+++ b/app/include/zmk/events/keycode-state-changed.h
@@ -18,9 +18,9 @@ struct keycode_state_changed {
ZMK_EVENT_DECLARE(keycode_state_changed);
-inline struct keycode_state_changed* create_keycode_state_changed(u8_t usage_page, u32_t keycode, bool state)
-{
- struct keycode_state_changed* ev = new_keycode_state_changed();
+inline struct keycode_state_changed *create_keycode_state_changed(u8_t usage_page, u32_t keycode,
+ bool state) {
+ struct keycode_state_changed *ev = new_keycode_state_changed();
ev->usage_page = usage_page;
ev->keycode = keycode;
ev->state = state;
diff --git a/app/include/zmk/events/modifiers-state-changed.h b/app/include/zmk/events/modifiers-state-changed.h
index b39e11e..d2e02f8 100644
--- a/app/include/zmk/events/modifiers-state-changed.h
+++ b/app/include/zmk/events/modifiers-state-changed.h
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: MIT
*/
-
+
#pragma once
#include <zephyr.h>
@@ -18,9 +18,9 @@ struct modifiers_state_changed {
ZMK_EVENT_DECLARE(modifiers_state_changed);
-inline struct modifiers_state_changed* create_modifiers_state_changed(zmk_mod_flags modifiers, bool state)
-{
- struct modifiers_state_changed* ev = new_modifiers_state_changed();
+inline struct modifiers_state_changed *create_modifiers_state_changed(zmk_mod_flags modifiers,
+ bool state) {
+ struct modifiers_state_changed *ev = new_modifiers_state_changed();
ev->modifiers = modifiers;
ev->state = state;
diff --git a/app/include/zmk/hid.h b/app/include/zmk/hid.h
index a945e72..744de98 100644
--- a/app/include/zmk/hid.h
+++ b/app/include/zmk/hid.h
@@ -140,25 +140,21 @@ static const u8_t zmk_hid_report_desc[] = {
// u8_t keys[6];
// } __packed;
-struct zmk_hid_keypad_report_body
-{
+struct zmk_hid_keypad_report_body {
zmk_mod_flags modifiers;
u8_t keys[13];
} __packed;
-struct zmk_hid_keypad_report
-{
+struct zmk_hid_keypad_report {
u8_t report_id;
struct zmk_hid_keypad_report_body body;
} __packed;
-struct zmk_hid_consumer_report_body
-{
+struct zmk_hid_consumer_report_body {
u8_t keys[6];
} __packed;
-struct zmk_hid_consumer_report
-{
+struct zmk_hid_consumer_report {
u8_t report_id;
struct zmk_hid_consumer_report_body body;
} __packed;
diff --git a/app/include/zmk/keys.h b/app/include/zmk/keys.h
index ee9c3d9..af474b1 100644
--- a/app/include/zmk/keys.h
+++ b/app/include/zmk/keys.h
@@ -14,8 +14,7 @@ typedef u8_t zmk_action;
typedef u8_t zmk_mod;
typedef u8_t zmk_mod_flags;
-struct zmk_key_event
-{
+struct zmk_key_event {
u32_t column;
u32_t row;
zmk_key key;
diff --git a/app/include/zmk/matrix.h b/app/include/zmk/matrix.h
index 1614317..b3e2323 100644
--- a/app/include/zmk/matrix.h
+++ b/app/include/zmk/matrix.h
@@ -15,20 +15,20 @@
#define ZMK_KEYMAP_TRANSFORM_NODE DT_CHOSEN(zmk_matrix_transform)
#define ZMK_KEYMAP_LEN DT_PROP_LEN(ZMK_KEYMAP_TRANSFORM_NODE, map)
-#define ZMK_MATRIX_ROWS DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE,rows)
-#define ZMK_MATRIX_COLS DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE,columns)
+#define ZMK_MATRIX_ROWS DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE, rows)
+#define ZMK_MATRIX_COLS DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE, columns)
#else /* DT_HAS_CHOSEN(zmk_matrix_transform) */
-#if DT_NODE_HAS_PROP(ZMK_MATRIX_NODE_ID,row_gpios)
-#define ZMK_MATRIX_ROWS DT_PROP_LEN(ZMK_MATRIX_NODE_ID,row_gpios)
-#define ZMK_MATRIX_COLS DT_PROP_LEN(ZMK_MATRIX_NODE_ID,col_gpios)
-#elif DT_NODE_HAS_PROP(ZMK_MATRIX_NODE_ID,input_gpios)
+#if DT_NODE_HAS_PROP(ZMK_MATRIX_NODE_ID, row_gpios)
+#define ZMK_MATRIX_ROWS DT_PROP_LEN(ZMK_MATRIX_NODE_ID, row_gpios)
+#define ZMK_MATRIX_COLS DT_PROP_LEN(ZMK_MATRIX_NODE_ID, col_gpios)
+#elif DT_NODE_HAS_PROP(ZMK_MATRIX_NODE_ID, input_gpios)
#define ZMK_MATRIX_ROWS 1
-#define ZMK_MATRIX_COLS DT_PROP_LEN(ZMK_MATRIX_NODE_ID,input_gpios)
+#define ZMK_MATRIX_COLS DT_PROP_LEN(ZMK_MATRIX_NODE_ID, input_gpios)
#else
-#define ZMK_MATRIX_ROWS DT_PROP(ZMK_MATRIX_NODE_ID,rows)
-#define ZMK_MATRIX_COLS DT_PROP(ZMK_MATRIX_NODE_ID,columns)
+#define ZMK_MATRIX_ROWS DT_PROP(ZMK_MATRIX_NODE_ID, rows)
+#define ZMK_MATRIX_COLS DT_PROP(ZMK_MATRIX_NODE_ID, columns)
#endif
#define ZMK_KEYMAP_LEN (ZMK_MATRIX_COLS * ZMK_MATRIX_ROWS)
diff --git a/app/include/zmk/split/bluetooth/uuid.h b/app/include/zmk/split/bluetooth/uuid.h
index 59f2f71..a8dfbf6 100644
--- a/app/include/zmk/split/bluetooth/uuid.h
+++ b/app/include/zmk/split/bluetooth/uuid.h
@@ -3,10 +3,9 @@
#include <bluetooth/uuid.h>
#ifndef BT_UUID_NUM_OF_DIGITALS
-#define BT_UUID_NUM_OF_DIGITALS BT_UUID_DECLARE_16(0x2909)
+#define BT_UUID_NUM_OF_DIGITALS BT_UUID_DECLARE_16(0x2909)
#endif
-#define ZMK_BT_SPLIT_UUID(num) BT_UUID_128_ENCODE(num, 0x0096, 0x7107, 0xc967, 0xc5cfb1c2482a)
+#define ZMK_BT_SPLIT_UUID(num) BT_UUID_128_ENCODE(num, 0x0096, 0x7107, 0xc967, 0xc5cfb1c2482a)
#define ZMK_SPLIT_BT_SERVICE_UUID ZMK_BT_SPLIT_UUID(0x00000000)
#define ZMK_SPLIT_BT_CHAR_POSITION_STATE_UUID ZMK_BT_SPLIT_UUID(0x00000001)
-