Skip to content

Commit 1236b8b

Browse files
authored
Enabled Deep sleep for Esp32_H2 (#2981)
1 parent 9252f96 commit 1236b8b

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native.h

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,27 @@ typedef enum __nfpack Sleep_WakeupGpioPin
6868
{
6969
Sleep_WakeupGpioPin_None = 0,
7070
Sleep_WakeupGpioPin_Pin0 = 1,
71+
Sleep_WakeupGpioPin_Pin1 = 2,
7172
Sleep_WakeupGpioPin_Pin2 = 4,
73+
Sleep_WakeupGpioPin_Pin3 = 8,
7274
Sleep_WakeupGpioPin_Pin4 = 16,
75+
Sleep_WakeupGpioPin_Pin5 = 32,
76+
Sleep_WakeupGpioPin_Pin6 = 64,
77+
Sleep_WakeupGpioPin_Pin7 = 128,
78+
Sleep_WakeupGpioPin_Pin8 = 256,
79+
Sleep_WakeupGpioPin_Pin9 = 512,
80+
Sleep_WakeupGpioPin_Pin10 = 1024,
81+
Sleep_WakeupGpioPin_Pin11 = 2048,
7382
Sleep_WakeupGpioPin_Pin12 = 4096,
7483
Sleep_WakeupGpioPin_Pin13 = 8192,
7584
Sleep_WakeupGpioPin_Pin14 = 16384,
7685
Sleep_WakeupGpioPin_Pin15 = 32768,
86+
Sleep_WakeupGpioPin_Pin16 = 65536,
87+
Sleep_WakeupGpioPin_Pin17 = 131072,
88+
Sleep_WakeupGpioPin_Pin18 = 262144,
89+
Sleep_WakeupGpioPin_Pin19 = 524288,
90+
Sleep_WakeupGpioPin_Pin20 = 1048576,
91+
Sleep_WakeupGpioPin_Pin21 = 2097152,
7792
Sleep_WakeupGpioPin_Pin25 = 33554432,
7893
Sleep_WakeupGpioPin_Pin26 = 67108864,
7994
Sleep_WakeupGpioPin_Pin27 = 134217728,
@@ -226,12 +241,12 @@ typedef enum __nfpack ValueTypes
226241
ValueTypes_DeviceType = 65536,
227242
} ValueTypes;
228243

229-
typedef enum __nfpack GpioChangePolarity
244+
typedef enum __nfpack GpioPulsePolarity
230245
{
231-
GpioChangePolarity_Both = 0,
232-
GpioChangePolarity_Falling = 1,
233-
GpioChangePolarity_Rising = 2,
234-
} GpioChangePolarity;
246+
GpioPulsePolarity_Both = 0,
247+
GpioPulsePolarity_Falling = 1,
248+
GpioPulsePolarity_Rising = 2,
249+
} GpioPulsePolarity;
235250

236251
struct Library_nanoFramework_hardware_esp32_native_nanoFramework_Hardware_Esp32_Configuration
237252
{

targets/ESP32/_nanoCLR/nanoFramework.Hardware.ESP32/nanoFramework_hardware_esp32_native_System_Device_Gpio_GpioPulseCounter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static pcnt_unit_handle_t InitialiseCounter(int counterIndex)
159159
return (ec == ESP_OK) ? counter->unitHandle : NULL;
160160
}
161161

162-
static pcnt_unit_handle_t InitialiseEdgeAndActions(int counterIndex, GpioChangePolarity polarity)
162+
static pcnt_unit_handle_t InitialiseEdgeAndActions(int counterIndex, GpioPulsePolarity polarity)
163163
{
164164
esp_err_t ec = ESP_OK;
165165
bool countRising = false;
@@ -169,17 +169,17 @@ static pcnt_unit_handle_t InitialiseEdgeAndActions(int counterIndex, GpioChangeP
169169

170170
switch (polarity)
171171
{
172-
case GpioChangePolarity_Both:
172+
case GpioPulsePolarity_Both:
173173
countRising = true;
174174
countFalling = true;
175175
break;
176176

177-
case GpioChangePolarity_Rising:
177+
case GpioPulsePolarity_Rising:
178178
countRising = true;
179179
countFalling = false;
180180
break;
181181

182-
case GpioChangePolarity_Falling:
182+
case GpioPulsePolarity_Falling:
183183
countRising = false;
184184
countFalling = true;
185185
break;
@@ -420,7 +420,7 @@ HRESULT Library_nanoFramework_hardware_esp32_native_System_Device_Gpio_GpioPulse
420420
// must be disabled to change
421421
pcnt_unit_disable(unitHandle);
422422

423-
GpioChangePolarity polarity = (GpioChangePolarity)pThis[FIELD___polarity].NumericByRefConst().s4;
423+
GpioPulsePolarity polarity = (GpioPulsePolarity)pThis[FIELD___polarity].NumericByRefConst().s4;
424424
InitialiseEdgeAndActions(counterIndex, polarity);
425425

426426
// Apply filter.

targets/ESP32/_nanoCLR/targetHAL_Power.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ inline bool CPU_IsSoftRebootSupported()
3737

3838
void CPU_SetPowerMode(PowerLevel_type powerLevel)
3939
{
40-
#if !defined(CONFIG_IDF_TARGET_ESP32H2)
4140
switch (powerLevel)
4241
{
4342
case PowerLevel__Off:
@@ -52,5 +51,4 @@ void CPU_SetPowerMode(PowerLevel_type powerLevel)
5251
// all the other power modes are unsupported here
5352
break;
5453
}
55-
#endif
5654
}

0 commit comments

Comments
 (0)