nrf: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register all port-specific root pointers for the nrf port. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
parent
a316a8fdb3
commit
8a69c54211
@ -574,3 +574,5 @@ void microbit_display_init(void) {
|
||||
nrf_gpio_cfg_output(i);
|
||||
}
|
||||
}
|
||||
|
||||
MP_REGISTER_ROOT_POINTER(void *async_data[2]);
|
||||
|
@ -255,4 +255,7 @@ void pwm_release(int32_t pin) {
|
||||
nrf_gpio_pin_clear(pin);
|
||||
}
|
||||
|
||||
MP_REGISTER_ROOT_POINTER(const struct _pwm_events *pwm_active_events);
|
||||
MP_REGISTER_ROOT_POINTER(const struct _pwm_events *pwm_pending_events);
|
||||
|
||||
#endif // MICROPY_PY_MACHINE_SOFT_PWM
|
||||
|
@ -37,6 +37,12 @@
|
||||
#include "nrf_gpio.h"
|
||||
#include "nrfx_gpiote.h"
|
||||
|
||||
#if defined(NRF52840_XXAA)
|
||||
#define NUM_OF_PINS 48
|
||||
#else
|
||||
#define NUM_OF_PINS 32
|
||||
#endif
|
||||
|
||||
extern const pin_obj_t machine_board_pin_obj[];
|
||||
extern const uint8_t machine_pin_num_of_board_pins;
|
||||
|
||||
@ -671,3 +677,7 @@ 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);
|
||||
MP_REGISTER_ROOT_POINTER(mp_obj_t pin_irq_handlers[NUM_OF_PINS]);
|
||||
|
@ -70,7 +70,7 @@ enum {
|
||||
ASYNC_MUSIC_STATE_ARTICULATE,
|
||||
};
|
||||
|
||||
#define music_data MP_STATE_PORT(music_data)
|
||||
#define music_data MP_STATE_PORT(modmusic_music_data)
|
||||
|
||||
extern volatile uint32_t ticks;
|
||||
|
||||
@ -510,5 +510,6 @@ const mp_obj_module_t music_module = {
|
||||
};
|
||||
|
||||
MP_REGISTER_MODULE(MP_QSTR_music, music_module);
|
||||
MP_REGISTER_ROOT_POINTER(struct _music_data_t *modmusic_music_data);
|
||||
|
||||
#endif // MICROPY_PY_MUSIC
|
||||
|
@ -310,41 +310,6 @@ typedef long mp_off_t;
|
||||
|
||||
#define MP_STATE_PORT MP_STATE_VM
|
||||
|
||||
#if MICROPY_PY_MUSIC
|
||||
#define ROOT_POINTERS_MUSIC \
|
||||
struct _music_data_t *music_data;
|
||||
#else
|
||||
#define ROOT_POINTERS_MUSIC
|
||||
#endif
|
||||
|
||||
#if MICROPY_PY_MACHINE_SOFT_PWM
|
||||
#define ROOT_POINTERS_SOFTPWM \
|
||||
const struct _pwm_events *pwm_active_events; \
|
||||
const struct _pwm_events *pwm_pending_events;
|
||||
#else
|
||||
#define ROOT_POINTERS_SOFTPWM
|
||||
#endif
|
||||
|
||||
#if defined(NRF52840_XXAA)
|
||||
#define NUM_OF_PINS 48
|
||||
#else
|
||||
#define NUM_OF_PINS 32
|
||||
#endif
|
||||
|
||||
#define MICROPY_PORT_ROOT_POINTERS \
|
||||
mp_obj_t pin_class_mapper; \
|
||||
mp_obj_t pin_class_map_dict; \
|
||||
mp_obj_t pin_irq_handlers[NUM_OF_PINS]; \
|
||||
\
|
||||
/* stdio is repeated on this UART object if it's not null */ \
|
||||
struct _machine_hard_uart_obj_t *board_stdio_uart; \
|
||||
\
|
||||
ROOT_POINTERS_MUSIC \
|
||||
ROOT_POINTERS_SOFTPWM \
|
||||
\
|
||||
/* micro:bit root pointers */ \
|
||||
void *async_data[2]; \
|
||||
|
||||
#if MICROPY_HW_USB_CDC
|
||||
#define MICROPY_HW_USBDEV_TASK_HOOK extern void tud_task(void); tud_task();
|
||||
#else
|
||||
|
@ -374,3 +374,5 @@ const char *nrfx_error_code_lookup(uint32_t err_code) {
|
||||
}
|
||||
|
||||
#endif // NRFX_LOG_ENABLED
|
||||
|
||||
MP_REGISTER_ROOT_POINTER(struct _machine_hard_uart_obj_t *board_stdio_uart);
|
||||
|
Loading…
Reference in New Issue
Block a user