forked from kofal.net/zmk
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
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
typedef int (*behavior_keymap_binding_callback_t)(struct zmk_behavior_binding *binding,
|
||||
struct zmk_behavior_binding_event event);
|
||||
typedef int (*behavior_sensor_keymap_binding_callback_t)(struct zmk_behavior_binding *binding,
|
||||
struct device *sensor, s64_t timestamp);
|
||||
struct device *sensor, int64_t timestamp);
|
||||
|
||||
__subsystem struct behavior_driver_api {
|
||||
behavior_keymap_binding_callback_t binding_pressed;
|
||||
@@ -92,11 +92,11 @@ static inline int z_impl_behavior_keymap_binding_released(struct zmk_behavior_bi
|
||||
* @retval Negative errno code if failure.
|
||||
*/
|
||||
__syscall int behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *binding,
|
||||
struct device *sensor, s64_t timestamp);
|
||||
struct device *sensor, int64_t timestamp);
|
||||
|
||||
static inline int
|
||||
z_impl_behavior_sensor_keymap_binding_triggered(struct zmk_behavior_binding *binding,
|
||||
struct device *sensor, s64_t timestamp) {
|
||||
struct device *sensor, int64_t timestamp) {
|
||||
struct device *dev = device_get_binding(binding->behavior_dev);
|
||||
const struct behavior_driver_api *api = (const struct behavior_driver_api *)dev->driver_api;
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
struct zmk_behavior_binding {
|
||||
char *behavior_dev;
|
||||
u32_t param1;
|
||||
u32_t param2;
|
||||
uint32_t param1;
|
||||
uint32_t param2;
|
||||
};
|
||||
|
||||
struct zmk_behavior_binding_event {
|
||||
int layer;
|
||||
u32_t position;
|
||||
s64_t timestamp;
|
||||
uint32_t position;
|
||||
int64_t timestamp;
|
||||
};
|
||||
@@ -12,7 +12,7 @@
|
||||
int zmk_ble_clear_bonds();
|
||||
int zmk_ble_prof_next();
|
||||
int zmk_ble_prof_prev();
|
||||
int zmk_ble_prof_select(u8_t index);
|
||||
int zmk_ble_prof_select(uint8_t index);
|
||||
|
||||
int zmk_ble_active_profile_index();
|
||||
bt_addr_le_t *zmk_ble_active_profile_addr();
|
||||
|
||||
@@ -18,4 +18,4 @@ int zmk_endpoints_select(enum zmk_endpoint endpoint);
|
||||
int zmk_endpoints_toggle();
|
||||
enum zmk_endpoint zmk_endpoints_selected();
|
||||
|
||||
int zmk_endpoints_send_report(u8_t usage_report);
|
||||
int zmk_endpoints_send_report(uint8_t usage_report);
|
||||
|
||||
@@ -16,7 +16,7 @@ struct zmk_event_type {
|
||||
|
||||
struct zmk_event_header {
|
||||
const struct zmk_event_type *event;
|
||||
u8_t last_listener_index;
|
||||
uint8_t last_listener_index;
|
||||
};
|
||||
|
||||
#define ZMK_EV_EVENT_HANDLED 1
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
struct battery_state_changed {
|
||||
struct zmk_event_header header;
|
||||
// TODO: Other battery channels
|
||||
u8_t state_of_charge;
|
||||
uint8_t state_of_charge;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(battery_state_changed);
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
struct ble_active_profile_changed {
|
||||
struct zmk_event_header header;
|
||||
u8_t index;
|
||||
uint8_t index;
|
||||
struct zmk_ble_profile *profile;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
|
||||
struct keycode_state_changed {
|
||||
struct zmk_event_header header;
|
||||
u8_t usage_page;
|
||||
u32_t keycode;
|
||||
u8_t implicit_modifiers;
|
||||
uint8_t usage_page;
|
||||
uint32_t keycode;
|
||||
uint8_t implicit_modifiers;
|
||||
bool state;
|
||||
s64_t timestamp;
|
||||
int64_t timestamp;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(keycode_state_changed);
|
||||
|
||||
static inline struct keycode_state_changed *
|
||||
keycode_state_changed_from_encoded(u32_t encoded, bool pressed, s64_t timestamp) {
|
||||
u16_t page = HID_USAGE_PAGE(encoded) & 0xFF;
|
||||
u16_t id = HID_USAGE_ID(encoded);
|
||||
keycode_state_changed_from_encoded(uint32_t encoded, bool pressed, int64_t timestamp) {
|
||||
uint16_t page = HID_USAGE_PAGE(encoded) & 0xFF;
|
||||
uint16_t id = HID_USAGE_ID(encoded);
|
||||
zmk_mod_flags implicit_mods = SELECT_MODS(encoded);
|
||||
|
||||
if (!page) {
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
struct layer_state_changed {
|
||||
struct zmk_event_header header;
|
||||
u8_t layer;
|
||||
uint8_t layer;
|
||||
bool state;
|
||||
s64_t timestamp;
|
||||
int64_t timestamp;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(layer_state_changed);
|
||||
|
||||
static inline struct layer_state_changed *create_layer_state_changed(u8_t layer, bool state) {
|
||||
static inline struct layer_state_changed *create_layer_state_changed(uint8_t layer, bool state) {
|
||||
struct layer_state_changed *ev = new_layer_state_changed();
|
||||
ev->layer = layer;
|
||||
ev->state = state;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
struct position_state_changed {
|
||||
struct zmk_event_header header;
|
||||
u32_t position;
|
||||
uint32_t position;
|
||||
bool state;
|
||||
s64_t timestamp;
|
||||
int64_t timestamp;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(position_state_changed);
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
struct sensor_event {
|
||||
struct zmk_event_header header;
|
||||
u8_t sensor_number;
|
||||
uint8_t sensor_number;
|
||||
struct device *sensor;
|
||||
s64_t timestamp;
|
||||
int64_t timestamp;
|
||||
};
|
||||
|
||||
ZMK_EVENT_DECLARE(sensor_event);
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#define ZMK_HID_CONSUMER_NKRO_SIZE 6
|
||||
|
||||
static const u8_t zmk_hid_report_desc[] = {
|
||||
static const uint8_t zmk_hid_report_desc[] = {
|
||||
/* USAGE_PAGE (Generic Desktop) */
|
||||
HID_GI_USAGE_PAGE,
|
||||
HID_USAGE_GD,
|
||||
@@ -141,28 +141,28 @@ static const u8_t zmk_hid_report_desc[] = {
|
||||
|
||||
// struct zmk_hid_boot_report
|
||||
// {
|
||||
// u8_t modifiers;
|
||||
// u8_t _unused;
|
||||
// u8_t keys[6];
|
||||
// uint8_t modifiers;
|
||||
// uint8_t _unused;
|
||||
// uint8_t keys[6];
|
||||
// } __packed;
|
||||
|
||||
struct zmk_hid_keyboard_report_body {
|
||||
zmk_mod_flags modifiers;
|
||||
u8_t _reserved;
|
||||
u8_t keys[ZMK_HID_KEYBOARD_NKRO_SIZE];
|
||||
uint8_t _reserved;
|
||||
uint8_t keys[ZMK_HID_KEYBOARD_NKRO_SIZE];
|
||||
} __packed;
|
||||
|
||||
struct zmk_hid_keyboard_report {
|
||||
u8_t report_id;
|
||||
uint8_t report_id;
|
||||
struct zmk_hid_keyboard_report_body body;
|
||||
} __packed;
|
||||
|
||||
struct zmk_hid_consumer_report_body {
|
||||
u16_t keys[ZMK_HID_CONSUMER_NKRO_SIZE];
|
||||
uint16_t keys[ZMK_HID_CONSUMER_NKRO_SIZE];
|
||||
} __packed;
|
||||
|
||||
struct zmk_hid_consumer_report {
|
||||
u8_t report_id;
|
||||
uint8_t report_id;
|
||||
struct zmk_hid_consumer_report_body body;
|
||||
} __packed;
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef u32_t zmk_keymap_layers_state;
|
||||
typedef uint32_t zmk_keymap_layers_state;
|
||||
|
||||
u8_t zmk_keymap_layer_default();
|
||||
uint8_t zmk_keymap_layer_default();
|
||||
zmk_keymap_layers_state zmk_keymap_layer_state();
|
||||
bool zmk_keymap_layer_active(u8_t layer);
|
||||
u8_t zmk_keymap_highest_layer_active();
|
||||
int zmk_keymap_layer_activate(u8_t layer);
|
||||
int zmk_keymap_layer_deactivate(u8_t layer);
|
||||
int zmk_keymap_layer_toggle(u8_t layer);
|
||||
bool zmk_keymap_layer_active(uint8_t layer);
|
||||
uint8_t zmk_keymap_highest_layer_active();
|
||||
int zmk_keymap_layer_activate(uint8_t layer);
|
||||
int zmk_keymap_layer_deactivate(uint8_t layer);
|
||||
int zmk_keymap_layer_toggle(uint8_t layer);
|
||||
|
||||
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);
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
#include <zephyr.h>
|
||||
#include <dt-bindings/zmk/keys.h>
|
||||
|
||||
typedef u32_t zmk_key;
|
||||
typedef u8_t zmk_action;
|
||||
typedef u8_t zmk_mod;
|
||||
typedef u8_t zmk_mod_flags;
|
||||
typedef uint32_t zmk_key;
|
||||
typedef uint8_t zmk_action;
|
||||
typedef uint8_t zmk_mod;
|
||||
typedef uint8_t zmk_mod_flags;
|
||||
|
||||
struct zmk_key_event {
|
||||
u32_t column;
|
||||
u32_t row;
|
||||
uint32_t column;
|
||||
uint32_t row;
|
||||
zmk_key key;
|
||||
bool pressed;
|
||||
};
|
||||
@@ -6,4 +6,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
u32_t zmk_matrix_transform_row_column_to_position(u32_t row, u32_t column);
|
||||
uint32_t zmk_matrix_transform_row_column_to_position(uint32_t row, uint32_t column);
|
||||
@@ -6,5 +6,5 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
int zmk_split_bt_position_pressed(u8_t position);
|
||||
int zmk_split_bt_position_released(u8_t position);
|
||||
int zmk_split_bt_position_pressed(uint8_t position);
|
||||
int zmk_split_bt_position_released(uint8_t position);
|
||||
@@ -25,5 +25,5 @@ static inline bool zmk_usb_is_powered() { return zmk_usb_get_conn_state() != ZMK
|
||||
static inline bool zmk_usb_is_hid_ready() { return zmk_usb_get_conn_state() == ZMK_USB_CONN_HID; }
|
||||
|
||||
#ifdef CONFIG_ZMK_USB
|
||||
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);
|
||||
#endif /* CONFIG_ZMK_USB */
|
||||
Reference in New Issue
Block a user