File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -145,14 +145,13 @@ extern SPIClass SPI1;
145145
146146//  For compatibility with sketches designed for AVR @ 16 MHz
147147//  New programs should use SPI.beginTransaction to set the SPI clock
148- #if  F_CPU == 16000000
149-   #define  SPI_CLOCK_DIV2    2 
150-   #define  SPI_CLOCK_DIV4    4 
151-   #define  SPI_CLOCK_DIV8    8 
152-   #define  SPI_CLOCK_DIV16   16 
153-   #define  SPI_CLOCK_DIV32   32 
154-   #define  SPI_CLOCK_DIV64   64 
155-   #define  SPI_CLOCK_DIV128  128 
156- #endif 
157- 
148+ #ifdef  F_CPU
149+ #define  DIVISOR  F_CPU / 16000000 
150+ #define  SPI_CLOCK_DIV2    2  * DIVISOR
151+ #define  SPI_CLOCK_DIV4    4  * DIVISOR
152+ #define  SPI_CLOCK_DIV8    8  * DIVISOR
153+ #define  SPI_CLOCK_DIV16   16  * DIVISOR
154+ #define  SPI_CLOCK_DIV32   32  * DIVISOR
155+ #define  SPI_CLOCK_DIV64   64  * DIVISOR
156+ #define  SPI_CLOCK_DIV128  128  * DIVISOR
158157#endif 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments