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:
@@ -17,8 +17,8 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
struct kscan_composite_child_config {
|
||||
char *label;
|
||||
u8_t row_offset;
|
||||
u8_t column_offset;
|
||||
uint8_t row_offset;
|
||||
uint8_t column_offset;
|
||||
};
|
||||
|
||||
#define CHILD_CONFIG(inst) \
|
||||
@@ -55,7 +55,7 @@ static int kscan_composite_disable_callback(struct device *dev) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void kscan_composite_child_callback(struct device *child_dev, u32_t row, u32_t column,
|
||||
static void kscan_composite_child_callback(struct device *child_dev, uint32_t row, uint32_t column,
|
||||
bool pressed) {
|
||||
// TODO: Ideally we can get this passed into our callback!
|
||||
struct device *dev = device_get_binding(DT_INST_LABEL(0));
|
||||
|
||||
@@ -105,8 +105,8 @@ struct kscan_gpio_item_config {
|
||||
static bool read_state[INST_MATRIX_INPUTS(n)][INST_MATRIX_OUTPUTS(n)]; \
|
||||
for (int o = 0; o < INST_MATRIX_OUTPUTS(n); o++) { \
|
||||
/* Iterate over bits and set GPIOs accordingly */ \
|
||||
for (u8_t bit = 0; bit < INST_DEMUX_GPIOS(n); bit++) { \
|
||||
u8_t state = (o & (0b1 << bit)) >> bit; \
|
||||
for (uint8_t bit = 0; bit < INST_DEMUX_GPIOS(n); bit++) { \
|
||||
uint8_t state = (o & (0b1 << bit)) >> bit; \
|
||||
struct device *out_dev = kscan_gpio_output_devices_##n(dev)[bit]; \
|
||||
const struct kscan_gpio_item_config *out_cfg = \
|
||||
&kscan_gpio_output_configs_##n(dev)[bit]; \
|
||||
|
||||
@@ -27,8 +27,8 @@ union work_reference {
|
||||
};
|
||||
|
||||
struct kscan_gpio_config {
|
||||
u8_t num_of_inputs;
|
||||
u8_t debounce_period;
|
||||
uint8_t num_of_inputs;
|
||||
uint8_t debounce_period;
|
||||
struct kscan_gpio_item_config inputs[];
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ struct kscan_gpio_data {
|
||||
kscan_callback_t callback;
|
||||
union work_reference work;
|
||||
struct device *dev;
|
||||
u32_t pin_state;
|
||||
uint32_t pin_state;
|
||||
struct device *inputs[];
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ static const struct kscan_gpio_item_config *kscan_gpio_input_configs(struct devi
|
||||
return cfg->inputs;
|
||||
}
|
||||
|
||||
static void kscan_gpio_direct_queue_read(union work_reference *work, u8_t debounce_period) {
|
||||
static void kscan_gpio_direct_queue_read(union work_reference *work, uint8_t debounce_period) {
|
||||
if (debounce_period > 0) {
|
||||
k_delayed_work_cancel(&work->delayed);
|
||||
k_delayed_work_submit(&work->delayed, K_MSEC(debounce_period));
|
||||
@@ -67,7 +67,7 @@ static void kscan_gpio_direct_queue_read(union work_reference *work, u8_t deboun
|
||||
struct kscan_gpio_irq_callback {
|
||||
struct device *dev;
|
||||
union work_reference *work;
|
||||
u8_t debounce_period;
|
||||
uint8_t debounce_period;
|
||||
struct gpio_callback callback;
|
||||
};
|
||||
|
||||
@@ -140,7 +140,7 @@ static int kscan_gpio_direct_configure(struct device *dev, kscan_callback_t call
|
||||
static int kscan_gpio_read(struct device *dev) {
|
||||
struct kscan_gpio_data *data = dev->driver_data;
|
||||
const struct kscan_gpio_config *cfg = dev->config_info;
|
||||
u32_t read_state = data->pin_state;
|
||||
uint32_t read_state = data->pin_state;
|
||||
bool submit_follow_up_read = false;
|
||||
for (int i = 0; i < cfg->num_of_inputs; i++) {
|
||||
struct device *in_dev = kscan_gpio_input_devices(dev)[i];
|
||||
|
||||
@@ -123,8 +123,8 @@ static int kscan_gpio_config_interrupts(struct device **devices,
|
||||
} \
|
||||
} \
|
||||
static void kscan_gpio_set_matrix_state_##n( \
|
||||
bool state[INST_MATRIX_ROWS(n)][INST_MATRIX_COLS(n)], u32_t input_index, \
|
||||
u32_t output_index, bool value) { \
|
||||
bool state[INST_MATRIX_ROWS(n)][INST_MATRIX_COLS(n)], uint32_t input_index, \
|
||||
uint32_t output_index, bool value) { \
|
||||
state[COND_CODE_0(DT_ENUM_IDX(DT_DRV_INST(n), diode_direction), (output_index), \
|
||||
(input_index))] \
|
||||
[COND_CODE_0(DT_ENUM_IDX(DT_DRV_INST(n), diode_direction), (input_index), \
|
||||
|
||||
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
struct kscan_mock_data {
|
||||
kscan_callback_t callback;
|
||||
|
||||
u32_t event_index;
|
||||
uint32_t event_index;
|
||||
struct k_delayed_work work;
|
||||
struct device *dev;
|
||||
};
|
||||
@@ -45,14 +45,14 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback) {
|
||||
|
||||
#define MOCK_INST_INIT(n) \
|
||||
struct kscan_mock_config_##n { \
|
||||
u32_t events[DT_INST_PROP_LEN(n, events)]; \
|
||||
uint32_t events[DT_INST_PROP_LEN(n, events)]; \
|
||||
bool exit_after; \
|
||||
}; \
|
||||
static void kscan_mock_schedule_next_event_##n(struct device *dev) { \
|
||||
struct kscan_mock_data *data = dev->driver_data; \
|
||||
const struct kscan_mock_config_##n *cfg = dev->config_info; \
|
||||
if (data->event_index < DT_INST_PROP_LEN(n, events)) { \
|
||||
u32_t ev = cfg->events[data->event_index]; \
|
||||
uint32_t ev = cfg->events[data->event_index]; \
|
||||
LOG_DBG("delaying next keypress: %d", ZMK_MOCK_MSEC(ev)); \
|
||||
k_delayed_work_submit(&data->work, K_MSEC(ZMK_MOCK_MSEC(ev))); \
|
||||
} else if (cfg->exit_after) { \
|
||||
@@ -63,7 +63,7 @@ static int kscan_mock_configure(struct device *dev, kscan_callback_t callback) {
|
||||
static void kscan_mock_work_handler_##n(struct k_work *work) { \
|
||||
struct kscan_mock_data *data = CONTAINER_OF(work, struct kscan_mock_data, work); \
|
||||
const struct kscan_mock_config_##n *cfg = data->dev->config_info; \
|
||||
u32_t ev = cfg->events[data->event_index]; \
|
||||
uint32_t ev = cfg->events[data->event_index]; \
|
||||
LOG_DBG("ev %u row %d column %d state %d\n", ev, ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), \
|
||||
ZMK_MOCK_IS_PRESS(ev)); \
|
||||
data->callback(data->dev, ZMK_MOCK_ROW(ev), ZMK_MOCK_COL(ev), ZMK_MOCK_IS_PRESS(ev)); \
|
||||
|
||||
@@ -29,8 +29,8 @@ static int ec11_get_ab_state(struct device *dev) {
|
||||
static int ec11_sample_fetch(struct device *dev, enum sensor_channel chan) {
|
||||
struct ec11_data *drv_data = dev->driver_data;
|
||||
const struct ec11_config *drv_cfg = dev->config_info;
|
||||
u8_t val;
|
||||
s8_t delta;
|
||||
uint8_t val;
|
||||
int8_t delta;
|
||||
|
||||
__ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL || chan == SENSOR_CHAN_ROTATION);
|
||||
|
||||
|
||||
@@ -12,23 +12,23 @@
|
||||
|
||||
struct ec11_config {
|
||||
const char *a_label;
|
||||
const u8_t a_pin;
|
||||
const u8_t a_flags;
|
||||
const uint8_t a_pin;
|
||||
const uint8_t a_flags;
|
||||
|
||||
const char *b_label;
|
||||
const u8_t b_pin;
|
||||
const u8_t b_flags;
|
||||
const uint8_t b_pin;
|
||||
const uint8_t b_flags;
|
||||
|
||||
const u8_t resolution;
|
||||
const uint8_t resolution;
|
||||
};
|
||||
|
||||
struct ec11_data {
|
||||
struct device *a;
|
||||
struct device *b;
|
||||
u8_t ab_state;
|
||||
s8_t pulses;
|
||||
s8_t ticks;
|
||||
s8_t delta;
|
||||
uint8_t ab_state;
|
||||
int8_t pulses;
|
||||
int8_t ticks;
|
||||
int8_t delta;
|
||||
|
||||
#ifdef CONFIG_EC11_TRIGGER
|
||||
struct gpio_callback a_gpio_cb;
|
||||
|
||||
@@ -36,7 +36,7 @@ static inline void setup_int(struct device *dev, bool enable) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ec11_a_gpio_callback(struct device *dev, struct gpio_callback *cb, u32_t pins) {
|
||||
static void ec11_a_gpio_callback(struct device *dev, struct gpio_callback *cb, uint32_t pins) {
|
||||
struct ec11_data *drv_data = CONTAINER_OF(cb, struct ec11_data, a_gpio_cb);
|
||||
|
||||
LOG_DBG("");
|
||||
@@ -50,7 +50,7 @@ static void ec11_a_gpio_callback(struct device *dev, struct gpio_callback *cb, u
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ec11_b_gpio_callback(struct device *dev, struct gpio_callback *cb, u32_t pins) {
|
||||
static void ec11_b_gpio_callback(struct device *dev, struct gpio_callback *cb, uint32_t pins) {
|
||||
struct ec11_data *drv_data = CONTAINER_OF(cb, struct ec11_data, b_gpio_cb);
|
||||
|
||||
LOG_DBG("");
|
||||
|
||||
Reference in New Issue
Block a user