File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ __STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
193193 __DMB ();
194194 MPU -> CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk ;
195195#ifdef SCB_SHCSR_MEMFAULTENA_Msk
196- SCB -> SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk ;
196+ SCB -> SHCSR = SCB -> SHCSR | SCB_SHCSR_MEMFAULTENA_Msk ;
197197#endif
198198 __DSB ();
199199 __ISB ();
@@ -205,9 +205,9 @@ __STATIC_INLINE void ARM_MPU_Disable(void)
205205{
206206 __DMB ();
207207#ifdef SCB_SHCSR_MEMFAULTENA_Msk
208- SCB -> SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk ;
208+ SCB -> SHCSR = SCB -> SHCSR & ~SCB_SHCSR_MEMFAULTENA_Msk ;
209209#endif
210- MPU -> CTRL &= ~MPU_CTRL_ENABLE_Msk ;
210+ MPU -> CTRL = MPU -> CTRL & ~MPU_CTRL_ENABLE_Msk ;
211211 __DSB ();
212212 __ISB ();
213213}
Original file line number Diff line number Diff line change @@ -145,14 +145,14 @@ extern SPIClass SPI1;
145145// For compatibility with sketches designed for AVR @ 16 MHz
146146// New programs should use SPI.beginTransaction to set the SPI clock
147147#ifdef F_CPU
148- # define DIVISOR F_CPU / 16000000
149- # define SPI_CLOCK_DIV2 2 * DIVISOR
150- # define SPI_CLOCK_DIV4 4 * DIVISOR
151- # define SPI_CLOCK_DIV8 8 * DIVISOR
152- # define SPI_CLOCK_DIV16 16 * DIVISOR
153- # define SPI_CLOCK_DIV32 32 * DIVISOR
154- # define SPI_CLOCK_DIV64 64 * DIVISOR
155- # define SPI_CLOCK_DIV128 128 * DIVISOR
148+ static constexpr uint32_t SPI_DIVISOR = ( static_cast < uint32_t >( F_CPU ) / 16000000UL );
149+ static constexpr uint32_t SPI_CLOCK_DIV2 = ( 2UL * SPI_DIVISOR );
150+ static constexpr uint32_t SPI_CLOCK_DIV4 = ( 4UL * SPI_DIVISOR );
151+ static constexpr uint32_t SPI_CLOCK_DIV8 = ( 8UL * SPI_DIVISOR );
152+ static constexpr uint32_t SPI_CLOCK_DIV16 = ( 16UL * SPI_DIVISOR );
153+ static constexpr uint32_t SPI_CLOCK_DIV32 = ( 32UL * SPI_DIVISOR );
154+ static constexpr uint32_t SPI_CLOCK_DIV64 = ( 64UL * SPI_DIVISOR );
155+ static constexpr uint32_t SPI_CLOCK_DIV128 = ( 128UL * SPI_DIVISOR );
156156#endif
157157
158158#endif
You can’t perform that action at this time.
0 commit comments