summaryrefslogtreecommitdiff
path: root/app/src/behaviors
diff options
context:
space:
mode:
authorinnovaker <66737976+innovaker@users.noreply.github.com>2020-12-10 19:31:51 +0000
committerPete Johanson <peter@peterjohanson.com>2020-12-14 12:41:25 -0500
commit00ca0d2f1cb0a939e5207454d89c6d37ef9f45a6 (patch)
treef5c8b1fa7bed4838393576376140e8420f2e415b /app/src/behaviors
parent1411092a7bb6e21e6e3a272737ad36d613e3b367 (diff)
refactor(app): replace `struct device *` with `const struct device *`
Replaced with RegExp: /(?<!const )(struct device \*)/g See: https://docs.zephyrproject.org/latest/releases/release-notes-2.4.html PR: #467
Diffstat (limited to 'app/src/behaviors')
-rw-r--r--app/src/behaviors/behavior_bt.c2
-rw-r--r--app/src/behaviors/behavior_ext_power.c4
-rw-r--r--app/src/behaviors/behavior_hold_tap.c4
-rw-r--r--app/src/behaviors/behavior_key_press.c2
-rw-r--r--app/src/behaviors/behavior_momentary_layer.c2
-rw-r--r--app/src/behaviors/behavior_none.c2
-rw-r--r--app/src/behaviors/behavior_outputs.c2
-rw-r--r--app/src/behaviors/behavior_reset.c4
-rw-r--r--app/src/behaviors/behavior_rgb_underglow.c2
-rw-r--r--app/src/behaviors/behavior_sensor_rotate_key_press.c6
-rw-r--r--app/src/behaviors/behavior_sticky_key.c4
-rw-r--r--app/src/behaviors/behavior_toggle_layer.c2
-rw-r--r--app/src/behaviors/behavior_transparent.c2
13 files changed, 19 insertions, 19 deletions
diff --git a/app/src/behaviors/behavior_bt.c b/app/src/behaviors/behavior_bt.c
index 066c437..bfafc4b 100644
--- a/app/src/behaviors/behavior_bt.c
+++ b/app/src/behaviors/behavior_bt.c
@@ -35,7 +35,7 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
return -ENOTSUP;
}
-static int behavior_bt_init(struct device *dev) { return 0; };
+static int behavior_bt_init(const struct device *dev) { return 0; };
static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
diff --git a/app/src/behaviors/behavior_ext_power.c b/app/src/behaviors/behavior_ext_power.c
index 825f983..dbc6fd9 100644
--- a/app/src/behaviors/behavior_ext_power.c
+++ b/app/src/behaviors/behavior_ext_power.c
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- struct device *ext_power = device_get_binding("EXT_POWER");
+ const struct device *ext_power = device_get_binding("EXT_POWER");
if (ext_power == NULL) {
LOG_ERR("Unable to retrieve ext_power device: %d", binding->param1);
return -EIO;
@@ -46,7 +46,7 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
return 0;
}
-static int behavior_ext_power_init(struct device *dev) { return 0; };
+static int behavior_ext_power_init(const struct device *dev) { return 0; };
static const struct behavior_driver_api behavior_ext_power_driver_api = {
.binding_pressed = on_keymap_binding_pressed,
diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c
index 44a5117..556273e 100644
--- a/app/src/behaviors/behavior_hold_tap.c
+++ b/app/src/behaviors/behavior_hold_tap.c
@@ -304,7 +304,7 @@ static void decide_hold_tap(struct active_hold_tap *hold_tap, enum decision_mome
static int on_hold_tap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- struct device *dev = device_get_binding(binding->behavior_dev);
+ const struct device *dev = device_get_binding(binding->behavior_dev);
const struct behavior_hold_tap_config *cfg = dev->config;
if (undecided_hold_tap != NULL) {
@@ -479,7 +479,7 @@ void behavior_hold_tap_timer_work_handler(struct k_work *item) {
}
}
-static int behavior_hold_tap_init(struct device *dev) {
+static int behavior_hold_tap_init(const struct device *dev) {
static bool init_first_run = true;
if (init_first_run) {
diff --git a/app/src/behaviors/behavior_key_press.c b/app/src/behaviors/behavior_key_press.c
index 8559a51..aa19ca9 100644
--- a/app/src/behaviors/behavior_key_press.c
+++ b/app/src/behaviors/behavior_key_press.c
@@ -16,7 +16,7 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
-static int behavior_key_press_init(struct device *dev) { return 0; };
+static int behavior_key_press_init(const struct device *dev) { return 0; };
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
diff --git a/app/src/behaviors/behavior_momentary_layer.c b/app/src/behaviors/behavior_momentary_layer.c
index b1fb14b..2b0206d 100644
--- a/app/src/behaviors/behavior_momentary_layer.c
+++ b/app/src/behaviors/behavior_momentary_layer.c
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_mo_config {};
struct behavior_mo_data {};
-static int behavior_mo_init(struct device *dev) { return 0; };
+static int behavior_mo_init(const struct device *dev) { return 0; };
static int mo_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
diff --git a/app/src/behaviors/behavior_none.c b/app/src/behaviors/behavior_none.c
index 96ea9d5..12542f0 100644
--- a/app/src/behaviors/behavior_none.c
+++ b/app/src/behaviors/behavior_none.c
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_none_config {};
struct behavior_none_data {};
-static int behavior_none_init(struct device *dev) { return 0; };
+static int behavior_none_init(const struct device *dev) { return 0; };
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
diff --git a/app/src/behaviors/behavior_outputs.c b/app/src/behaviors/behavior_outputs.c
index e5182bd..3a45b7f 100644
--- a/app/src/behaviors/behavior_outputs.c
+++ b/app/src/behaviors/behavior_outputs.c
@@ -34,7 +34,7 @@ static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
return -ENOTSUP;
}
-static int behavior_out_init(struct device *dev) { return 0; }
+static int behavior_out_init(const struct device *dev) { return 0; }
static const struct behavior_driver_api behavior_outputs_driver_api = {
.binding_pressed = on_keymap_binding_pressed,
diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c
index 97d0a1d..cb77a83 100644
--- a/app/src/behaviors/behavior_reset.c
+++ b/app/src/behaviors/behavior_reset.c
@@ -19,11 +19,11 @@ struct behavior_reset_config {
int type;
};
-static int behavior_reset_init(struct device *dev) { return 0; };
+static int behavior_reset_init(const struct device *dev) { return 0; };
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- struct device *dev = device_get_binding(binding->behavior_dev);
+ const struct device *dev = device_get_binding(binding->behavior_dev);
const struct behavior_reset_config *cfg = dev->config;
// TODO: Correct magic code for going into DFU?
diff --git a/app/src/behaviors/behavior_rgb_underglow.c b/app/src/behaviors/behavior_rgb_underglow.c
index 80839a7..a0db9a9 100644
--- a/app/src/behaviors/behavior_rgb_underglow.c
+++ b/app/src/behaviors/behavior_rgb_underglow.c
@@ -16,7 +16,7 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
-static int behavior_rgb_underglow_init(struct device *dev) { return 0; }
+static int behavior_rgb_underglow_init(const struct device *dev) { return 0; }
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
diff --git a/app/src/behaviors/behavior_sensor_rotate_key_press.c b/app/src/behaviors/behavior_sensor_rotate_key_press.c
index 85af24a..a0e0acc 100644
--- a/app/src/behaviors/behavior_sensor_rotate_key_press.c
+++ b/app/src/behaviors/behavior_sensor_rotate_key_press.c
@@ -16,10 +16,10 @@
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
-static int behavior_sensor_rotate_key_press_init(struct device *dev) { return 0; };
+static int behavior_sensor_rotate_key_press_init(const struct device *dev) { return 0; };
-static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding, struct device *sensor,
- int64_t timestamp) {
+static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding,
+ const struct device *sensor, int64_t timestamp) {
struct sensor_value value;
int err;
uint32_t keycode;
diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c
index 51c78ff..920f6f2 100644
--- a/app/src/behaviors/behavior_sticky_key.c
+++ b/app/src/behaviors/behavior_sticky_key.c
@@ -127,7 +127,7 @@ static int stop_timer(struct active_sticky_key *sticky_key) {
static int on_sticky_key_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
- struct device *dev = device_get_binding(binding->behavior_dev);
+ const struct device *dev = device_get_binding(binding->behavior_dev);
const struct behavior_sticky_key_config *cfg = dev->config;
struct active_sticky_key *sticky_key;
sticky_key = find_sticky_key(event.position);
@@ -242,7 +242,7 @@ void behavior_sticky_key_timer_handler(struct k_work *item) {
}
}
-static int behavior_sticky_key_init(struct device *dev) {
+static int behavior_sticky_key_init(const struct device *dev) {
static bool init_first_run = true;
if (init_first_run) {
for (int i = 0; i < ZMK_BHV_STICKY_KEY_MAX_HELD; i++) {
diff --git a/app/src/behaviors/behavior_toggle_layer.c b/app/src/behaviors/behavior_toggle_layer.c
index b3c6961..3283377 100644
--- a/app/src/behaviors/behavior_toggle_layer.c
+++ b/app/src/behaviors/behavior_toggle_layer.c
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_tog_config {};
struct behavior_tog_data {};
-static int behavior_tog_init(struct device *dev) { return 0; };
+static int behavior_tog_init(const struct device *dev) { return 0; };
static int tog_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {
diff --git a/app/src/behaviors/behavior_transparent.c b/app/src/behaviors/behavior_transparent.c
index cede369..17a5e43 100644
--- a/app/src/behaviors/behavior_transparent.c
+++ b/app/src/behaviors/behavior_transparent.c
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
struct behavior_transparent_config {};
struct behavior_transparent_data {};
-static int behavior_transparent_init(struct device *dev) { return 0; };
+static int behavior_transparent_init(const struct device *dev) { return 0; };
static int on_keymap_binding_pressed(struct zmk_behavior_binding *binding,
struct zmk_behavior_binding_event event) {