diff options
author | Nick <nick.win999@gmail.com> | 2020-09-19 19:15:05 -0500 |
---|---|---|
committer | Nick <nick.win999@gmail.com> | 2020-09-19 19:15:05 -0500 |
commit | da0fb965f6b6a67154e20a3fddda48f5bc392d77 (patch) | |
tree | f7f9aa9a45b39bb4d943eb7d2ba6e71d516ab40c /app/src/behaviors/behavior_reset.c | |
parent | 844f2c76749cbc5ff611d8e69819af82b698089a (diff) | |
parent | c0806d27f1d048db335ecc854eab61b59e23ea7a (diff) |
Merge remote-tracking branch 'upstream/main' into bluetooth/battery-reporting
Diffstat (limited to 'app/src/behaviors/behavior_reset.c')
-rw-r--r-- | app/src/behaviors/behavior_reset.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/app/src/behaviors/behavior_reset.c b/app/src/behaviors/behavior_reset.c index 30a96ea..90de20b 100644 --- a/app/src/behaviors/behavior_reset.c +++ b/app/src/behaviors/behavior_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Peter Johanson <peter@peterjohanson.com> + * Copyright (c) 2020 The ZMK Contributors * * SPDX-License-Identifier: MIT */ @@ -14,37 +14,31 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); struct behavior_reset_config { - int type; + int type; }; -static int behavior_reset_init(struct device *dev) -{ - return 0; -}; +static int behavior_reset_init(struct device *dev) { return 0; }; -static int on_keymap_binding_pressed(struct device *dev, u32_t position, u32_t _param1, u32_t _param2) -{ - const struct behavior_reset_config *cfg = dev->config_info; +static int on_keymap_binding_pressed(struct device *dev, u32_t position, u32_t _param1, + u32_t _param2) { + const struct behavior_reset_config *cfg = dev->config_info; - // TODO: Correct magic code for going into DFU? - // See https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107 - sys_reboot(cfg->type); - return 0; + // TODO: Correct magic code for going into DFU? + // See + // https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/d6b28e66053eea467166f44875e3c7ec741cb471/src/main.c#L107 + sys_reboot(cfg->type); + return 0; } static const struct behavior_driver_api behavior_reset_driver_api = { - .binding_pressed = on_keymap_binding_pressed, + .binding_pressed = on_keymap_binding_pressed, }; +#define RST_INST(n) \ + static const struct behavior_reset_config behavior_reset_config_##n = { \ + .type = DT_INST_PROP(n, type)}; \ + DEVICE_AND_API_INIT(behavior_reset_##n, DT_INST_LABEL(n), behavior_reset_init, NULL, \ + &behavior_reset_config_##n, APPLICATION, \ + CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, &behavior_reset_driver_api); -#define RST_INST(n) \ - static const struct behavior_reset_config behavior_reset_config_##n = { \ - .type = DT_INST_PROP(n, type) \ - }; \ - DEVICE_AND_API_INIT(behavior_reset_##n, DT_INST_LABEL(n), behavior_reset_init, \ - NULL, \ - &behavior_reset_config_##n, \ - APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ - &behavior_reset_driver_api); - DT_INST_FOREACH_STATUS_OKAY(RST_INST)
\ No newline at end of file |