1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 01:35:41 +03:00

Make SPI read and write register generic

This commit is contained in:
Martin Budden 2017-06-29 05:40:31 +01:00
parent e36ad629e4
commit 8df87bc47d
6 changed files with 74 additions and 53 deletions

View file

@ -18,7 +18,8 @@
#pragma once
#include "drivers/io_types.h"
#include "rcc_types.h"
#include "drivers/bus.h"
#include "drivers/rcc_types.h"
#if defined(STM32F4) || defined(STM32F3)
#define SPI_IO_AF_CFG IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, GPIO_PuPd_NOPULL)
@ -101,3 +102,6 @@ SPIDevice spiDeviceByInstance(SPI_TypeDef *instance);
SPI_HandleTypeDef* spiHandleByInstance(SPI_TypeDef *instance);
DMA_HandleTypeDef* spiSetDMATransmit(DMA_Stream_TypeDef *Stream, uint32_t Channel, SPI_TypeDef *Instance, uint8_t *pData, uint16_t Size);
#endif
bool spiWriteRegister(const busDevice_t *bus, uint8_t reg, uint8_t data);
bool spiReadRegister(const busDevice_t *bus, uint8_t reg, uint8_t length, uint8_t *data);