diff --git a/README.md b/README.md index 0546307..48b1085 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,23 @@ The procedure: * `Arduino MKR WiFi 1010`: short the pin 7 to GND until the led turns off * `Arduino GIGA R1 WiFi`: short the pin 7 to GND until the led turns off * `Arduino Nano RP2040 Connect`: short the pin 2 to 3.3V until the led turns off +* `Arduino Portenta H7`: short the pin 0 to GND until the led turns off +* `Arduino Portenta C33`: short the pin 0 to GND until the led turns off * Other boards: short the pin 2 to GND until the led turns off +* `Portenta Machine Control`: currently the reset procedure is not available + +### More on the reconfiguration pin +Internally, the pin indicated in the procedure is set as `INPUT_PULLUP` (except for `Arduino Opta` ) and it's attached to an ISR fired on every change of the pin's status. + +In order to be notified when the ISR is fired, it's possible to register a callback function using the function `NetworkConfigurator.addReconfigurePinCallback(callback)`. Please take the example as reference. + +### Change the reconfiguration pin +In order to change the default pin for resetting the board, it's possible to use the function `NetworkConfigurator.setReconfigurePin(your_pin)` specifying the new pin. +The pin must be in the list of digital pins usable for interrupts. Please refer to the Arduino documentation for more details: https://docs.arduino.cc/language-reference/en/functions/external-interrupts/attachInterrupt/ + +### Disable the reconfiguration feature +In order to disable the reconfiguration procedure, use this function in the sketch `NetworkConfigurator.setReconfigurePin(DISABLE_PIN)` + ## Configurator Agents The library provides a set of *Configurator Agents* that added as plug-in to the sketch handle the communication between the Arduino Network Configurator and an external client ([*Arduino IoT App*](https://cloud.arduino.cc/iot-remote-app/) and Arduino IoT Cloud) for configuring the board. diff --git a/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino b/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino index 1bb8e6c..bc03b42 100644 --- a/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino +++ b/examples/NetworkConfiguratorDemo/NetworkConfiguratorDemo.ino @@ -21,6 +21,9 @@ * - Arduino MKR WiFi 1010: short the pin 7 to GND until the led turns off * - Arduino GIGA R1 WiFi: short the pin 7 to GND until the led turns off * - Arduino Nano RP2040 Connect: short the pin 2 to 3.3V until the led turns off + * - Portenta H7: short the pin 0 to GND until the led turns off + * - Portenta C33: short the pin 0 to GND until the led turns off + * - Portenta Machine Control: the reset is not available * - Other boards: short the pin 2 to GND until the led turns off * * In this sketch the BLE and Serial interfaces are always enabled and ready for accepting diff --git a/extras/test/CMakeLists.txt b/extras/test/CMakeLists.txt index b4c0898..b3736e9 100644 --- a/extras/test/CMakeLists.txt +++ b/extras/test/CMakeLists.txt @@ -24,8 +24,8 @@ FetchContent_Declare( FetchContent_Declare( connectionhandler - GIT_REPOSITORY https://github.com/andreagilardoni/Arduino_ConnectionHandler.git - GIT_TAG connectionhandler-settings + GIT_REPOSITORY https://github.com/arduino-libraries/Arduino_ConnectionHandler.git + GIT_TAG master CONFIGURE_COMMAND "" BUILD_COMMAND "" ) diff --git a/library.properties b/library.properties index d960065..14cbfa0 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Arduino_NetworkConfigurator -version=0.1.4 +version=0.2.0 author=Arduino maintainer=Arduino sentence=This library allows to configure and update the network settings of a ConnectionHandler instance. diff --git a/src/ANetworkConfigurator_Config.h b/src/ANetworkConfigurator_Config.h index e1ca4cd..465659f 100644 --- a/src/ANetworkConfigurator_Config.h +++ b/src/ANetworkConfigurator_Config.h @@ -7,7 +7,7 @@ */ #pragma once -#define ANetworkConfigurator_LIB_VERSION "0.1.4" +#define ANetworkConfigurator_LIB_VERSION "0.2.0" #if defined(ARDUINO_SAMD_MKRWIFI1010) #define NETWORK_CONFIGURATOR_COMPATIBLE 1 @@ -57,7 +57,9 @@ #if defined(ARDUINO_PORTENTA_H7_M7) #define NETWORK_CONFIGURATOR_COMPATIBLE 1 #define ZERO_TOUCH_ENABLED 1 - #define PIN_RECONFIGURE 2 + #define I2C_ADD_DETECT_MACHINE_CONTROL_1 0x23 + #define I2C_ADD_DETECT_MACHINE_CONTROL_2 0x22 + #define PIN_RECONFIGURE 0 #define LED_RECONFIGURE LED_BUILTIN #define BOARD_HAS_RGB #define GREEN_LED LEDG @@ -108,7 +110,7 @@ #if defined(ARDUINO_PORTENTA_C33) #define NETWORK_CONFIGURATOR_COMPATIBLE 1 #define ZERO_TOUCH_ENABLED 1 - #define PIN_RECONFIGURE 2 + #define PIN_RECONFIGURE 0 #define LED_RECONFIGURE LEDG #define BOARD_HAS_RGB #define GREEN_LED LEDG diff --git a/src/Arduino_NetworkConfigurator.cpp b/src/Arduino_NetworkConfigurator.cpp index f448b1f..40c33c4 100644 --- a/src/Arduino_NetworkConfigurator.cpp +++ b/src/Arduino_NetworkConfigurator.cpp @@ -122,6 +122,9 @@ NetworkConfiguratorStates NetworkConfiguratorClass::update() { * - Arduino MKR WiFi 1010: short the pin 7 to GND until the led turns off * - Arduino GIGA R1 WiFi: short the pin 7 to GND until the led turns off * - Arduino Nano RP2040 Connect: short the pin 2 to 3.3V until the led turns off + * - Portenta H7: short the pin 0 to GND until the led turns off + * - Portenta C33: short the pin 0 to GND until the led turns off + * - Portenta Machine Control: the reset is not available * - Other boards: short the pin 2 to GND until the led turns off */ diff --git a/src/Arduino_NetworkConfigurator.h b/src/Arduino_NetworkConfigurator.h index d68bbdb..fafe125 100644 --- a/src/Arduino_NetworkConfigurator.h +++ b/src/Arduino_NetworkConfigurator.h @@ -58,6 +58,9 @@ enum class NetworkConfiguratorStates { ZERO_TOUCH_CONFIG, * - Arduino MKR WiFi 1010: short the pin 7 to GND until the led turns off * - Arduino GIGA R1 WiFi: short the pin 7 to GND until the led turns off * - Arduino Nano RP2040 Connect: short the pin 2 to 3.3V until the led turns off + * - Portenta H7: short the pin 0 to GND until the led turns off + * - Portenta C33: short the pin 0 to GND until the led turns off + * - Portenta Machine Control: the reset is not available * - Other boards: short the pin 2 to GND until the led turns off * */ diff --git a/src/utility/ResetInput.cpp b/src/utility/ResetInput.cpp index 0df5fc0..70d322e 100644 --- a/src/utility/ResetInput.cpp +++ b/src/utility/ResetInput.cpp @@ -11,6 +11,28 @@ #include "ResetInput.h" #include "utility/LEDFeedback.h" +#if defined(ARDUINO_PORTENTA_H7_M7) +#include + + +bool isPortentaMachineControlAttached() { + Wire.begin(); + Wire.beginTransmission(I2C_ADD_DETECT_MACHINE_CONTROL_1); + if (Wire.endTransmission() != 0) { + return false; + } + + Wire.beginTransmission(I2C_ADD_DETECT_MACHINE_CONTROL_2); + if (Wire.endTransmission() != 0) { + return false; + } + + Wire.end(); + return true; +} + +#endif + ResetInput &ResetInput::getInstance() { static ResetInput instance; return instance; @@ -25,6 +47,12 @@ ResetInput::ResetInput() { } void ResetInput::begin() { +#if defined(ARDUINO_PORTENTA_H7_M7) + if(isPortentaMachineControlAttached()) { + return; // Portenta Machine Control is not supported + } +#endif + if(_pin == DISABLE_PIN){ return; } @@ -35,7 +63,6 @@ void ResetInput::begin() { #endif pinMode(LED_RECONFIGURE, OUTPUT); digitalWrite(LED_RECONFIGURE, LED_OFF); - attachInterrupt(digitalPinToInterrupt(_pin),_pressedCallback, CHANGE); } 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