@@ -58,7 +58,7 @@ Board::~Board() {
58
58
}
59
59
60
60
bool Board::begin () {
61
- #if defined(ARDUINO_PORTENTA_H7_M7)
61
+ #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_NICLA_VISION)
62
62
if (CM7_CPUID == HAL_GetCurrentCPUID ()){
63
63
if (LowPowerReturnCode::success != LowPower.checkOptionBytes ()){
64
64
LowPower.prepareOptionBytes ();
@@ -146,7 +146,7 @@ bool Board::enableWakeupFromRTC(uint32_t hours, uint32_t minutes, uint32_t secon
146
146
147
147
#endif
148
148
149
- #if defined(ARDUINO_PORTENTA_H7)
149
+ #if defined(ARDUINO_PORTENTA_H7) || defined(ARDUINO_NICLA_VISION)
150
150
bool Board::enableWakeupFromRTC (uint32_t hours, uint32_t minutes, uint32_t seconds){
151
151
standbyType |= StandbyType::untilTimeElapsed;
152
152
wakeupDelayHours = hours;
@@ -165,16 +165,19 @@ void Board::sleepUntilWakeupEvent(){
165
165
void Board::standByUntilWakeupEvent (){
166
166
#if defined(ARDUINO_PORTENTA_C33)
167
167
lowPower -> deepSleep ();
168
- #elif defined(ARDUINO_GENERIC_STM32H747_M4 )
168
+ #elif defined(CORE_CM4 )
169
169
LowPower.standbyM4 ();
170
- #elif defined(ARDUINO_PORTENTA_H7_M7)
170
+ #elif defined(ARDUINO_PORTENTA_H7_M7)
171
171
RTCWakeupDelay rtcWakeupDelay = RTCWakeupDelay (wakeupDelayHours, wakeupDelayMinutes, wakeupDelaySeconds);
172
172
if (standbyType == StandbyType::untilEither)
173
173
LowPower.standbyM7 (LowPowerStandbyType::untilPinActivity | LowPowerStandbyType::untilTimeElapsed, rtcWakeupDelay);
174
174
else if (standbyType == StandbyType::untilPinActivity)
175
175
LowPower.standbyM7 (LowPowerStandbyType::untilPinActivity);
176
176
else if (standbyType == StandbyType::untilTimeElapsed)
177
177
LowPower.standbyM7 (LowPowerStandbyType::untilTimeElapsed, rtcWakeupDelay);
178
+ #elif defined(ARDUINO_NICLA_VISION) && defined(CORE_CM7)
179
+ RTCWakeupDelay rtcWakeupDelay = RTCWakeupDelay (wakeupDelayHours, wakeupDelayMinutes, wakeupDelaySeconds);
180
+ LowPower.standbyM7 (rtcWakeupDelay);
178
181
#endif
179
182
}
180
183
@@ -185,7 +188,7 @@ void Board::setAllPeripheralsPower(bool on){
185
188
this -> setCommunicationPeripheralsPower (on);
186
189
this -> setExternalPowerEnabled (on);
187
190
this -> setAnalogDigitalConverterPower (on);
188
- #else if defined(ARDUINO_PORTENTA_H7)
191
+ #elif defined(ARDUINO_PORTENTA_H7)
189
192
// On the H7 several chips need different voltages, so we cannot turn the lanes that are dependent on each other separately.
190
193
// This should only be used when going into standby mode, as turning off the USB-C PHY, Ethernet or Video bridge might cause undefined behaviour.
191
194
if (on){
@@ -199,6 +202,23 @@ void Board::setAllPeripheralsPower(bool on){
199
202
PMIC.getControl () -> turnLDO3Off (Ldo3Mode::Normal);
200
203
PMIC.getControl () -> turnSw1Off (Sw1Mode::Normal);
201
204
}
205
+
206
+ #elif defined(ARDUINO_NICLA_VISION)
207
+ if (on){
208
+ PMIC.getControl () -> turnLDO2On (Ldo2Mode::Normal); // Camera
209
+ PMIC.getControl () -> turnLDO1On (Ldo1Mode::Normal); // ToF sensor / Camera
210
+ PMIC.getControl () -> turnLDO3On (Ldo3Mode::Normal); // VDDA - Analog components, e.g. ADC
211
+ PMIC.getControl () -> turnSw2On (Sw2Mode::Normal); // USB, 25 MHz crystal, 32 kHz crystal
212
+ // TODO: Not supported yet by PMIC library
213
+ // PMIC.getControl() -> turnSw3On(Sw3Mode::Normal); // External power VDDIO_EXT
214
+ } else {
215
+ PMIC.getControl () -> turnLDO2Off (Ldo2Mode::Normal); // Camera
216
+ PMIC.getControl () -> turnLDO1Off (Ldo1Mode::Normal); // ToF sensor / Camera
217
+ PMIC.getControl () -> turnLDO3Off (Ldo3Mode::Normal); // VDDA - Analog components, e.g. ADC
218
+ PMIC.getControl () -> turnSw2Off (Sw2Mode::Normal); // USB, 25 MHz crystal, 32 kHz crystal
219
+ // TODO: Not supported yet by PMIC library
220
+ // PMIC.getControl() -> turnSw3Off(Sw3Mode::Normal); // External power VDDIO_EXT
221
+ }
202
222
#endif
203
223
}
204
224
//
@@ -270,7 +290,7 @@ bool Board::setReferenceVoltage(float voltage) {
270
290
void Board::shutDownFuelGauge () {
271
291
#if defined(ARDUINO_PORTENTA_C33)
272
292
MAX1726Driver fuelGauge (&Wire3);
273
- #elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_GENERIC_STM32H747_M4 )
293
+ #elif defined(ARDUINO_PORTENTA_H7 )
274
294
MAX1726Driver fuelGauge (&Wire1);
275
295
#elif defined(ARDUINO_NICLA_VISION)
276
296
MAX1726Driver fuelGauge (&Wire1);
0 commit comments