diff options
author | Grigori Goronzy <greg@chown.ath.cx> | 2018-07-02 23:17:28 +0200 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2018-07-07 11:05:33 -0400 |
commit | 5c7c8c984b582304d1f1c36de0f1d9bacbd8d42d (patch) | |
tree | 780781bf7d848453eabf4b8364addfb04478df88 /src/stm32f1/gpio.h | |
parent | b0ee323e2e01ba2084bea8de733f16474f1167eb (diff) | |
download | kutter-5c7c8c984b582304d1f1c36de0f1d9bacbd8d42d.tar.gz kutter-5c7c8c984b582304d1f1c36de0f1d9bacbd8d42d.tar.xz kutter-5c7c8c984b582304d1f1c36de0f1d9bacbd8d42d.zip |
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>
Diffstat (limited to 'src/stm32f1/gpio.h')
-rw-r--r-- | src/stm32f1/gpio.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/stm32f1/gpio.h b/src/stm32f1/gpio.h index 52e944f1..8c2a00ca 100644 --- a/src/stm32f1/gpio.h +++ b/src/stm32f1/gpio.h @@ -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 |