GlobLib
HAL and API libraries for MCUs and hardware.
stm32f103cb_spi.h File Reference

Header file for stm32f103cb SPI. More...

#include "stm32f103cb_gpio.h"
#include "stm32f103cb_debug.h"
#include "stm32f103cb_clock.h"
#include <libopencm3/stm32/f1/spi.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define SPI_DEFAULT_SPEED   SPI_SPEED_8
 Serial clock rate.
 
#define SPI_DEFAULT_CLOCK   SPI_CLOCK_HIGH
 Clock reset state.
 
#define SPI_DEFAULT_PHASE   SPI_PHASE_SECOND
 Clock capture edge relative to clock.
 
#define SPI_DEFAULT_DATA   SPI_DATA_8
 Data frame size.
 
#define SPI_DEFAULT_ENDIAN   SPI_MSB
 Data frame order.
 

Typedefs

typedef uint16_t(* spi_u16_fp_v) (void)
 Funtion point typedef for void(*fp)(void)
 
typedef void(* spi_v_fp_u16) (uint16_t)
 Funtion point typedef for void(*fp)(uint8_t)
 

Enumerations

Functions

mcu_error SPI_setup (spi_periph periph)
 Sets up the SPI peripheral with standard setting doneted with macro defines. More...
 
mcu_error SPI_setSpeed (spi_periph periph, spi_speed speed)
 Sets the speed of the serial clock. More...
 
mcu_error SPI_setClockPolarity (spi_periph periph, spi_clock polarity)
 Sets the polarity of the clock during the idle state. More...
 
mcu_error SPI_setDataFrame (spi_periph periph, spi_data data)
 Sets the size of the data frame for one transmission. More...
 
mcu_error SPI_setEndian (spi_periph periph, spi_endian endian)
 Sets order of the transmitted data frame. More...
 
mcu_error SPI_setPhase (spi_periph periph, spi_phase phase)
 Sets the phase of the clock. More...
 
spi_u16_fp_v SPI_getGetAdd (spi_periph periph)
 Get the function address of the get function for the port. More...
 
spi_v_fp_u16 SPI_getPutAdd (spi_periph periph)
 Get the function address of the put function for the port. More...
 
mcu_error SPI_put (spi_periph periph, uint16_t data)
 Send one data frame on the data bus. (blocking) More...
 
uint16_t SPI_get (spi_periph periph)
 Recieve a byte from the recieve buffer. (blocking) More...
 
mcu_error SPI_enableTxISR (spi_periph periph, void(*handler)(void))
 Enable the peripheral's transmit interrupt. More...
 
mcu_error SPI_enableRxISR (spi_periph periph, void(*handler)(uint16_t))
 Enable the peripheral's receive interrupt. More...
 
mcu_error SPI_disableTxISR (spi_periph periph)
 Disable the peripheral's transmit interrupt. More...
 
mcu_error SPI_disableRxISR (spi_periph periph)
 Disable the peripheral's receive interrupt. More...
 
void SPI_write (spi_periph periph, gpio_port port, gpio_pin pin, spi_csPol polarity, uint16_t address, uint16_t data)
 Write a data frame to a slave device using standard protocole. More...
 
void SPI_repeatWrite (spi_periph periph, gpio_port port, gpio_pin pin, spi_csPol polarity, uint16_t address, uint16_t *data, uint16_t count)
 Write multiple data frames to a slave device using standard protocole. More...
 
uint16_t SPI_read (spi_periph periph, gpio_port port, gpio_pin pin, spi_csPol polarity, uint16_t address)
 Read a data frame from the slave device using standard protocole. More...
 
void SPI_repeatRead (spi_periph periph, gpio_port port, gpio_pin pin, spi_csPol polarity, uint16_t address, uint16_t *data, uint16_t count)
 Read multiple data frames from the slave device using standard protocole. More...
 

Detailed Description

Header file for stm32f103cb SPI.

Definition in file stm32f103cb_spi.h.