Fix formatting and broken links

Implmements missed pre-commit changes for all files, and fixes links broken by
cleanup in #4698
This commit is contained in:
Lucian Copeland 2021-05-10 18:04:43 -04:00
parent f59a19847c
commit 525b34b042
11 changed files with 42 additions and 47 deletions

View File

@ -102,7 +102,7 @@ bool alarm_pin_pinalarm_woke_us_up(void) {
mp_obj_t alarm_pin_pinalarm_get_wakeup_alarm(size_t n_alarms, const mp_obj_t *alarms) {
// For light sleep, we check if we match any existing alarms
uint64_t pin_status = ((uint64_t) pin_63_32_status) << 32 | pin_31_0_status;
uint64_t pin_status = ((uint64_t)pin_63_32_status) << 32 | pin_31_0_status;
for (size_t i = 0; i < n_alarms; i++) {
if (!mp_obj_is_type(alarms[i], &alarm_pin_pinalarm_type)) {
continue;

View File

@ -38,12 +38,12 @@ uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self
return 0;
}
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) {
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) {
mp_raise_NotImplementedError(translate("Sleep Memory not available"));
return false;
}
void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t* values, uint32_t len) {
void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t *values, uint32_t len) {
mp_raise_NotImplementedError(translate("Sleep Memory not available"));
return;
}

View File

@ -38,7 +38,7 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/port.h"
#include "supervisor/shared/workflow.h"
#include "supervisor/workflow.h"
// Singleton instance of SleepMemory.
const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = {
@ -167,7 +167,9 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) {
HAL_PWR_EnterSTANDBYMode();
// The above shuts down RAM, so we should never hit this
while(1);
while (1) {
;
}
}
void common_hal_alarm_pretending_deep_sleep(void) {

View File

@ -40,7 +40,7 @@
#include STM32_HAL_H
#define STM32_GPIO_PORT_SIZE 16
STATIC pulseio_pulsein_obj_t* callback_obj_ref[STM32_GPIO_PORT_SIZE];
STATIC pulseio_pulsein_obj_t *callback_obj_ref[STM32_GPIO_PORT_SIZE];
STATIC TIM_HandleTypeDef tim_handle;
STATIC uint32_t overflow_count = 0;
@ -64,7 +64,7 @@ STATIC void pulsein_exti_event_handler(uint8_t num) {
// Interrupt register must be cleared manually
EXTI->PR = 1 << num;
pulseio_pulsein_obj_t* self = callback_obj_ref[num];
pulseio_pulsein_obj_t *self = callback_obj_ref[num];
if (!self) {
return;
}
@ -118,7 +118,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu
// Allocate pulse buffer
self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false);
if (self->buffer == NULL) {
//TODO: free the EXTI here?
// TODO: free the EXTI here?
mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"),
maxlen * sizeof(uint16_t));
}
@ -189,7 +189,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) {
if (common_hal_pulseio_pulsein_deinited(self)) {
return;
}
//Remove pulsein slot from shared array
// Remove pulsein slot from shared array
callback_obj_ref[self->pin->number] = NULL;
stm_peripherals_exti_free(self->pin->number);
reset_pin_number(self->pin->port, self->pin->number);
@ -201,7 +201,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) {
}
}
void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t* self) {
void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) {
stm_peripherals_exti_disable(self->pin->number);
self->paused = true;
}
@ -239,14 +239,14 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, uint16_t tri
stm_peripherals_exti_enable(self->pin->number);
}
void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) {
void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t *self) {
stm_peripherals_exti_disable(self->pin->number);
self->start = 0;
self->len = 0;
stm_peripherals_exti_enable(self->pin->number);
}
uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_t index) {
uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_t index) {
stm_peripherals_exti_disable(self->pin->number);
if (index < 0) {
index += self->len;

View File

@ -39,7 +39,7 @@ STATIC bool stm_exti_never_reset[STM32_GPIO_PORT_SIZE];
STATIC void (*stm_exti_callback[STM32_GPIO_PORT_SIZE])(uint8_t num);
void exti_reset(void) {
for (size_t i = 0;i < STM32_GPIO_PORT_SIZE; i++) {
for (size_t i = 0; i < STM32_GPIO_PORT_SIZE; i++) {
if (!stm_exti_never_reset[i]) {
stm_exti_reserved[i] = false;
stm_exti_callback[i] = NULL;
@ -79,7 +79,7 @@ void stm_peripherals_exti_disable(uint8_t num) {
HAL_NVIC_DisableIRQ(stm_peripherals_exti_get_irq(num));
}
void stm_peripherals_exti_set_callback(void(*callback)(uint8_t num), uint8_t number) {
void stm_peripherals_exti_set_callback(void (*callback)(uint8_t num), uint8_t number) {
stm_exti_callback[number] = callback;
}
@ -98,7 +98,7 @@ IRQn_Type stm_peripherals_exti_get_irq(uint8_t num) {
return EXTI3_IRQn;
} else if (num == 4) {
return EXTI4_IRQn;
} else if (num >= 5 && num <= 9 ) {
} else if (num >= 5 && num <= 9) {
return EXTI9_5_IRQn;
} else if (num >= 10 && num <= 15) {
return EXTI15_10_IRQn;
@ -107,42 +107,35 @@ IRQn_Type stm_peripherals_exti_get_irq(uint8_t num) {
}
}
void EXTI0_IRQHandler(void)
{
void EXTI0_IRQHandler(void) {
stm_exti_callback[0](0);
}
void EXTI1_IRQHandler(void)
{
void EXTI1_IRQHandler(void) {
stm_exti_callback[1](1);
}
void EXTI2_IRQHandler(void)
{
void EXTI2_IRQHandler(void) {
stm_exti_callback[2](2);
}
void EXTI3_IRQHandler(void)
{
void EXTI3_IRQHandler(void) {
stm_exti_callback[3](3);
}
void EXTI4_IRQHandler(void)
{
void EXTI4_IRQHandler(void) {
stm_exti_callback[4](4);
}
void EXTI9_5_IRQHandler(void)
{
void EXTI9_5_IRQHandler(void) {
uint32_t pending = EXTI->PR;
for (uint i = 5; i <= 9; i++) {
if(pending & (1 << i)) {
if (pending & (1 << i)) {
stm_exti_callback[i](i);
}
}
}
void EXTI15_10_IRQHandler(void)
{
void EXTI15_10_IRQHandler(void) {
uint32_t pending = EXTI->PR;
for (uint i = 10; i <= 15; i++) {
if(pending & (1 << i)) {
if (pending & (1 << i)) {
stm_exti_callback[i](i);
}
}

View File

@ -38,7 +38,7 @@ bool stm_peripherals_exti_is_free(uint8_t num);
bool stm_peripherals_exti_reserve(uint8_t num);
void stm_peripherals_exti_enable(uint8_t num);
void stm_peripherals_exti_disable(uint8_t num);
void stm_peripherals_exti_set_callback(void(*callback)(uint8_t num), uint8_t number);
void stm_peripherals_exti_set_callback(void (*callback)(uint8_t num), uint8_t number);
void stm_peripherals_exti_free(uint8_t num);
IRQn_Type stm_peripherals_exti_get_irq(uint8_t num);

View File

@ -78,7 +78,7 @@ void stm32_peripherals_rtc_init(void) {
// This function is called often for timing so we cache the seconds elapsed computation based on the
// register value. The STM HAL always does shifts and conversion if we use it directly.
uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t* subticks) {
uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks) {
// Disable IRQs to ensure we read all of the RTC registers as close in time as possible. Read
// SSR twice to make sure we didn't read across a tick.
__disable_irq();
@ -122,16 +122,16 @@ uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t* subticks) {
*subticks = subseconds % 32;
}
uint64_t raw_ticks = ((uint64_t) TICK_DIVISOR) * (seconds_to_date + seconds_to_minute + seconds) + subseconds / 32;
uint64_t raw_ticks = ((uint64_t)TICK_DIVISOR) * (seconds_to_date + seconds_to_minute + seconds) + subseconds / 32;
return raw_ticks;
}
void stm32_peripherals_rtc_assign_wkup_callback(void(*callback)(void)) {
void stm32_peripherals_rtc_assign_wkup_callback(void (*callback)(void)) {
wkup_callback = callback;
}
void stm32_peripherals_rtc_set_wakeup_mode_seconds(uint32_t seconds) {
//prep stuff from CubeMX
// prep stuff from CubeMX
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
__HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);
@ -159,7 +159,7 @@ void stm32_peripherals_rtc_reset_alarms(void) {
HAL_RTC_DeactivateAlarm(&hrtc, RTC_ALARM_B);
}
void stm32_peripherals_rtc_assign_alarm_callback(uint8_t alarm_idx, void(*callback)(void)) {
void stm32_peripherals_rtc_assign_alarm_callback(uint8_t alarm_idx, void (*callback)(void)) {
alarm_callbacks[alarm_idx] = callback;
}

View File

@ -35,16 +35,16 @@
uint32_t stm32_peripherals_get_rtc_freq(void);
void stm32_peripherals_rtc_init(void);
uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t* subticks);
uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks);
void stm32_peripherals_rtc_assign_wkup_callback(void(*callback)(void));
void stm32_peripherals_rtc_assign_wkup_callback(void (*callback)(void));
void stm32_peripherals_rtc_set_wakeup_mode_seconds(uint32_t seconds);
void stm32_peripherals_rtc_set_wakeup_mode_tick(void);
void stm32_peripherals_rtc_enable_wakeup_timer(void);
void stm32_peripherals_rtc_disable_wakeup_timer(void);
void stm32_peripherals_rtc_reset_alarms(void);
void stm32_peripherals_rtc_assign_alarm_callback(uint8_t alarm_idx, void(*callback)(void)) ;
void stm32_peripherals_rtc_assign_alarm_callback(uint8_t alarm_idx, void (*callback)(void));
void stm32_peripherals_rtc_set_alarm(uint8_t alarm_idx, uint32_t ticks);
bool stm32_peripherals_rtc_alarm_triggered(uint8_t alarm_idx);

View File

@ -334,7 +334,7 @@ __attribute__((used)) void HardFault_Handler(void) {
}
}
uint64_t port_get_raw_ticks(uint8_t* subticks) {
uint64_t port_get_raw_ticks(uint8_t *subticks) {
return stm32_peripherals_rtc_raw_ticks(subticks);
}