1.1 --- a/include/init.h Wed Oct 24 18:15:08 2018 +0200
1.2 +++ b/include/init.h Thu Oct 25 21:11:22 2018 +0200
1.3 @@ -142,6 +142,8 @@
1.4
1.5 void timer_init_interrupt(int timer, uint8_t pri, uint8_t sub);
1.6
1.7 +int timer_interrupt_number(int timer);
1.8 +
1.9 void timer_on(int timer);
1.10
1.11 int TIMER_INT_FLAGS(int timer, uint8_t flags);
2.1 --- a/include/pic32.h Wed Oct 24 18:15:08 2018 +0200
2.2 +++ b/include/pic32.h Thu Oct 25 21:11:22 2018 +0200
2.3 @@ -301,6 +301,9 @@
2.4 #define TIMER5IPC IPC5
2.5 #define TIMERIPCBASE 0
2.6
2.7 +#define TIMERINTNUMBASE 4
2.8 +#define TIMERINTNUMSTEP 5
2.9 +
2.10 /* UART conveniences. */
2.11
2.12 #define U1MODE 0xBF806000
3.1 --- a/lib/init.c Wed Oct 24 18:15:08 2018 +0200
3.2 +++ b/lib/init.c Thu Oct 25 21:11:22 2018 +0200
3.3 @@ -505,6 +505,13 @@
3.4 SET_REG(TIMERIEC, TIMER_INT_FLAGS(timer, TxIE));
3.5 }
3.6
3.7 +/* Return a timer's interrupt number. */
3.8 +
3.9 +int timer_interrupt_number(int timer)
3.10 +{
3.11 + return TIMERINTNUMBASE + (timer - TIMERMIN) * TIMERINTNUMSTEP;
3.12 +}
3.13 +
3.14 /* Enable a timer. */
3.15
3.16 void timer_on(int timer)