Skip to content

Nano 33 BLE - enable the SPI1 sensors #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cores/arduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@
void start_static_threads();
#endif


// This function will be overwriten by most variants.
void __attribute__((weak))initVariant(void) {

}


int main(void) {
#if (DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm) && CONFIG_USB_CDC_ACM)
Serial.begin(115200);
#endif

initVariant();

#ifdef CONFIG_MULTITHREADING
start_static_threads();
#endif
Expand Down
2 changes: 2 additions & 0 deletions loader/boards/arduino_nano_33_ble_sense.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

/ {
zephyr,user {
pin-enable-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;

digital-pin-gpios = <&arduino_nano_header 0 0>,
<&arduino_nano_header 1 0>,
<&arduino_nano_header 2 0>,
Expand Down
19 changes: 18 additions & 1 deletion variants/arduino_nano_33_ble_sense/variant.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
#include "Arduino.h"
#include <hal/nrf_power.h>
#include <zephyr/dt-bindings/gpio/nordic-nrf-gpio.h>

void _on_1200_bps() {
nrf_power_gpregret_set(NRF_POWER, 0, 0xb0);
NVIC_SystemReset();
}
}

void initVariant(void) {
static const struct gpio_dt_spec enable_sensors =
GPIO_DT_SPEC_GET(DT_PATH(zephyr_user), pin_enable_gpios);
if (gpio_is_ready_dt(&enable_sensors)) {
gpio_flags_t flags = enable_sensors.dt_flags | GPIO_OUTPUT_HIGH | GPIO_ACTIVE_HIGH | NRF_GPIO_DRIVE_H0H1;
Serial.println((uint32_t)flags, HEX);

gpio_pin_configure(enable_sensors.port, enable_sensors.pin, flags);
gpio_pin_set(enable_sensors.port, enable_sensors.pin, HIGH);
//Serial.println("### Sensor pin enabled ###");

delay(500);
}
}
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy