diff --git a/cpu/sam3/periph/timer.c b/cpu/sam3/periph/timer.c index d4485f171434..721b6f879f44 100644 --- a/cpu/sam3/periph/timer.c +++ b/cpu/sam3/periph/timer.c @@ -111,7 +111,12 @@ int timer_init(tim_t tim, uint32_t freq, timer_cb_t cb, void *arg) * channel 1 toggles this line on each timer tick, the actual frequency * driving channel 0 is f_ch2 / 2 --> f_ch0/1 = (MCK / 2) / 2 / freq. */ - dev(tim)->TC_CHANNEL[1].TC_RC = (CLOCK_CORECLOCK / 4) / freq; + uint32_t tc_rc = (CLOCK_CORECLOCK / 4) / freq; + /* the API expects apps to know in advance which frequencies are possible + * and only configure with supported frequencies. So aid debugging with + * an assert */ + assert(tc_rc * freq == CLOCK_CORECLOCK / 4); + dev(tim)->TC_CHANNEL[1].TC_RC = tc_rc; /* start channel 1 */ dev(tim)->TC_CHANNEL[1].TC_CCR = (TC_CCR_CLKEN | TC_CCR_SWTRG); diff --git a/drivers/include/pcf857x.h b/drivers/include/pcf857x.h index 4b270be1e649..c2ce3ba888b2 100644 --- a/drivers/include/pcf857x.h +++ b/drivers/include/pcf857x.h @@ -260,10 +260,6 @@ extern "C" #include "event.h" #endif /* MODULE_PCF857X_IRQ */ -#if !IS_USED(MODULE_PCF8574) && !IS_USED(MODULE_PCF8574A) && !IS_USED(MODULE_PCF8575) -#error "Please provide a list of pcf857x variants used by the application (pcf8574, pcf8574a or pcf8575)" -#endif - /** * @name PCF857X I2C slave addresses * diff --git a/drivers/pcf857x/pcf857x.c b/drivers/pcf857x/pcf857x.c index d74c4a8a18e4..a37d21b394b0 100644 --- a/drivers/pcf857x/pcf857x.c +++ b/drivers/pcf857x/pcf857x.c @@ -42,6 +42,10 @@ #endif /* ENABLE_DEBUG */ +#if !IS_USED(MODULE_PCF8574) && !IS_USED(MODULE_PCF8574A) && !IS_USED(MODULE_PCF8575) +#error "Please provide a list of pcf857x variants used by the application (pcf8574, pcf8574a or pcf8575)" +#endif + #if IS_USED(MODULE_PCF857X_IRQ_LOW) #define PCF857X_EVENT_PRIO EVENT_PRIO_LOWEST #elif IS_USED(MODULE_PCF857X_IRQ_MEDIUM)