Skip to content

Commit

Permalink
Merge pull request #91 from jakkra/Feature_Rework_Input_Subsystem
Browse files Browse the repository at this point in the history
Feature rework input subsystem
  • Loading branch information
jakkra authored Oct 17, 2023
2 parents 835ae45 + c44327d commit f23a4b3
Show file tree
Hide file tree
Showing 90 changed files with 11,742 additions and 1,104 deletions.
43 changes: 22 additions & 21 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,40 @@ add_subdirectory(src/applications)
add_subdirectory(src/ext_drivers/bmi270)
add_subdirectory(src/ext_drivers/bmp581)


include_directories(src/)
include_directories(src/ui)
include_directories(src/applications)

target_sources(app PRIVATE src/battery.c)
target_sources(app PRIVATE src/ble_aoa.c)
target_sources(app PRIVATE src/ble_comm.c)
target_sources(app PRIVATE src/ble_transport.c)
target_sources(app PRIVATE src/buttons.c)
target_sources(app PRIVATE src/display_control.c)
target_sources(app PRIVATE src/gpio_debug.c)
target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/notification_manager.c)
target_sources(app PRIVATE src/ram_retention_storage.c)
target_sources(app PRIVATE src/watchface_app.c)
target_sources(app PRIVATE src/zsw_vibration_motor.c)
target_sources(app PRIVATE src/zsw_battery_manager.c)
target_sources(app PRIVATE src/zsw_clock.c)
target_sources(app PRIVATE src/zsw_charger.c)
target_sources(app PRIVATE src/zsw_cpu_freq.c)
target_sources(app PRIVATE src/zsw_env_sensor.c)
target_sources(app PRIVATE src/zsw_light_sensor.c)
target_sources(app PRIVATE src/zsw_gatt_sensor_server.c)
target_sources(app PRIVATE src/zsw_imu.c)
target_sources(app PRIVATE src/zsw_magnetometer.c)
target_sources(app PRIVATE src/zsw_periodic_event.c)
target_sources(app PRIVATE src/zsw_phone_app_publisher.c)
target_sources(app PRIVATE src/zsw_power_manager.c)
target_sources(app PRIVATE src/zsw_pressure_sensor.c)

target_sources(app PRIVATE src/manager/application_manager.c)
target_sources(app PRIVATE src/manager/notification_manager.c)
target_sources(app PRIVATE src/manager/zsw_battery_manager.c)
target_sources(app PRIVATE src/manager/zsw_power_manager.c)

target_sources(app PRIVATE src/battery/battery.c)
target_sources(app PRIVATE src/battery/zsw_charger.c)

target_sources(app PRIVATE src/ble/ble_aoa.c)
target_sources(app PRIVATE src/ble/ble_comm.c)
target_sources(app PRIVATE src/ble/ble_transport.c)

target_sources(app PRIVATE src/sensors/zsw_imu.c)
target_sources(app PRIVATE src/sensors/zsw_pressure_sensor.c)
target_sources(app PRIVATE src/sensors/zsw_magnetometer.c)
target_sources(app PRIVATE src/sensors/zsw_env_sensor.c)
target_sources(app PRIVATE src/sensors/zsw_light_sensor.c)

target_sources(app PRIVATE src/ui/notification/zsw_popup_notifcation.c)
target_sources(app PRIVATE src/ui/popup/zsw_popup_window.c)
target_sources(app PRIVATE src/ui/utils/zsw_ui_utils.c)

target_sources(app PRIVATE src/zsw_flash.c)

