summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorinnovaker <66737976+innovaker@users.noreply.github.com>2020-12-02 16:41:57 +0000
committerPete Johanson <peter@peterjohanson.com>2020-12-14 12:41:25 -0500
commitbac1f17cf6ce225876dc7b6b2a809bcd98010391 (patch)
tree9783743b31fdadd66d1b3c9e5a3e14dc661ec313 /app/src
parenta4652fa25da83ae036613157fb566eb1ce1426fe (diff)
refactor(app): replace Zephyr integer types with C99 integer types
u8_t → uint8_t u16_t → uint16_t u32_t → uint32_t u64_t → uint64_t s8_t → int8_t s16_t → int16_t s32_t → int32_t s64_t → int64_t Prerequisite for #223 See: https://github.com/zephyrproject-rtos/zephyr/releases/tag/zephyr-v2.4.0 PR: #467
Diffstat (limited to 'app/src')
-rw-r--r--app/src/behaviors/behavior_hold_tap.c18
-rw-r--r--app/src/behaviors/behavior_sensor_rotate_key_press.c4
-rw-r--r--app/src/behaviors/behavior_sticky_key.c26
-rw-r--r--app/src/ble.c20
-rw-r--r--app/src/display/widgets/battery_status.c2
-rw-r--r--app/src/display/widgets/output_status.c2
-rw-r--r--app/src/endpoints.c6
-rw-r--r--app/src/event_manager.c8
-rw-r--r--app/src/ext_power_generic.c4
-rw-r--r--app/src/hid_listener.c4
-rw-r--r--app/src/hog.c34
-rw-r--r--app/src/keymap.c28
-rw-r--r--app/src/kscan.c10
-rw-r--r--app/src/matrix_transform.c6
-rw-r--r--app/src/power.c6
-rw-r--r--app/src/rgb_underglow.c20
-rw-r--r--app/src/sensors.c4
-rw-r--r--app/src/split/bluetooth/central.c25
-rw-r--r--app/src/split/bluetooth/service.c16
-rw-r--r--app/src/usb.c4
20 files changed, 125 insertions, 122 deletions
diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c
index 1dc665d..50a9606 100644
--- a/app/src/behaviors/behavior_hold_tap.c
+++ b/app/src/behaviors/behavior_hold_tap.c
@@ -49,11 +49,11 @@ struct behavior_hold_tap_config {
// this data is specific for each hold-tap
struct active_hold_tap {
- s32_t position;
+ int32_t position;
// todo: move these params into the config->behaviors->tap and
- u32_t param_hold;
- u32_t param_tap;
- s64_t timestamp;
+ uint32_t param_hold;
+ uint32_t param_tap;
+ int64_t timestamp;
bool is_decided;
bool is_hold;
const struct behavior_hold_tap_config *config;
@@ -81,7 +81,7 @@ static int capture_event(const struct zmk_event_header *event) {
return -ENOMEM;
}
-static struct position_state_changed *find_captured_keydown_event(u32_t position) {
+static struct position_state_changed *find_captured_keydown_event(uint32_t position) {
struct position_state_changed *last_match = NULL;
for (int i = 0; i < ZMK_BHV_HOLD_TAP_MAX_CAPTURED_EVENTS; i++) {
const struct zmk_event_header *eh = captured_events[i];
@@ -155,7 +155,7 @@ static void release_captured_events() {
}
}
-static struct active_hold_tap *find_hold_tap(u32_t position) {
+static struct active_hold_tap *find_hold_tap(uint32_t position) {
for (int i = 0; i < ZMK_BHV_HOLD_TAP_MAX_HELD; i++) {
if (active_hold_taps[i].position == position) {
return &active_hold_taps[i];
@@ -164,8 +164,8 @@ static struct active_hold_tap *find_hold_tap(u32_t position) {
return NULL;
}
-static struct active_hold_tap *store_hold_tap(u32_t position, u32_t param_hold, u32_t param_tap,
- s64_t timestamp,
+static struct active_hold_tap *store_hold_tap(uint32_t position, uint32_t param_hold,
+ uint32_t param_tap, int64_t timestamp,
const struct behavior_hold_tap_config *config) {
for (int i = 0; i < ZMK_BHV_HOLD_TAP_MAX_HELD; i++) {
if (active_hold_taps[i].position != ZMK_BHV_HOLD_TAP_POSITION_NOT_USED) {
@@ -326,7 +326,7 @@ static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding,
// if this behavior was queued we have to adjust the timer to only
// wait for the remaining time.
- s32_t tapping_term_ms_left = (hold_tap->timestamp + cfg->tapping_term_ms) - k_uptime_get();
+ int32_t tapping_term_ms_left = (hold_tap->timestamp + cfg->tapping_term_ms) - k_uptime_get();
if (tapping_term_ms_left > 0) {
k_delayed_work_submit(&hold_tap->work, K_MSEC(tapping_term_ms_left));
}
diff --git a/app/src/behaviors/behavior_sensor_rotate_key_press.c b/app/src/behaviors/behavior_sensor_rotate_key_press.c
index 199ece2..85af24a 100644
--- a/app/src/behaviors/behavior_sensor_rotate_key_press.c
+++ b/app/src/behaviors/behavior_sensor_rotate_key_press.c
@@ -19,10 +19,10 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
static int behavior_sensor_rotate_key_press_init(struct device *dev) { return 0; };
static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding, struct device *sensor,
- s64_t timestamp) {
+ int64_t timestamp) {
struct sensor_value value;
int err;
- u32_t keycode;
+ uint32_t keycode;
LOG_DBG("inc keycode 0x%02X dec keycode 0x%02X", binding->param1, binding->param2);
err = sensor_channel_get(sensor, SENSOR_CHAN_ROTATION, &value);
diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c
index 3ea5868..b676e16 100644
--- a/app/src/behaviors/behavior_sticky_key.c
+++ b/app/src/behaviors/behavior_sticky_key.c
@@ -29,28 +29,29 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#define ZMK_BHV_STICKY_KEY_POSITION_NOT_USED ULONG_MAX
struct behavior_sticky_key_config {
- u32_t release_after_ms;
+ uint32_t release_after_ms;
struct zmk_behavior_binding behavior;
};
struct active_sticky_key {
- u32_t position;
- u32_t param1;
- u32_t param2;
+ uint32_t position;
+ uint32_t param1;
+ uint32_t param2;
const struct behavior_sticky_key_config *config;
// timer data.
bool timer_started;
- s64_t release_at;
+ int64_t release_at;
struct k_delayed_work release_timer;
bool timer_is_cancelled;
// usage page and keycode for the key that is being modified by this sticky key
- u8_t modified_key_usage_page;
- u32_t modified_key_keycode;
+ uint8_t modified_key_usage_page;
+ uint32_t modified_key_keycode;
};
struct active_sticky_key active_sticky_keys[ZMK_BHV_STICKY_KEY_MAX_HELD] = {};
-static struct active_sticky_key *store_sticky_key(u32_t position, u32_t param1, u32_t param2,
+static struct active_sticky_key *store_sticky_key(uint32_t position, uint32_t param1,
+ uint32_t param2,
const struct behavior_sticky_key_config *config) {
for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) {
if (active_sticky_keys[i].position != ZMK_BHV_STICKY_KEY_POSITION_NOT_USED ||
@@ -75,7 +76,7 @@ static void clear_sticky_key(struct active_sticky_key *sticky_key) {
sticky_key->position = ZMK_BHV_STICKY_KEY_POSITION_NOT_USED;
}
-static struct active_sticky_key *find_sticky_key(u32_t position) {
+static struct active_sticky_key *find_sticky_key(uint32_t position) {
for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) {
if (active_sticky_keys[i].position == position &&
!active_sticky_keys[i].timer_is_cancelled) {
@@ -85,7 +86,8 @@ static struct active_sticky_key *find_sticky_key(u32_t position) {
return NULL;
}
-static inline int press_sticky_key_behavior(struct active_sticky_key *sticky_key, s64_t timestamp) {
+static inline int press_sticky_key_behavior(struct active_sticky_key *sticky_key,
+ int64_t timestamp) {
struct zmk_behavior_binding binding = {
.behavior_dev = sticky_key->config->behavior.behavior_dev,
.param1 = sticky_key->param1,
@@ -99,7 +101,7 @@ static inline int press_sticky_key_behavior(struct active_sticky_key *sticky_key
}
static inline int release_sticky_key_behavior(struct active_sticky_key *sticky_key,
- s64_t timestamp) {
+ int64_t timestamp) {
struct zmk_behavior_binding binding = {
.behavior_dev = sticky_key->config->behavior.behavior_dev,
.param1 = sticky_key->param1,
@@ -162,7 +164,7 @@ static int on_sticky_key_binding_released(struct zmk_behavior_binding *binding,
sticky_key->timer_started = true;
sticky_key->release_at = event.timestamp + sticky_key->config->release_after_ms;
// adjust timer in case this behavior was queued by a hold-tap
- s32_t ms_left = sticky_key->release_at - k_uptime_get();
+ int32_t ms_left = sticky_key->release_at - k_uptime_get();
if (ms_left > 0) {
k_delayed_work_submit(&sticky_key->release_timer, K_MSEC(ms_left));
}
diff --git a/app/src/ble.c b/app/src/ble.c
index 32c1350..5f5f94a 100644
--- a/app/src/ble.c
+++ b/app/src/ble.c
@@ -36,8 +36,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/events/ble-active-profile-changed.h>
static struct bt_conn *auth_passkey_entry_conn;
-static u8_t passkey_entries[6] = {0, 0, 0, 0, 0, 0};
-static u8_t passkey_digit = 0;
+static uint8_t passkey_entries[6] = {0, 0, 0, 0, 0, 0};
+static uint8_t passkey_digit = 0;
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL)
#define PROFILE_COUNT (CONFIG_BT_MAX_PAIRED - 1)
@@ -58,7 +58,7 @@ enum advertising_type {
BT_GAP_ADV_FAST_INT_MAX_2, NULL)
static struct zmk_ble_profile profiles[PROFILE_COUNT];
-static u8_t active_profile;
+static uint8_t active_profile;
#define DEVICE_NAME CONFIG_BT_DEVICE_NAME
#define DEVICE_NAME_LEN (sizeof(DEVICE_NAME) - 1)
@@ -104,7 +104,7 @@ bool zmk_ble_active_profile_is_open() {
return !bt_addr_le_cmp(&profiles[active_profile].peer, BT_ADDR_LE_ANY);
}
-void set_profile_address(u8_t index, const bt_addr_le_t *addr) {
+void set_profile_address(uint8_t index, const bt_addr_le_t *addr) {
char setting_name[15];
char addr_str[BT_ADDR_LE_STR_LEN];
@@ -228,7 +228,7 @@ int zmk_ble_clear_bonds() {
int zmk_ble_active_profile_index() { return active_profile; }
-int zmk_ble_prof_select(u8_t index) {
+int zmk_ble_prof_select(uint8_t index) {
LOG_DBG("profile %d", index);
if (active_profile == index) {
return 0;
@@ -277,7 +277,7 @@ static int ble_profiles_handle_set(const char *name, size_t len, settings_read_c
if (settings_name_steq(name, "profiles", &next) && next) {
char *endptr;
- u8_t idx = strtoul(next, &endptr, 10);
+ uint8_t idx = strtoul(next, &endptr, 10);
if (*endptr != '\0') {
LOG_WRN("Invalid profile index: %s", log_strdup(next));
return -EINVAL;
@@ -339,7 +339,7 @@ static bool is_conn_active_profile(const struct bt_conn *conn) {
return bt_addr_le_cmp(bt_conn_get_dst(conn), &profiles[active_profile].peer) == 0;
}
-static void connected(struct bt_conn *conn, u8_t err) {
+static void connected(struct bt_conn *conn, uint8_t err) {
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
LOG_DBG("Connected thread: %p", k_current_get());
@@ -372,7 +372,7 @@ static void connected(struct bt_conn *conn, u8_t err) {
}
}
-static void disconnected(struct bt_conn *conn, u8_t reason) {
+static void disconnected(struct bt_conn *conn, uint8_t reason) {
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
@@ -581,12 +581,12 @@ bool zmk_ble_handle_key_user(struct zmk_key_event *key_event) {
return true;
}
- u32_t val = (key == NUMBER_0) ? 0 : (key - NUMBER_1 + 1);
+ uint32_t val = (key == NUMBER_0) ? 0 : (key - NUMBER_1 + 1);
passkey_entries[passkey_digit++] = val;
if (passkey_digit == 6) {
- u32_t passkey = 0;
+ uint32_t passkey = 0;
for (int i = 5; i >= 0; i--) {
passkey = (passkey * 10) + val;
}
diff --git a/app/src/display/widgets/battery_status.c b/app/src/display/widgets/battery_status.c
index 7b1afd1..29ae11b 100644
--- a/app/src/display/widgets/battery_status.c
+++ b/app/src/display/widgets/battery_status.c
@@ -32,7 +32,7 @@ void battery_status_init() {
void set_battery_symbol(lv_obj_t *label) {
char text[2] = " ";
- u8_t level = bt_gatt_bas_get_battery_level();
+ uint8_t level = bt_gatt_bas_get_battery_level();
#if IS_ENABLED(CONFIG_USB)
if (zmk_usb_is_powered()) {
diff --git a/app/src/display/widgets/output_status.c b/app/src/display/widgets/output_status.c
index 723d4f7..3ee2335 100644
--- a/app/src/display/widgets/output_status.c
+++ b/app/src/display/widgets/output_status.c
@@ -36,7 +36,7 @@ void set_status_symbol(lv_obj_t *label) {
enum zmk_endpoint selected_endpoint = zmk_endpoints_selected();
bool active_profile_connected = zmk_ble_active_profile_is_connected();
bool active_profie_bonded = !zmk_ble_active_profile_is_open();
- u8_t active_profile_index = zmk_ble_active_profile_index();
+ uint8_t active_profile_index = zmk_ble_active_profile_index();
char text[6] = {};
switch (selected_endpoint) {
diff --git a/app/src/endpoints.c b/app/src/endpoints.c
index 4367dd2..030b27a 100644
--- a/app/src/endpoints.c
+++ b/app/src/endpoints.c
@@ -61,7 +61,7 @@ static int send_keyboard_report() {
switch (current_endpoint) {
#if IS_ENABLED(CONFIG_ZMK_USB)
case ZMK_ENDPOINT_USB: {
- int err = zmk_usb_hid_send_report((u8_t *)keyboard_report, sizeof(*keyboard_report));
+ int err = zmk_usb_hid_send_report((uint8_t *)keyboard_report, sizeof(*keyboard_report));
if (err) {
LOG_ERR("FAILED TO SEND OVER USB: %d", err);
}
@@ -91,7 +91,7 @@ static int send_consumer_report() {
switch (current_endpoint) {
#if IS_ENABLED(CONFIG_ZMK_USB)
case ZMK_ENDPOINT_USB: {
- int err = zmk_usb_hid_send_report((u8_t *)consumer_report, sizeof(*consumer_report));
+ int err = zmk_usb_hid_send_report((uint8_t *)consumer_report, sizeof(*consumer_report));
if (err) {
LOG_ERR("FAILED TO SEND OVER USB: %d", err);
}
@@ -115,7 +115,7 @@ static int send_consumer_report() {
}
}
-int zmk_endpoints_send_report(u8_t usage_page) {
+int zmk_endpoints_send_report(uint8_t usage_page) {
LOG_DBG("usage page 0x%02X", usage_page);
switch (usage_page) {
diff --git a/app/src/event_manager.c b/app/src/event_manager.c
index 226f3ce..8c454e9 100644
--- a/app/src/event_manager.c
+++ b/app/src/event_manager.c
@@ -17,9 +17,9 @@ extern struct zmk_event_type *__event_type_end[];
extern struct zmk_event_subscription __event_subscriptions_start[];
extern struct zmk_event_subscription __event_subscriptions_end[];
-int zmk_event_manager_handle_from(struct zmk_event_header *event, u8_t start_index) {
+int zmk_event_manager_handle_from(struct zmk_event_header *event, uint8_t start_index) {
int ret = 0;
- u8_t len = __event_subscriptions_end - __event_subscriptions_start;
+ uint8_t len = __event_subscriptions_end - __event_subscriptions_start;
for (int i = start_index; i < len; i++) {
struct zmk_event_subscription *ev_sub = __event_subscriptions_start + i;
if (ev_sub->event_type == event->event) {
@@ -54,7 +54,7 @@ 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) {
- u8_t len = __event_subscriptions_end - __event_subscriptions_start;
+ uint8_t len = __event_subscriptions_end - __event_subscriptions_start;
for (int i = 0; i < len; i++) {
struct zmk_event_subscription *ev_sub = __event_subscriptions_start + i;
@@ -70,7 +70,7 @@ int zmk_event_manager_raise_after(struct zmk_event_header *event,
int zmk_event_manager_raise_at(struct zmk_event_header *event,
const struct zmk_listener *listener) {
- u8_t len = __event_subscriptions_end - __event_subscriptions_start;
+ uint8_t len = __event_subscriptions_end - __event_subscriptions_start;
for (int i = 0; i < len; i++) {
struct zmk_event_subscription *ev_sub = __event_subscriptions_start + i;
diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c
index 72950ae..8510ede 100644
--- a/app/src/ext_power_generic.c
+++ b/app/src/ext_power_generic.c
@@ -21,8 +21,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct ext_power_generic_config {
const char *label;
- const u8_t pin;
- const u8_t flags;
+ const uint8_t pin;
+ const uint8_t flags;
};
struct ext_power_generic_data {
diff --git a/app/src/hid_listener.c b/app/src/hid_listener.c
index b93abca..534831c 100644
--- a/app/src/hid_listener.c
+++ b/app/src/hid_listener.c
@@ -16,7 +16,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <dt-bindings/zmk/hid_usage_pages.h>
#include <zmk/endpoints.h>
-static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode,
+static int hid_listener_keycode_pressed(uint8_t usage_page, uint32_t keycode,
zmk_mod_flags implicit_modifiers) {
int err;
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode,
@@ -41,7 +41,7 @@ static int hid_listener_keycode_pressed(u8_t usage_page, u32_t keycode,
return zmk_endpoints_send_report(usage_page);
}
-static int hid_listener_keycode_released(u8_t usage_page, u32_t keycode,
+static int hid_listener_keycode_released(uint8_t usage_page, uint32_t keycode,
zmk_mod_flags implicit_modifiers) {
int err;
LOG_DBG("usage_page 0x%02X keycode 0x%02X mods 0x%02X", usage_page, keycode,
diff --git a/app/src/hog.c b/app/src/hog.c
index ea61933..8d10b8f 100644
--- a/app/src/hog.c
+++ b/app/src/hog.c
@@ -23,14 +23,14 @@ enum {
};
struct hids_info {
- u16_t version; /* version number of base USB HID Specification */
- u8_t code; /* country HID Device hardware is localized for. */
- u8_t flags;
+ uint16_t version; /* version number of base USB HID Specification */
+ uint8_t code; /* country HID Device hardware is localized for. */
+ uint8_t flags;
} __packed;
struct hids_report {
- u8_t id; /* report id */
- u8_t type; /* report type */
+ uint8_t id; /* report id */
+ uint8_t type; /* report type */
} __packed;
static struct hids_info info = {
@@ -56,29 +56,29 @@ static struct hids_report consumer_input = {
};
static bool host_requests_notification = false;
-static u8_t ctrl_point;
-// static u8_t proto_mode;
+static uint8_t ctrl_point;
+// static uint8_t proto_mode;
static ssize_t read_hids_info(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf,
- u16_t len, u16_t offset) {
+ uint16_t len, uint16_t offset) {
return bt_gatt_attr_read(conn, attr, buf, len, offset, attr->user_data,
sizeof(struct hids_info));
}
static ssize_t read_hids_report_ref(struct bt_conn *conn, const struct bt_gatt_attr *attr,
- void *buf, u16_t len, u16_t offset) {
+ void *buf, uint16_t len, uint16_t offset) {
return bt_gatt_attr_read(conn, attr, buf, len, offset, attr->user_data,
sizeof(struct hids_report));
}
static ssize_t read_hids_report_map(struct bt_conn *conn, const struct bt_gatt_attr *attr,
- void *buf, u16_t len, u16_t offset) {
+ void *buf, uint16_t len, uint16_t offset) {
return bt_gatt_attr_read(conn, attr, buf, len, offset, zmk_hid_report_desc,
sizeof(zmk_hid_report_desc));
}
static ssize_t read_hids_input_report(struct bt_conn *conn, const struct bt_gatt_attr *attr,
- void *buf, u16_t len, u16_t offset) {
+ void *buf, uint16_t len, uint16_t offset) {
struct zmk_hid_keyboard_report_body *report_body = &zmk_hid_get_keyboard_report()->body;
return bt_gatt_attr_read(conn, attr, buf, len, offset, report_body,
sizeof(struct zmk_hid_keyboard_report_body));
@@ -86,7 +86,7 @@ static ssize_t read_hids_input_report(struct bt_conn *conn, const struct bt_gatt
static ssize_t read_hids_consumer_input_report(struct bt_conn *conn,
const struct bt_gatt_attr *attr, void *buf,
- u16_t len, u16_t offset) {
+ uint16_t len, uint16_t offset) {
struct zmk_hid_consumer_report_body *report_body = &zmk_hid_get_consumer_report()->body;
return bt_gatt_attr_read(conn, attr, buf, len, offset, report_body,
sizeof(struct zmk_hid_consumer_report_body));
@@ -94,20 +94,20 @@ static ssize_t read_hids_consumer_input_report(struct bt_conn *conn,
// static ssize_t write_proto_mode(struct bt_conn *conn,
// const struct bt_gatt_attr *attr,
-// const void *buf, u16_t len, u16_t offset,
-// u8_t flags)
+// const void *buf, uint16_t len, uint16_t offset,
+// uint8_t flags)
// {
// printk("PROTO CHANGED\n");
// return 0;
// }
-static void input_ccc_changed(const struct bt_gatt_attr *attr, u16_t value) {
+static void input_ccc_changed(const struct bt_gatt_attr *attr, uint16_t value) {
host_requests_notification = (value == BT_GATT_CCC_NOTIFY) ? 1 : 0;
}
static ssize_t write_ctrl_point(struct bt_conn *conn, const struct bt_gatt_attr *attr,
- const void *buf, u16_t len, u16_t offset, u8_t flags) {
- u8_t *value = attr->user_data;
+ const void *buf, uint16_t len, uint16_t offset, uint8_t flags) {
+ uint8_t *value = attr->user_data;
if (offset + len > sizeof(ctrl_point)) {
return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET);
diff --git a/app/src/keymap.c b/app/src/keymap.c
index 08115a1..0dc7c1a 100644
--- a/app/src/keymap.c
+++ b/app/src/keymap.c
@@ -20,7 +20,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/events/sensor-event.h>
static zmk_keymap_layers_state _zmk_keymap_layer_state = 0;
-static u8_t _zmk_keymap_layer_default = 0;
+static uint8_t _zmk_keymap_layer_default = 0;
#define DT_DRV_COMPAT zmk_keymap
@@ -64,7 +64,7 @@ static u8_t _zmk_keymap_layer_default = 0;
// When a behavior handles a key position "down" event, we record the layer state
// here so that even if that layer is deactivated before the "up", event, we
// still send the release event to the behavior in that layer also.
-static u32_t zmk_keymap_active_behavior_layer[ZMK_KEYMAP_LEN];
+static uint32_t zmk_keymap_active_behavior_layer[ZMK_KEYMAP_LEN];
static struct zmk_behavior_binding zmk_keymap[ZMK_KEYMAP_LAYERS_LEN][ZMK_KEYMAP_LEN] = {
DT_INST_FOREACH_CHILD(0, TRANSFORMED_LAYER)};
@@ -77,7 +77,7 @@ static struct zmk_behavior_binding zmk_sensor_keymap[ZMK_KEYMAP_LAYERS_LEN]
#endif /* ZMK_KEYMAP_HAS_SENSORS */
-static inline int set_layer_state(u8_t layer, bool state) {
+static inline int set_layer_state(uint8_t layer, bool state) {
if (layer >= 32) {
return -EINVAL;
}
@@ -86,16 +86,16 @@ static inline int set_layer_state(u8_t layer, bool state) {
return 0;
}
-u8_t zmk_keymap_layer_default() { return _zmk_keymap_layer_default; }
+uint8_t zmk_keymap_layer_default() { return _zmk_keymap_layer_default; }
zmk_keymap_layers_state zmk_keymap_layer_state() { return _zmk_keymap_layer_state; }
-bool zmk_keymap_layer_active(u8_t layer) {
+bool zmk_keymap_layer_active(uint8_t layer) {
return (_zmk_keymap_layer_state & (BIT(layer))) == (BIT(layer));
};
-u8_t zmk_keymap_highest_layer_active() {
- for (u8_t layer = 31; layer > 0; layer--) {
+uint8_t zmk_keymap_highest_layer_active() {
+ for (uint8_t layer = 31; layer > 0; layer--) {
if (zmk_keymap_layer_active(layer)) {
return layer;
}
@@ -103,11 +103,11 @@ u8_t zmk_keymap_highest_layer_active() {
return zmk_keymap_layer_default();
}
-int zmk_keymap_layer_activate(u8_t layer) { return set_layer_state(layer, true); };
+int zmk_keymap_layer_activate(uint8_t layer) { return set_layer_state(layer, true); };
-int zmk_keymap_layer_deactivate(u8_t layer) { return set_layer_state(layer, false); };
+int zmk_keymap_layer_deactivate(uint8_t layer) { return set_layer_state(layer, false); };
-int zmk_keymap_layer_toggle(u8_t layer) {
+int zmk_keymap_layer_toggle(uint8_t layer) {
if (zmk_keymap_layer_active(layer)) {
return zmk_keymap_layer_deactivate(layer);
}
@@ -115,11 +115,11 @@ int zmk_keymap_layer_toggle(u8_t layer) {
return zmk_keymap_layer_activate(layer);
};
-bool is_active_layer(u8_t layer, zmk_keymap_layers_state layer_state) {
+bool is_active_layer(uint8_t layer, zmk_keymap_layers_state layer_state) {
return (layer_state & BIT(layer)) == BIT(layer) || layer == _zmk_keymap_layer_default;
}
-int zmk_keymap_apply_position_state(int layer, u32_t position, bool pressed, s64_t timestamp) {
+int zmk_keymap_apply_position_state(int layer, uint32_t position, bool pressed, int64_t timestamp) {
struct zmk_behavior_binding *binding = &zmk_keymap[layer][position];
struct device *behavior;
struct zmk_behavior_binding_event event = {
@@ -145,7 +145,7 @@ int zmk_keymap_apply_position_state(int layer, u32_t position, bool pressed, s64
}
}
-int zmk_keymap_position_state_changed(u32_t position, bool pressed, s64_t timestamp) {
+int zmk_keymap_position_state_changed(uint32_t position, bool pressed, int64_t timestamp) {
if (pressed) {
zmk_keymap_active_behavior_layer[position] = _zmk_keymap_layer_state;
}
@@ -168,7 +168,7 @@ int zmk_keymap_position_state_changed(u32_t position, bool pressed, s64_t timest
}
#if ZMK_KEYMAP_HAS_SENSORS
-int zmk_keymap_sensor_triggered(u8_t sensor_number, struct device *sensor, s64_t timestamp) {
+int zmk_keymap_sensor_triggered(uint8_t sensor_number, struct device *sensor, int64_t timestamp) {
for (int layer = ZMK_KEYMAP_LAYERS_LEN - 1; layer >= _zmk_keymap_layer_default; layer--) {
if (((_zmk_keymap_layer_state & BIT(layer)) == BIT(layer) ||
layer == _zmk_keymap_layer_default) &&
diff --git a/app/src/kscan.c b/app/src/kscan.c
index 8575e70..b6ffc37 100644
--- a/app/src/kscan.c
+++ b/app/src/kscan.c
@@ -19,9 +19,9 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#define ZMK_KSCAN_EVENT_STATE_RELEASED 1
struct zmk_kscan_event {
- u32_t row;
- u32_t column;
- u32_t state;
+ uint32_t row;
+ uint32_t column;
+ uint32_t state;
};
struct zmk_kscan_msg_processor {
@@ -30,7 +30,7 @@ struct zmk_kscan_msg_processor {
K_MSGQ_DEFINE(zmk_kscan_msgq, sizeof(struct zmk_kscan_event), CONFIG_ZMK_KSCAN_EVENT_QUEUE_SIZE, 4);
-static void zmk_kscan_callback(struct device *dev, u32_t row, u32_t column, bool pressed) {
+static void zmk_kscan_callback(struct device *dev, uint32_t row, uint32_t column, bool pressed) {
struct zmk_kscan_event ev = {
.row = row,
.column = column,
@@ -45,7 +45,7 @@ void zmk_kscan_process_msgq(struct k_work *item) {
while (k_msgq_get(&zmk_kscan_msgq, &ev, K_NO_WAIT) == 0) {
bool pressed = (ev.state == ZMK_KSCAN_EVENT_STATE_PRESSED);
- u32_t position = zmk_matrix_transform_row_column_to_position(ev.row, ev.column);
+ uint32_t position = zmk_matrix_transform_row_column_to_position(ev.row, ev.column);
struct position_state_changed *pos_ev;
LOG_DBG("Row: %d, col: %d, position: %d, pressed: %s\n", ev.row, ev.column, position,
(pressed ? "true" : "false"));
diff --git a/app/src/matrix_transform.c b/app/src/matrix_transform.c
index 4e68a56..33be93d 100644
--- a/app/src/matrix_transform.c
+++ b/app/src/matrix_transform.c
@@ -15,12 +15,12 @@
[(KT_ROW(DT_PROP_BY_IDX(ZMK_KEYMAP_TRANSFORM_NODE, map, i)) * ZMK_MATRIX_COLS) + \
KT_COL(DT_PROP_BY_IDX(ZMK_KEYMAP_TRANSFORM_NODE, map, i))] = i,
-static u32_t transform[] = {UTIL_LISTIFY(ZMK_KEYMAP_LEN, _TRANSFORM_ENTRY, 0)};
+static uint32_t transform[] = {UTIL_LISTIFY(ZMK_KEYMAP_LEN, _TRANSFORM_ENTRY, 0)};
#endif
-u32_t zmk_matrix_transform_row_column_to_position(u32_t row, u32_t column) {
- u32_t matrix_index;
+uint32_t zmk_matrix_transform_row_column_to_position(uint32_t row, uint32_t column) {
+ uint32_t matrix_index;
#if DT_NODE_HAS_PROP(ZMK_KEYMAP_TRANSFORM_NODE, col_offset)
column += DT_PROP(ZMK_KEYMAP_TRANSFORM_NODE, col_offset);
diff --git a/app/src/power.c b/app/src/power.c
index bad54d2..2330a3e 100644
--- a/app/src/power.c
+++ b/app/src/power.c
@@ -17,7 +17,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/events/position-state-changed.h>
#include <zmk/events/sensor-event.h>
-static u32_t power_last_uptime;
+static uint32_t power_last_uptime;
#define MAX_IDLE_MS CONFIG_ZMK_IDLE_SLEEP_TIMEOUT
@@ -29,10 +29,10 @@ bool is_usb_power_present() {
#endif /* CONFIG_USB */
}
-enum power_states sys_pm_policy_next_state(s32_t ticks) {
+enum power_states sys_pm_policy_next_state(int32_t ticks) {
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP_STATES
#ifdef CONFIG_HAS_SYS_POWER_STATE_DEEP_SLEEP_1
- s32_t current = k_uptime_get();
+ int32_t current = k_uptime_get();
if (power_last_uptime > 0 && !is_usb_power_present() &&
current - power_last_uptime > MAX_IDLE_MS) {
return SYS_POWER_STATE_DEEP_SLEEP_1;
diff --git a/app/src/rgb_underglow.c b/app/src/rgb_underglow.c
index 6e5cb1b..b2943e6 100644
--- a/app/src/rgb_underglow.c
+++ b/app/src/rgb_underglow.c
@@ -31,18 +31,18 @@ enum rgb_underglow_effect {
};
struct led_hsb {
- u16_t h;
- u8_t s;
- u8_t b;
+ uint16_t h;
+ uint8_t s;
+ uint8_t b;
};
struct rgb_underglow_state {
- u16_t hue;
- u8_t saturation;
- u8_t brightness;
- u8_t animation_speed;
- u8_t current_effect;
- u16_t animation_step;
+ uint16_t hue;
+ uint8_t saturation;
+ uint8_t brightness;
+ uint8_t animation_speed;
+ uint8_t current_effect;
+ uint16_t animation_step;
bool on;
};
@@ -59,7 +59,7 @@ static struct device *ext_power;
static struct led_rgb hsb_to_rgb(struct led_hsb hsb) {
double r, g, b;
- u8_t i = hsb.h / 60;
+ uint8_t i = hsb.h / 60;
double v = hsb.b / 100.0;
double s = hsb.s / 100.0;
double f = hsb.h / 360.0 * 6 - i;
diff --git a/app/src/sensors.c b/app/src/sensors.c
index f1cfdd1..5bccc85 100644
--- a/app/src/sensors.c
+++ b/app/src/sensors.c
@@ -19,7 +19,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#if ZMK_KEYMAP_HAS_SENSORS
struct sensors_data_item {
- u8_t sensor_number;
+ uint8_t sensor_number;
struct device *dev;
struct sensor_trigger trigger;
};
@@ -53,7 +53,7 @@ static void zmk_sensors_trigger_handler(struct device *dev, struct sensor_trigge
ZMK_EVENT_RAISE(event);
}
-static void zmk_sensors_init_item(const char *node, u8_t i, u8_t abs_i) {
+static void zmk_sensors_init_item(const char *node, uint8_t i, uint8_t abs_i) {
LOG_DBG("Init %s at index %d with sensor_number %d", node, i, abs_i);
sensors[i].dev = device_get_binding(node);
diff --git a/app/src/split/bluetooth/central.c b/app/src/split/bluetooth/central.c
index 2d4d1ed..f3c860f 100644
--- a/app/src/split/bluetooth/central.c
+++ b/app/src/split/bluetooth/central.c
@@ -33,11 +33,12 @@ static struct bt_uuid_128 uuid = BT_UUID_INIT_128(ZMK_SPLIT_BT_SERVICE_UUID);
static struct bt_gatt_discover_params discover_params;
static struct bt_gatt_subscribe_params subscribe_params;
-static u8_t split_central_notify_func(struct bt_conn *conn, struct bt_gatt_subscribe_params *params,
- const void *data, u16_t length) {
- static u8_t position_state[POSITION_STATE_DATA_LEN];
+static uint8_t split_central_notify_func(struct bt_conn *conn,
+ struct bt_gatt_subscribe_params *params, const void *data,
+ uint16_t length) {
+ static uint8_t position_state[POSITION_STATE_DATA_LEN];
- u8_t changed_positions[POSITION_STATE_DATA_LEN];
+ uint8_t changed_positions[POSITION_STATE_DATA_LEN];
if (!data) {
LOG_DBG("[UNSUBSCRIBED]");
@@ -48,14 +49,14 @@ static u8_t split_central_notify_func(struct bt_conn *conn, struct bt_gatt_subsc
LOG_DBG("[NOTIFICATION] data %p length %u", data, length);
for (int i = 0; i < POSITION_STATE_DATA_LEN; i++) {
- changed_positions[i] = ((u8_t *)data)[i] ^ position_state[i];
- position_state[i] = ((u8_t *)data)[i];
+ changed_positions[i] = ((uint8_t *)data)[i] ^ position_state[i];
+ position_state[i] = ((uint8_t *)data)[i];
}
for (int i = 0; i < POSITION_STATE_DATA_LEN; i++) {
for (int j = 0; j < 8; j++) {
if (changed_positions[i] & BIT(j)) {
- u32_t position = (i * 8) + j;
+ uint32_t position = (i * 8) + j;
bool pressed = position_state[i] & BIT(j);
struct position_state_changed *pos_ev = new_position_state_changed();
pos_ev->position = position;
@@ -91,8 +92,8 @@ static int split_central_subscribe(struct bt_conn *conn) {
return 0;
}
-static u8_t split_central_discovery_func(struct bt_conn *conn, const struct bt_gatt_attr *attr,
- struct bt_gatt_discover_params *params) {
+static uint8_t split_central_discovery_func(struct bt_conn *conn, const struct bt_gatt_attr *attr,
+ struct bt_gatt_discover_params *params) {
int err;
if (!attr) {
@@ -245,7 +246,7 @@ static bool split_central_eir_found(struct bt_data *data, void *user_data) {
return true;
}
-static void split_central_device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t type,
+static void split_central_device_found(const bt_addr_le_t *addr, int8_t rssi, uint8_t type,
struct net_buf_simple *ad) {
char dev[BT_ADDR_LE_STR_LEN];
@@ -272,7 +273,7 @@ static int start_scan(void) {
return 0;
}
-static void split_central_connected(struct bt_conn *conn, u8_t conn_err) {
+static void split_central_connected(struct bt_conn *conn, uint8_t conn_err) {
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
@@ -292,7 +293,7 @@ static void split_central_connected(struct bt_conn *conn, u8_t conn_err) {
split_central_process_connection(conn);
}
-static void split_central_disconnected(struct bt_conn *conn, u8_t reason) {
+static void split_central_disconnected(struct bt_conn *conn, uint8_t reason) {
char addr[BT_ADDR_LE_STR_LEN];
bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
diff --git a/app/src/split/bluetooth/service.c b/app/src/split/bluetooth/service.c
index 86af685..4839084 100644
--- a/app/src/split/bluetooth/service.c
+++ b/app/src/split/bluetooth/service.c
@@ -18,21 +18,21 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/split/bluetooth/uuid.h>
#include <zmk/split/bluetooth/service.h>
-static u8_t num_of_positions = ZMK_KEYMAP_LEN;
-static u8_t position_state[16];
+static uint8_t num_of_positions = ZMK_KEYMAP_LEN;
+static uint8_t position_state[16];
static ssize_t split_svc_pos_state(struct bt_conn *conn, const struct bt_gatt_attr *attrs,
- void *buf, u16_t len, u16_t offset) {
+ void *buf, uint16_t len, uint16_t offset) {
return bt_gatt_attr_read(conn, attrs, buf, len, offset, &position_state,
sizeof(position_state));
}
static ssize_t split_svc_num_of_positions(struct bt_conn *conn, const struct bt_gatt_attr *attrs,
- void *buf, u16_t len, u16_t offset) {
- return bt_gatt_attr_read(conn, attrs, buf, len, offset, attrs->user_data, sizeof(u8_t));
+ void *buf, uint16_t len, uint16_t offset) {
+ return bt_gatt_attr_read(conn, attrs, buf, len, offset, attrs->user_data, sizeof(uint8_t));
}
-static void split_svc_pos_state_ccc(const struct bt_gatt_attr *attr, u16_t value) {
+static void split_svc_pos_state_ccc(const struct bt_gatt_attr *attr, uint16_t value) {
LOG_DBG("value %d", value);
}
@@ -45,12 +45,12 @@ BT_GATT_SERVICE_DEFINE(
BT_GATT_DESCRIPTOR(BT_UUID_NUM_OF_DIGITALS, BT_GATT_PERM_READ, split_svc_num_of_positions, NULL,
&num_of_positions), );
-int zmk_split_bt_position_pressed(u8_t position) {
+int zmk_split_bt_position_pressed(uint8_t position) {
WRITE_BIT(position_state[position / 8], position % 8, true);
return bt_gatt_notify(NULL, &split_svc.attrs[1], &position_state, sizeof(position_state));
}
-int zmk_split_bt_position_released(u8_t position) {
+int zmk_split_bt_position_released(uint8_t position) {
WRITE_BIT(position_state[position / 8], position % 8, false);
return bt_gatt_notify(NULL, &split_svc.attrs[1], &position_state, sizeof(position_state));
} \ No newline at end of file
diff --git a/app/src/usb.c b/app/src/usb.c
index 79d03c7..d0253b5 100644
--- a/app/src/usb.c
+++ b/app/src/usb.c
@@ -31,7 +31,7 @@ static const struct hid_ops ops = {
.int_in_ready = in_ready_cb,
};
-int zmk_usb_hid_send_report(const u8_t *report, size_t len) {
+int zmk_usb_hid_send_report(const uint8_t *report, size_t len) {
switch (usb_status) {
case USB_DC_SUSPEND:
return usb_wakeup_request();
@@ -78,7 +78,7 @@ enum zmk_usb_conn_state zmk_usb_get_conn_state() {
}
}
-void usb_status_cb(enum usb_dc_status_code status, const u8_t *params) {
+void usb_status_cb(enum usb_dc_status_code status, const uint8_t *params) {
usb_status = status;
raise_usb_status_changed_event();
};