summaryrefslogtreecommitdiff
path: root/app/boards/arm
diff options
context:
space:
mode:
authorMega Mind <68985133+megamind4089@users.noreply.github.com>2020-10-06 15:52:21 +0800
committerMega Mind <68985133+megamind4089@users.noreply.github.com>2020-10-10 08:11:46 +0800
commit4d81b10ba7047a4dbd63cfe33ac879ecf437e108 (patch)
treece5a5dcded5c41f7dc8b2ed6d3ac0088bc843e6e /app/boards/arm
parente53320a687a8b402fac3ed972a776993495a2f9a (diff)
Added driver to control the external power output
This PR adds support to control the external power output from controllers like nice!nano, nRFMicro etc I have implemented based on my understanding of Pete suggestion on this feature. Testing done: Tested by enabling and disabling the ext_power from application and verified Verified the application does not crash with boards that does not have ext_power support Note: I did not test this in nice!nano since I don't have the boards. Will get help from others once the behavior PR is up Next Steps: Create a behavior PR to control enable/disable ext_power
Diffstat (limited to 'app/boards/arm')
-rw-r--r--app/boards/arm/nice_nano/nice_nano.dts5
-rw-r--r--app/boards/arm/nrfmicro/nrfmicro_11.dts5
-rw-r--r--app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts5
-rw-r--r--app/boards/arm/nrfmicro/nrfmicro_13.dts5
-rw-r--r--app/boards/arm/nrfmicro/pinmux.c11
5 files changed, 20 insertions, 11 deletions
diff --git a/app/boards/arm/nice_nano/nice_nano.dts b/app/boards/arm/nice_nano/nice_nano.dts
index 3ffb0ea..0538b1d 100644
--- a/app/boards/arm/nice_nano/nice_nano.dts
+++ b/app/boards/arm/nice_nano/nice_nano.dts
@@ -29,6 +29,11 @@
};
};
+ ext-power {
+ compatible = "zmk,ext-power-generic";
+ label = "EXT_POWER";
+ control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+ };
};
&gpiote {
diff --git a/app/boards/arm/nrfmicro/nrfmicro_11.dts b/app/boards/arm/nrfmicro/nrfmicro_11.dts
index 95bd8ad..87c650e 100644
--- a/app/boards/arm/nrfmicro/nrfmicro_11.dts
+++ b/app/boards/arm/nrfmicro/nrfmicro_11.dts
@@ -26,6 +26,11 @@
};
};
+ ext-power {
+ compatible = "zmk,ext-power-generic";
+ label = "EXT_POWER";
+ control-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+ };
};
&gpio0 {
diff --git a/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts b/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts
index 85693a8..ea15b81 100644
--- a/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts
+++ b/app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts
@@ -26,6 +26,11 @@
};
};
+ ext-power {
+ compatible = "zmk,ext-power-generic";
+ label = "EXT_POWER";
+ control-gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
+ };
};
&gpio0 {
diff --git a/app/boards/arm/nrfmicro/nrfmicro_13.dts b/app/boards/arm/nrfmicro/nrfmicro_13.dts
index 95bd8ad..ef43946 100644
--- a/app/boards/arm/nrfmicro/nrfmicro_13.dts
+++ b/app/boards/arm/nrfmicro/nrfmicro_13.dts
@@ -26,6 +26,11 @@
};
};
+ ext-power {
+ compatible = "zmk,ext-power-generic";
+ label = "EXT_POWER";
+ control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
+ };
};
&gpio0 {
diff --git a/app/boards/arm/nrfmicro/pinmux.c b/app/boards/arm/nrfmicro/pinmux.c
index 4e330b6..30117d0 100644
--- a/app/boards/arm/nrfmicro/pinmux.c
+++ b/app/boards/arm/nrfmicro/pinmux.c
@@ -14,25 +14,14 @@
static int pinmux_nrfmicro_init(struct device *port) {
ARG_UNUSED(port);
- struct device *p1 = device_get_binding("GPIO_1");
-
#if CONFIG_BOARD_NRFMICRO_13
struct device *p0 = device_get_binding("GPIO_0");
- // enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1)
- gpio_pin_configure(p1, 9, GPIO_OUTPUT);
- gpio_pin_set(p1, 9, 0);
-
#if CONFIG_BOARD_NRFMICRO_CHARGER
gpio_pin_configure(p0, 5, GPIO_OUTPUT);
gpio_pin_set(p0, 5, 0);
#else
gpio_pin_configure(p0, 5, GPIO_INPUT);
#endif
-
-#else
- // enable EXT_VCC (use 0 for nRFMicro 1.3, use 1 for nRFMicro 1.1)
- gpio_pin_configure(p1, 9, GPIO_OUTPUT);
- gpio_pin_set(p1, 9, 1);
#endif
return 0;
}