stm32: Add support for a board to reserve certain peripherals.
Allows reserving CAN, I2C, SPI, Timer and UART peripherals. If reserved the peripheral cannot be accessed from Python. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -896,6 +896,11 @@ STATIC mp_obj_t pyb_timer_make_new(const mp_obj_type_t *type, size_t n_args, siz
|
||||
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("Timer(%d) doesn't exist"), tim_id);
|
||||
}
|
||||
|
||||
// check if the timer is reserved for system use or not
|
||||
if (MICROPY_HW_TIM_IS_RESERVED(tim_id)) {
|
||||
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("Timer(%d) is reserved"), tim_id);
|
||||
}
|
||||
|
||||
pyb_timer_obj_t *tim;
|
||||
if (MP_STATE_PORT(pyb_timer_obj_all)[tim_id - 1] == NULL) {
|
||||
// create new Timer object
|
||||
|
||||
Reference in New Issue
Block a user