void TM_SPI_Init(SPI_TypeDef* SPIx, TM_SPI_PinsPack_t pinspack) { if (SPIx == SPI1) { TM_SPI1_Init(pinspack); } else if (SPIx == SPI2) { TM_SPI2_Init(pinspack); } else if (SPIx == SPI3) { TM_SPI3_Init(pinspack); } }
int main(void) { //180MHz clock SystemInit(); //Initialize SPI TM_SPI1_Init(TM_SPI_PinsPack_1); //Send 0x15 over SPI1 TM_SPI_Send(SPI1, 0x15); while(1) { } }
void TM_SPI_Init(SPI_TypeDef* SPIx, TM_SPI_PinsPack_t pinspack) { if (SPIx == SPI1) { TM_SPI1_Init(pinspack); } else if (SPIx == SPI2) { TM_SPI2_Init(pinspack); } /* else if (SPIx == SPI3) { TM_SPI3_Init(pinspack); } else if (SPIx == SPI4) { TM_SPI4_Init(pinspack); } else if (SPIx == SPI5) { TM_SPI5_Init(pinspack); } else if (SPIx == SPI6) { TM_SPI6_Init(pinspack); } */ }