File tree 3 files changed +29
-1
lines changed
variants/arduino_nano_33_ble_sense
3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 13
13
void start_static_threads ();
14
14
#endif
15
15
16
+
17
+ // This function will be overwriten by most variants.
18
+ void __attribute__ ((weak))initVariant(void ) {
19
+
20
+ }
21
+
22
+
16
23
int main (void ) {
17
24
#if (DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm) && CONFIG_USB_CDC_ACM)
18
25
Serial.begin (115200 );
19
26
#endif
20
27
28
+ initVariant ();
29
+
21
30
#ifdef CONFIG_MULTITHREADING
22
31
start_static_threads ();
23
32
#endif
Original file line number Diff line number Diff line change 45
45
46
46
/ {
47
47
zephyr,user {
48
+ pin-enable-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
49
+
48
50
digital-pin-gpios = <&arduino_nano_header 0 0>,
49
51
<&arduino_nano_header 1 0>,
50
52
<&arduino_nano_header 2 0>,
Original file line number Diff line number Diff line change
1
+ #include " Arduino.h"
1
2
#include < hal/nrf_power.h>
3
+ #include < zephyr/dt-bindings/gpio/nordic-nrf-gpio.h>
2
4
3
5
void _on_1200_bps () {
4
6
nrf_power_gpregret_set (NRF_POWER, 0 , 0xb0 );
5
7
NVIC_SystemReset ();
6
- }
8
+ }
9
+
10
+ void initVariant (void ) {
11
+ static const struct gpio_dt_spec enable_sensors =
12
+ GPIO_DT_SPEC_GET (DT_PATH (zephyr_user), pin_enable_gpios);
13
+ if (gpio_is_ready_dt (&enable_sensors)) {
14
+ gpio_flags_t flags = enable_sensors.dt_flags | GPIO_OUTPUT_HIGH | GPIO_ACTIVE_HIGH | NRF_GPIO_DRIVE_H0H1;
15
+ Serial.println ((uint32_t )flags, HEX);
16
+
17
+ gpio_pin_configure (enable_sensors.port , enable_sensors.pin , flags);
18
+ gpio_pin_set (enable_sensors.port , enable_sensors.pin , HIGH);
19
+ // Serial.println("### Sensor pin enabled ###");
20
+
21
+ delay (500 );
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments