Autodrone
Multi-Domain Vehicle
drv_spi1.h File Reference

Go to the source code of this file.

Macros

#define SPI1_ENABLE   GPIOA->BSRR |= GPIO_BSRR_BR4
 
#define SPI1_DISABLE   GPIOA->BSRR |= GPIO_BSRR_BS4
 
#define SPI_BR_PRESCALER_16   (0x3 << 3U)
 
#define SPI_BR_PRESCALER_128   (0x6 << 3U)
 

Functions

void spi1Init (void)
 Initializes SPI1. More...
 
void spi1ReadBytes (uint8_t reg, uint8_t *pData, uint8_t size)
 Reads multiple bytes of data in. More...
 
void spi1WriteBytes (uint8_t *pData, uint8_t size)
 Writes multiple bytes of data in. More...
 
void spi1ReadOneByte (uint8_t reg, uint8_t *pData)
 Reads one byte of data in. More...
 
void spi1WriteOneByte (uint8_t reg, uint8_t data)
 Writes one byte of data. More...
 

Macro Definition Documentation

◆ SPI1_DISABLE

#define SPI1_DISABLE   GPIOA->BSRR |= GPIO_BSRR_BS4

◆ SPI1_ENABLE

#define SPI1_ENABLE   GPIOA->BSRR |= GPIO_BSRR_BR4

◆ SPI_BR_PRESCALER_128

#define SPI_BR_PRESCALER_128   (0x6 << 3U)

◆ SPI_BR_PRESCALER_16

#define SPI_BR_PRESCALER_16   (0x3 << 3U)

Function Documentation

◆ spi1Init()

void spi1Init ( void  )

Initializes SPI1.

Returns
Void.

◆ spi1ReadBytes()

void spi1ReadBytes ( uint8_t  reg,
uint8_t *  pData,
uint8_t  size 
)

Reads multiple bytes of data in.

Parameters
regThe hex value of the first register to read from.
*pDataA pointer to location where you want to read data to.
sizeThe amount of bytes to be read.
Returns
Void.

◆ spi1ReadOneByte()

void spi1ReadOneByte ( uint8_t  reg,
uint8_t *  pData 
)

Reads one byte of data in.

Parameters
regThe hex value of the register to read from.
*pDataA pointer to location where you want to read data to.
Returns
Void.

◆ spi1WriteBytes()

void spi1WriteBytes ( uint8_t *  pData,
uint8_t  size 
)

Writes multiple bytes of data in.

Parameters
regThe hex value of the register to write to.
*pDataA pointer to the data you want to write.
sizeThe amount of bytes to write.
Returns
Void.

◆ spi1WriteOneByte()

void spi1WriteOneByte ( uint8_t  reg,
uint8_t  data 
)

Writes one byte of data.

Parameters
regThe hex value of the register to write to.
dataThe data to write.
Returns
Void.