Skip to content

Commit

Permalink
squash PIT combined
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim Nohlgård committed Jun 5, 2017
1 parent 9c15627 commit 6c9f0e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion boards/frdm-kw41z/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ extern "C"
#define TIMER_NUMOF ((PIT_NUMOF) + (LPTMR_NUMOF))

#define PIT_BASECLOCK (CLOCK_BUSCLOCK)
#define PIT_ISR_0 isr_pit
#define LPTMR_ISR_0 isr_lptmr0

/** @} */
Expand Down
1 change: 1 addition & 0 deletions cpu/kinetis_common/isr_kinetis.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ WEAK_DEFAULT void isr_ltc(void);
WEAK_DEFAULT void isr_mcg(void);
WEAK_DEFAULT void isr_mcm(void);
WEAK_DEFAULT void isr_pdb0(void);
WEAK_DEFAULT void isr_pit(void);
WEAK_DEFAULT void isr_pit0(void);
WEAK_DEFAULT void isr_pit1(void);
WEAK_DEFAULT void isr_pit2(void);
Expand Down
16 changes: 16 additions & 0 deletions cpu/kinetis_common/periph/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,22 @@ void timer_stop(tim_t dev)

/* ****** ISR instances ****** */

void isr_pit(void)
{
/* Some of the lower end Kinetis CPUs combine the individual PIT interrupt
* flags into a single NVIC IRQ signal. This means that software needs to
* test which timer(s) went off when an IRQ occurs. */
for (size_t i = 0; i < PIT_NUMOF; ++i) {
if (PIT->CHANNEL[pit_config[i].count_ch].TCTRL & PIT_TCTRL_TIE_MASK) {
/* Interrupt is enabled */
if (PIT->CHANNEL[pit_config[i].count_ch].TFLG) {
/* Timer interrupt flag is set */
pit_irq_handler(_pit_tim_t(i));
}
}
}
}

#ifdef PIT_ISR_0
void PIT_ISR_0(void)
{
Expand Down

0 comments on commit 6c9f0e8

Please sign in to comment.