File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
ports/nordic/common-hal/alarm/pin Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -123,11 +123,16 @@ void alarm_pin_pinalarm_reset(void) {
123
123
static void configure_pins_for_sleep (void ) {
124
124
_pinhandler_gpiote_count = 0 ;
125
125
126
+ int n_pin_alarms = __builtin_popcountll (high_alarms ) + __builtin_popcountll (low_alarms );
127
+ const int MAX_N_PIN_ALARMS_FOR_SENSE_FEATURE = 2 ;
128
+
126
129
nrfx_gpiote_in_config_t cfg = {
127
130
.sense = NRF_GPIOTE_POLARITY_TOGGLE ,
128
131
.pull = NRF_GPIO_PIN_PULLUP ,
129
132
.is_watcher = false,
130
- .hi_accuracy = true,
133
+ // hi_accuracy = False reduces sleep current by a factor of ~10x by using the SENSE feature,
134
+ // but only works if not more than MAX_N_PIN_ALARMS_FOR_SENSE_FEATURE pin alarms are used.
135
+ .hi_accuracy = (n_pin_alarms > MAX_N_PIN_ALARMS_FOR_SENSE_FEATURE ),
131
136
.skip_gpio_setup = false
132
137
};
133
138
for (size_t i = 0 ; i < 64 ; ++ i ) {
You can’t perform that action at this time.
0 commit comments