nrf5/modules/machine/timer: If timer is used in combination with SOFT_PWM (implicitly use of ticker.c) guard the Timer1 instance from being instantiated trough python timer module. Also disable implementation of the HAL IRQ handler which is for now explicitly implemented in ticker.c for Timer1.
This commit is contained in:
parent
aa9ad6be01
commit
d9813910da
@ -39,15 +39,15 @@ void hal_timer_start(uint8_t id) {
|
|||||||
void hal_timer_stop(uint8_t id) {
|
void hal_timer_stop(uint8_t id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (MICROPY_PY_MACHINE_SOFT_PWM != 1)
|
|
||||||
void TIMER0_IRQHandler(void) {
|
void TIMER0_IRQHandler(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#if (MICROPY_PY_MACHINE_SOFT_PWM != 1)
|
||||||
void TIMER1_IRQHandler(void) {
|
void TIMER1_IRQHandler(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void TIMER2_IRQHandler(void) {
|
void TIMER2_IRQHandler(void) {
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args,
|
|||||||
int timer_id = timer_find(args[ARG_NEW_id].u_obj);
|
int timer_id = timer_find(args[ARG_NEW_id].u_obj);
|
||||||
|
|
||||||
#if MICROPY_PY_MACHINE_SOFT_PWM
|
#if MICROPY_PY_MACHINE_SOFT_PWM
|
||||||
if (timer_id == 0) {
|
if (timer_id == 1) {
|
||||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
||||||
"Timer(%d) reserved by ticker driver.", timer_id));
|
"Timer(%d) reserved by ticker driver.", timer_id));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user