From 2fad06093f7df9f35d922d4f743c6299b888b49e Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Thu, 15 Dec 2016 10:22:07 +0000 Subject: [PATCH] Tweak the PDB timer period. --- IOTeensy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IOTeensy.cpp b/IOTeensy.cpp index 5e3d24e..18d9d4d 100644 --- a/IOTeensy.cpp +++ b/IOTeensy.cpp @@ -138,7 +138,7 @@ void CIO::startInt() #else // Setup PDB for ADC0 at 24 kHz SIM_SCGC6 |= SIM_SCGC6_PDB; // Enable PDB clock - PDB0_MOD = F_BUS / 24000; // Timer period + PDB0_MOD = (F_BUS / 24000) - 1; // Timer period - 1 PDB0_IDLY = 0; // Interrupt delay PDB0_CH0C1 = PDB_CHnC1_TOS | PDB_CHnC1_EN; // Enable pre-trigger for ADC0 PDB0_SC = PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | // SW trigger, enable interrupts, continuous mode