Expand All @@ -65,9 +69,6 @@ target_sources(app PRIVATE ${img_sources})
FILE(GLOB font_sources src/images/fonts/*.c)
target_sources(app PRIVATE ${font_sources})

FILE(GLOB ui_sources src/ui/*.c)
target_sources(app PRIVATE ${ui_sources})

zephyr_sources_ifdef(CONFIG_WATCHFACE_ANALOG src/ui/watchfaces/zsw_watchface_analog_ui.c)
zephyr_sources_ifdef(CONFIG_WATCHFACE_DIGITAL src/ui/watchfaces/zsw_watchface_digital_ui.c)
zephyr_sources_ifdef(CONFIG_WATCHFACE_MINIMAL src/ui/watchfaces/zsw_watchface_minimal_ui.c)
Expand Down
14 changes: 7 additions & 7 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_common.dts
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@
aliases {
display-blk = &display_blk;
vibrator-pwm = &vibrator_pwm;
sw0 = &button0;
sw1 = &button1;
sw2 = &button2;
sw3 = &button3;
sw-top-right = &button0;
sw-top-left = &button3;
sw-bottom-right = &button2;
sw-bottom-left = &button1;
sw4 = &button4;
sw-top-right = &button1;
sw-top-left = &button4;
sw-bottom-right = &button3;
sw-bottom-left = &button2;
magn = &lis2mdl;
watchdog0 = &wdt0;
accel = &bmi270;
mcuboot-button0 = &button1;
mcuboot-button1 = &button1;
};
};

Expand Down Expand Up @@ -86,7 +86,7 @@

&gpio0 {
status = "okay";
sense-edge-mask = < 0xffffffff >;
sense-edge-mask = <0xffffffff>;
};

&gpio1 {
Expand Down
32 changes: 23 additions & 9 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_1.overlay
Original file line number Diff line number Diff line change
@@ -1,29 +1,43 @@
/ {

longpress: longpress {
input = <&buttons>;
compatible = "zephyr,input-longpress";
input-codes = <INPUT_KEY_KP0>;
short-codes = <INPUT_KEY_4>;
long-codes = <INPUT_KEY_Y>;
long-delay-ms = <1000>;
};

buttons: buttons {
compatible = "gpio-keys";
button0: button_0 {
button1: button_1 {
label = "top-right";
gpios = <&gpio0 27 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_1>;
};
button1: button_1 {
button2: button_2 {
label = "bottom-left";
gpios = <&gpio0 31 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_2>;
};
button2: button_2 {
button3: button_3 {
label = "bottom-right";
gpios = <&gpio1 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_3>;
};
button3: button_3 {
button4: button_4 {
label = "top-left";
gpios = <&gpio1 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_KP0>;
};
};

charger {
compatible = "gpio-keys";
charging_status: charging_status {
gpios = <&gpio0 30 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_POWER>;
};
};

Expand Down
31 changes: 22 additions & 9 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_2.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,44 @@
nordic,pm-ext-flash = &at25sl128a;
};

longpress: longpress {
input = <&buttons>;
compatible = "zephyr,input-longpress";
input-codes = <INPUT_KEY_KP0>;
short-codes = <INPUT_KEY_4>;
long-codes = <INPUT_KEY_Y>;
long-delay-ms = <1000>;
};

buttons: buttons {
compatible = "gpio-keys";
button0: button_0 {
button1: button_1 {
label = "top-right";
gpios = <&gpio0 27 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_1>;
};
button1: button_1 {
button2: button_2 {
label = "bottom-left";
gpios = <&gpio0 31 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_2>;
};
button2: button_2 {
button3: button_3 {
label = "bottom-right";
gpios = <&gpio1 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_3>;
};
button3: button_3 {
button4: button_4 {
label = "top-left";
gpios = <&gpio1 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_KP0>;
};
};

charger {
compatible = "gpio-keys";
charging_status: charging_status {
gpios = <&gpio0 30 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_POWER>;
};
};

Expand Down
33 changes: 22 additions & 11 deletions app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpuapp_3.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
};

/ {

chosen {
nordic,pm-ext-flash = &at25sl128a;
};
Expand All @@ -28,31 +27,44 @@
spi-flash0 = &at25sl128a;
};

longpress: longpress {
input = <&buttons>;
compatible = "zephyr,input-longpress";
input-codes = <INPUT_KEY_KP0>;
short-codes = <INPUT_KEY_4>;
long-codes = <INPUT_KEY_Y>;
long-delay-ms = <1000>;
};

buttons: buttons {
compatible = "gpio-keys";
button0: button_0 {
button1: button_1 {
label = "top-right";
gpios = <&gpio0 27 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_1>;
};
button1: button_1 {
button2: button_2 {
label = "bottom-left";
gpios = <&gpio0 30 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_2>;
};
button2: button_2 {
button3: button_3 {
label = "bottom-right";
gpios = <&gpio1 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_3>;
};
button3: button_3 {
button4: button_4 {
label = "top-left";
gpios = <&gpio1 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_KP0>;
};
};

charger {
compatible = "gpio-keys";
charging_status: charging_status {
gpios = <&gpio1 13 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
zephyr,code = <INPUT_KEY_ENTER>;
zephyr,code = <INPUT_KEY_POWER>;
};
};

Expand Down Expand Up @@ -109,7 +121,6 @@

};


&spi3 {
status = "okay";
compatible = "nordic,nrf-spim";
Expand Down
1 change: 0 additions & 1 deletion app/boards/arm/zswatch_nrf5340/zswatch_nrf5340_cpunet.dts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
};

&flash1 {

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
Expand Down
2 changes: 2 additions & 0 deletions app/boards/debug.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE=128
CONFIG_LOG_BLOCK_IN_THREAD=y
# End of SEGGER RTT

CONFIG_INPUT=y
3 changes: 3 additions & 0 deletions app/boards/native_posix.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CONFIG_GPIO=n
CONFIG_INPUT=y
CONFIG_INPUT_LONGPRESS=n
CONFIG_INPUT_SDL_TOUCH=y
CONFIG_FLASH_SIMULATOR=y

Expand All @@ -11,8 +12,10 @@ CONFIG_BMI270=n
CONFIG_LIS2MDL=n
CONFIG_LIS2MDL_MAG_ODR_RUNTIME=n
CONFIG_BME680=n
CONFIG_MAX30101=n
CONFIG_APDS9306=n
CONFIG_APDS9306_IS_APDS9306_065=n
CONFIG_MAX30101_MULTI_LED_MODE=n
CONFIG_PINCTRL=n

CONFIG_SPI=n
Expand Down
8 changes: 4 additions & 4 deletions app/boards/nrf5340dk_nrf5340_cpuapp.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
zephyr,keyboard-scan = &cst816s;
};
aliases {
sw-top-right = &button1;
sw-top-left = &button0;
sw-bottom-right = &button3;
sw-bottom-left = &button2;
sw-top-right = &button2;
sw-top-left = &button1;
sw-bottom-right = &button4;
sw-bottom-left = &button3;
magn = &lis2mdl;
accel = &bmi270;
input = &cst816s;
Expand Down
Loading

0 comments on commit f23a4b3

Please sign in to comment.