1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 15:03:53 +01:00

drivers/spi: made conf and speed types overridable

This commit is contained in:
Hauke Petersen 2016-03-09 17:59:25 +01:00
parent 1c260c2228
commit 49ac533eba

View File

@ -27,6 +27,7 @@
#include <stdint.h>
#include "periph_cpu.h"
#include "periph_conf.h"
#ifdef __cplusplus
@ -57,7 +58,9 @@ typedef enum {
/**
* @brief The SPI mode is defined by the four possible combinations of clock polarity and
* clock phase.
* @{
*/
#ifndef HAVE_SPI_CONF_T
typedef enum {
/**
* The first data bit is sampled by the receiver on the first SCK edge. The
@ -84,13 +87,18 @@ typedef enum {
*/
SPI_CONF_SECOND_FALLING = 3
} spi_conf_t;
#endif
/** @} */
/**
* @brief Define a set of pre-defined SPI clock speeds.
*
* The actual speed of the bus can vary to some extend, as the combination of CPU clock and
* available prescale values on certain platforms may not make the exact values possible.
*
* @{
*/
#ifndef HAVE_SPI_SPEED_T
typedef enum {
SPI_SPEED_100KHZ = 0, /**< drive the SPI bus with 100KHz */
SPI_SPEED_400KHZ, /**< drive the SPI bus with 400KHz */
@ -98,6 +106,8 @@ typedef enum {
SPI_SPEED_5MHZ, /**< drive the SPI bus with 5MHz */
SPI_SPEED_10MHZ /**< drive the SPI bus with 10MHz */
} spi_speed_t;
#endif
/** @} */
/**
* @brief Initialize the given SPI device to work in master mode