|
|
|
@ -23,10 +23,47 @@ extern "C" {
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include "hardwareDescription.h"
|
|
|
|
|
|
|
|
|
|
/** This is the spi hardware channel class*/
|
|
|
|
|
typedef enum{
|
|
|
|
|
NONINVERTED,
|
|
|
|
|
INVERTED
|
|
|
|
|
}spi_clkPol_t;
|
|
|
|
|
|
|
|
|
|
typedef enum{
|
|
|
|
|
MSB_FIRST,
|
|
|
|
|
LSB_FIRST
|
|
|
|
|
}spi_framef_t;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief This is the spi hardware channel class
|
|
|
|
|
* @param spi_hw_ch SPI hardware channel
|
|
|
|
|
*/
|
|
|
|
|
void spi_init(spiCH_t spi_hw_ch);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Enable spi hardware channel
|
|
|
|
|
* @param spi_hw_ch SPI hardware channel
|
|
|
|
|
*/
|
|
|
|
|
void spi_enable(spiCH_t spi_hw_ch);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief set SPI clock polarity
|
|
|
|
|
* @param clkPol Clock polarity
|
|
|
|
|
*/
|
|
|
|
|
void spi_setPolarity(spi_clkPol_t clkPol);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Set SPI frame format
|
|
|
|
|
* @param framef Frame format
|
|
|
|
|
*/
|
|
|
|
|
void spi_set_setFrameFormat(spi_framef_t framef);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Set Clock Prescaler
|
|
|
|
|
* This is dependent on your target device. Please enter in the correct value.
|
|
|
|
|
* The entered Value will be masked with the maximal number of bits (truncated)
|
|
|
|
|
* @param clkDiv
|
|
|
|
|
*/
|
|
|
|
|
void spi_setClockPrescaler(uint32_t clkDiv);
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* @brief Transmits and receives on byte of data
|
|
|
|
|