stm32: Use MP_REGISTER_ROOT_POINTER().

This uses MP_REGISTER_ROOT_POINTER() to register all port-specific root
pointers in the stm32 port.

Signed-off-by: David Lechner <david@pybricks.com>
pull/8922/head
David Lechner 2022-07-01 14:48:59 -05:00 zatwierdzone przez Damien George
rodzic ffa22b8f97
commit 816e4537f2
11 zmienionych plików z 24 dodań i 29 usunięć

Wyświetl plik

@ -720,3 +720,5 @@ void Handle_EXTI_Irq(uint32_t line) {
}
}
}
MP_REGISTER_ROOT_POINTER(mp_obj_t pyb_extint_callback[PYB_EXTI_NUM_VECTORS]);

Wyświetl plik

@ -1125,4 +1125,6 @@ const mp_obj_type_t machine_i2s_type = {
.locals_dict = (mp_obj_dict_t *)&machine_i2s_locals_dict,
};
MP_REGISTER_ROOT_POINTER(struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_MAX_I2S]);
#endif // MICROPY_HW_ENABLE_I2S

Wyświetl plik

@ -659,3 +659,5 @@ soft_reset_exit:
goto soft_reset;
}
MP_REGISTER_ROOT_POINTER(mp_obj_t pyb_config_main);

Wyświetl plik

@ -243,35 +243,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_cc3k;
#endif
#define MICROPY_PORT_ROOT_POINTERS \
mp_obj_t pyb_hid_report_desc; \
\
mp_obj_t pyb_config_main; \
\
mp_obj_t pyb_switch_callback; \
\
mp_obj_t pin_class_mapper; \
mp_obj_t pin_class_map_dict; \
\
mp_obj_t pyb_extint_callback[PYB_EXTI_NUM_VECTORS]; \
\
/* pointers to all Timer objects (if they have been created) */ \
struct _pyb_timer_obj_t *pyb_timer_obj_all[MICROPY_HW_MAX_TIMER]; \
\
/* stdio is repeated on this UART object if it's not null */ \
struct _pyb_uart_obj_t *pyb_stdio_uart; \
\
/* pointers to all UART objects (if they have been created) */ \
struct _pyb_uart_obj_t *pyb_uart_obj_all[MICROPY_HW_MAX_UART + MICROPY_HW_MAX_LPUART]; \
\
/* pointers to all CAN objects (if they have been created) */ \
struct _pyb_can_obj_t *pyb_can_obj_all[MICROPY_HW_MAX_CAN]; \
\
/* pointers to all I2S objects (if they have been created) */ \
struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_MAX_I2S]; \
\
/* USB_VCP IRQ callbacks (if they have been set) */ \
mp_obj_t pyb_usb_vcp_irq[MICROPY_HW_USB_CDC_NUM]; \
\
/* root pointers defined by a board */ \
MICROPY_BOARD_ROOT_POINTERS \

Wyświetl plik

@ -177,3 +177,5 @@ void mp_hal_get_mac_ascii(int idx, size_t chr_off, size_t chr_len, char *dest) {
*dest++ = hexchr[mac[chr_off >> 1] >> (4 * (1 - (chr_off & 1))) & 0xf];
}
}
MP_REGISTER_ROOT_POINTER(struct _pyb_uart_obj_t *pyb_stdio_uart);

Wyświetl plik

@ -675,3 +675,6 @@ const mp_obj_type_t pin_af_type = {
.print = pin_af_obj_print,
.locals_dict = (mp_obj_dict_t *)&pin_af_locals_dict,
};
MP_REGISTER_ROOT_POINTER(mp_obj_t pin_class_mapper);
MP_REGISTER_ROOT_POINTER(mp_obj_t pin_class_map_dict);

Wyświetl plik

@ -1081,4 +1081,6 @@ const mp_obj_type_t pyb_can_type = {
.locals_dict = (mp_obj_dict_t *)&pyb_can_locals_dict,
};
MP_REGISTER_ROOT_POINTER(struct _pyb_can_obj_t *pyb_can_obj_all[MICROPY_HW_MAX_CAN]);
#endif // MICROPY_HW_ENABLE_CAN

Wyświetl plik

@ -1684,3 +1684,5 @@ void timer_irq_handler(uint tim_id) {
}
}
}
MP_REGISTER_ROOT_POINTER(struct _pyb_timer_obj_t *pyb_timer_obj_all[MICROPY_HW_MAX_TIMER]);

Wyświetl plik

@ -1202,3 +1202,5 @@ const mp_irq_methods_t uart_irq_methods = {
.trigger = uart_irq_trigger,
.info = uart_irq_info,
};
MP_REGISTER_ROOT_POINTER(struct _pyb_uart_obj_t *pyb_uart_obj_all[MICROPY_HW_MAX_UART + MICROPY_HW_MAX_LPUART]);

Wyświetl plik

@ -1152,4 +1152,9 @@ void USR_KEYBRD_ProcessData(uint8_t pbuf) {
#endif // USE_HOST_MODE
#if MICROPY_HW_USB_HID
MP_REGISTER_ROOT_POINTER(mp_obj_t pyb_hid_report_desc);
#endif
MP_REGISTER_ROOT_POINTER(mp_obj_t pyb_usb_vcp_irq[MICROPY_HW_USB_CDC_NUM]);
#endif // MICROPY_HW_ENABLE_USB

Wyświetl plik

@ -143,4 +143,6 @@ const mp_obj_type_t pyb_switch_type = {
.locals_dict = (mp_obj_dict_t *)&pyb_switch_locals_dict,
};
MP_REGISTER_ROOT_POINTER(mp_obj_t pyb_switch_callback);
#endif // MICROPY_HW_HAS_SWITCH