#include <stdbool.h>
#include <stdint.h>
#include <stm32f10x.h>
#include "drv_gpio.h"
#include "drv_spi.h"
Go to the source code of this file.
Macros | |
#define | BR_CLEAR_MASK 0xFFC7 |
#define | SPI1_GPIO GPIOA |
#define | SPI1_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOA |
#define | SPI1_MISO_PIN GPIO_Pin_6 |
#define | SPI1_MISO_PIN_SOURCE GPIO_PinSource6 |
#define | SPI1_MOSI_PIN GPIO_Pin_7 |
#define | SPI1_MOSI_PIN_SOURCE GPIO_PinSource7 |
#define | SPI1_NSS_PIN GPIO_Pin_4 |
#define | SPI1_NSS_PIN_SOURCE GPIO_PinSource4 |
#define | SPI1_SCK_PIN GPIO_Pin_5 |
#define | SPI1_SCK_PIN_SOURCE GPIO_PinSource5 |
#define | SPI2_GPIO GPIOB |
#define | SPI2_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOB |
#define | SPI2_MISO_PIN GPIO_Pin_14 |
#define | SPI2_MISO_PIN_SOURCE GPIO_PinSource14 |
#define | SPI2_MOSI_PIN GPIO_Pin_15 |
#define | SPI2_MOSI_PIN_SOURCE GPIO_PinSource15 |
#define | SPI2_NSS_PIN GPIO_Pin_12 |
#define | SPI2_NSS_PIN_SOURCE GPIO_PinSource12 |
#define | SPI2_SCK_PIN GPIO_Pin_13 |
#define | SPI2_SCK_PIN_SOURCE GPIO_PinSource13 |
#define | UNUSED(x) (void)(x) |
#define | USE_SPI_DEVICE_1 |
#define | USE_SPI_DEVICE_2 |
Functions | |
void | initSpi1 (void) |
void | initSpi2 (void) |
bool | spiInit (SPI_TypeDef *instance) |
bool | spiIsBusBusy (SPI_TypeDef *instance) |
void | spiSetDivisor (SPI_TypeDef *instance, uint16_t divisor) |
void | spiTransfer (SPI_TypeDef *instance, uint8_t *out, const uint8_t *in, int len) |
uint8_t | spiTransferByte (SPI_TypeDef *instance, uint8_t data) |
#define BR_CLEAR_MASK 0xFFC7 |
#define SPI1_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOA |
#define SPI1_MISO_PIN GPIO_Pin_6 |
#define SPI1_MISO_PIN_SOURCE GPIO_PinSource6 |
#define SPI1_MOSI_PIN GPIO_Pin_7 |
#define SPI1_MOSI_PIN_SOURCE GPIO_PinSource7 |
#define SPI1_NSS_PIN GPIO_Pin_4 |
#define SPI1_NSS_PIN_SOURCE GPIO_PinSource4 |
#define SPI1_SCK_PIN GPIO_Pin_5 |
#define SPI1_SCK_PIN_SOURCE GPIO_PinSource5 |
#define SPI2_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOB |
#define SPI2_MISO_PIN GPIO_Pin_14 |
#define SPI2_MISO_PIN_SOURCE GPIO_PinSource14 |
#define SPI2_MOSI_PIN GPIO_Pin_15 |
#define SPI2_MOSI_PIN_SOURCE GPIO_PinSource15 |
#define SPI2_NSS_PIN GPIO_Pin_12 |
#define SPI2_NSS_PIN_SOURCE GPIO_PinSource12 |
#define SPI2_SCK_PIN GPIO_Pin_13 |
#define SPI2_SCK_PIN_SOURCE GPIO_PinSource13 |
bool spiInit | ( | SPI_TypeDef * | instance | ) |
bool spiIsBusBusy | ( | SPI_TypeDef * | instance | ) |
void spiSetDivisor | ( | SPI_TypeDef * | instance, |
uint16_t | divisor | ||
) |
void spiTransfer | ( | SPI_TypeDef * | instance, |
uint8_t * | out, | ||
const uint8_t * | in, | ||
int | len | ||
) |
uint8_t spiTransferByte | ( | SPI_TypeDef * | instance, |
uint8_t | data | ||
) |