Skip to content

Commit 8a2143f

Browse files
committed
Clean up comments and debugging pins
1 parent 9240146 commit 8a2143f

File tree

5 files changed

+7
-36
lines changed

5 files changed

+7
-36
lines changed

ports/stm/common-hal/alarm/SleepMemory.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@ void alarm_sleep_memory_reset(void) {
3434
}
3535

3636
uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) {
37+
mp_raise_NotImplementedError(translate("Sleep Memory not available"));
3738
return 0;
3839
}
3940

4041
bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, const uint8_t* values, uint32_t len) {
42+
mp_raise_NotImplementedError(translate("Sleep Memory not available"));
4143
return false;
4244
}
4345

4446
void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len) {
47+
mp_raise_NotImplementedError(translate("Sleep Memory not available"));
4548
return;
4649
}

ports/stm/common-hal/alarm/__init__.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ void alarm_reset(void) {
4646
most_recent_alarm = NULL;
4747
// Reset the alarm flag
4848
STM_ALARM_FLAG = 0x00;
49-
// alarm_sleep_memory_reset();
5049
alarm_pin_pinalarm_reset();
5150
alarm_time_timealarm_reset();
52-
// esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
5351
}
5452

5553
// Kind of a hack, required as RTC is reset in port.c
@@ -134,7 +132,7 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj
134132

135133
mp_obj_t wake_alarm = _get_wake_alarm(n_alarms, alarms);
136134

137-
// TODO: make this less roundabout
135+
// TODO: make assignment to global array less roundabout
138136
most_recent_alarm = wake_alarm;
139137
shared_alarm_save_wake_alarm();
140138

@@ -149,10 +147,7 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala
149147
_setup_sleep_alarms(true, n_alarms, alarms);
150148
}
151149

152-
//#define NORETURN __attribute__((noreturn))
153150
void NORETURN common_hal_alarm_enter_deep_sleep(void) {
154-
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_9,1);
155-
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_9,0);
156151
alarm_pin_pinalarm_prepare_for_deep_sleep();
157152
alarm_time_timealarm_prepare_for_deep_sleep();
158153
port_disable_tick();

ports/stm/common-hal/alarm/time/TimeAlarm.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,10 @@ STATIC void timer_callback(void) {
6464
}
6565

6666
bool alarm_time_timealarm_woke_us_up(void) {
67-
//mp_printf(&mp_plat_print,"Woke Up:%d\n",woke_up);
6867
return woke_up;
6968
}
7069

7170
void alarm_time_timealarm_reset(void) {
72-
// mp_printf(&mp_plat_print,"timealarm reset");
7371
woke_up = false;
7472
}
7573

ports/stm/peripherals/rtc.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,6 @@ void stm32_peripherals_rtc_assign_alarm_callback(uint8_t alarm_idx, void(*callba
164164
}
165165

166166
void stm32_peripherals_rtc_set_alarm(uint8_t alarm_idx, uint32_t ticks) {
167-
// TEMP: ping set alarm (called by port_interrupt_after_ticks and alarm_time_timealarm_set_alarms)
168-
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_6,1);
169-
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_6,0);
170-
171167
uint64_t raw_ticks = stm32_peripherals_rtc_raw_ticks(NULL) + ticks;
172168

173169
RTC_AlarmTypeDef alarm;
@@ -205,8 +201,6 @@ bool stm32_peripherals_rtc_alarm_triggered(uint8_t alarm_idx) {
205201
}
206202

207203
void RTC_WKUP_IRQHandler(void) {
208-
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,1);
209-
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_7,0);
210204
if (wkup_callback) {
211205
wkup_callback();
212206
}
@@ -220,10 +214,6 @@ void RTC_Alarm_IRQHandler(void) {
220214
}
221215

222216
void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *_hrtc) {
223-
// TEMP
224-
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,1);
225-
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_3,0);
226-
227217
if (alarm_callbacks[PERIPHERALS_ALARM_A]) {
228218
alarm_callbacks[PERIPHERALS_ALARM_A]();
229219
}
@@ -232,10 +222,6 @@ void HAL_RTC_AlarmAEventCallback(RTC_HandleTypeDef *_hrtc) {
232222
}
233223

234224
void HAL_RTCEx_AlarmBEventCallback(RTC_HandleTypeDef *_hrtc) {
235-
//TEMP
236-
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_2,1);
237-
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_2,0);
238-
239225
if (alarm_callbacks[PERIPHERALS_ALARM_B]) {
240226
alarm_callbacks[PERIPHERALS_ALARM_B]();
241227
}

ports/stm/supervisor/port.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ safe_mode_t port_init(void) {
175175
__HAL_RCC_PWR_CLK_ENABLE();
176176
HAL_PWR_EnableBkUpAccess();
177177

178+
#if CIRCUITPY_ALARM
178179
// TODO: don't reset RTC entirely and move this back to alarm
179180
if (STM_ALARM_FLAG & 0x01) {
180181
// We've woken from deep sleep. Was it the WKUP pin or the RTC?
@@ -185,6 +186,8 @@ safe_mode_t port_init(void) {
185186
alarm_set_wakeup_reason(STM_WAKEUP_GPIO);
186187
}
187188
}
189+
#endif
190+
188191
__HAL_RCC_BACKUPRESET_FORCE();
189192
__HAL_RCC_BACKUPRESET_RELEASE();
190193

@@ -251,20 +254,6 @@ void reset_port(void) {
251254
#if CIRCUITPY_PULSEIO || CIRCUITPY_ALARM
252255
exti_reset();
253256
#endif
254-
255-
// TEMP: set up interrupt logging pins
256-
GPIO_InitTypeDef GPIO_InitStruct = {0};
257-
GPIO_InitStruct.Pin = GPIO_PIN_6 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_7;
258-
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
259-
GPIO_InitStruct.Pull = GPIO_NOPULL;
260-
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
261-
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
262-
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
263-
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
264-
265-
// TEMP: ping port init
266-
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_8,1);
267-
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_8,0);
268257
}
269258

270259
void reset_to_bootloader(void) {

0 commit comments

Comments
 (0)