50 lines
782 B
C
50 lines
782 B
C
/*
|
|
* File: BoardCfg.h
|
|
* Author: JF
|
|
*
|
|
* Created on November 26, 2018, 4:50 PM
|
|
*/
|
|
|
|
#ifndef BOARDCFG_H
|
|
#define BOARDCFG_H
|
|
|
|
#include "define.h"
|
|
|
|
static inline __attribute__((always_inline)) unsigned char SPICalculateBRG(unsigned int pb_clk, unsigned int spi_clk)
|
|
{
|
|
unsigned int brg;
|
|
|
|
brg = pb_clk / (2 * spi_clk);
|
|
|
|
if(pb_clk % (2 * spi_clk))
|
|
brg++;
|
|
|
|
if(brg > 0x100)
|
|
brg = 0x100;
|
|
|
|
if(brg)
|
|
brg--;
|
|
|
|
return (unsigned char) brg;
|
|
}
|
|
//
|
|
#ifdef FUBARINO_BRD
|
|
#include "BoardCfg_Fubarino.h"
|
|
#endif
|
|
|
|
//#ifdef PINGUINO_BRD
|
|
//#include "BoardCfg_Pinguino.h"
|
|
//#endif
|
|
|
|
#ifdef CHALETDUINO_BRD
|
|
#include "BoardCfg_Chaletduino.h"
|
|
#endif
|
|
|
|
#ifdef CHALETDUINO_V2_BRD
|
|
#include "BoardCfg_ChaletduinoV2.h"
|
|
#endif
|
|
int InitBoard();
|
|
|
|
#endif /* BOARDCFG_H */
|
|
|