stm32f1: add SPI support

Add basic SPI support and associated documentation.

v2: remove baud rate check, fix baud rate calculations
v3: finish transaction with BSY check, disable SPI when not in use

Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
This commit is contained in:
Grigori Goronzy
2018-07-02 23:17:28 +02:00
committed by KevinOConnor
parent b0ee323e2e
commit 5c7c8c984b
5 changed files with 122 additions and 2 deletions

View File

@@ -30,4 +30,11 @@ uint32_t gpio_adc_sample(struct gpio_adc g);
uint16_t gpio_adc_read(struct gpio_adc g);
void gpio_adc_cancel_sample(struct gpio_adc g);
struct spi_config {
SPI_TypeDef config;
};
struct spi_config spi_setup(uint32_t bus, uint8_t mode, uint32_t rate);
void spi_transfer(struct spi_config config, uint8_t receive_data,
uint8_t len, uint8_t *data);
#endif // gpio.h