Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_spi.h
1 #ifndef _BC_SPI_H
2 #define _BC_SPI_H
3 
4 #include <bc_common.h>
5 
9 
11 
12 typedef enum
13 {
16 
19 
22 
25 
28 
31 
34 
37 
39 
41 
42 typedef enum
43 {
46 
49 
52 
55 
57 
59 
60 typedef enum
61 {
64 
66 
70 
71 void bc_spi_init(bc_spi_speed_t speed, bc_spi_mode_t mode);
72 
75 
77 
82 
83 void bc_spi_set_timing(uint16_t cs_delay, uint16_t delay, uint16_t cs_quit);
84 
87 
89 
92 
94 
97 
98 void bc_spi_set_manual_cs_control(bool manual_cs_control);
99 
102 
104 
108 
109 bool bc_spi_is_ready(void);
110 
115 
116 bool bc_spi_transfer(const void *source, void *destination, size_t length);
117 
124 
125 bool bc_spi_async_transfer(const void *source, void *destination, size_t length, void (*event_handler)(bc_spi_event_t event, void *event_param), void (*event_param));
126 
128 
129 #endif // _BC_SPI_H
SPI communication speed is 16 MHz.
Definition: bc_spi.h:36
void bc_spi_set_speed(bc_spi_speed_t speed)
Set SPI communication speed.
Definition: bc_spi.c:119
SPI mode of operation is 2 (CPOL = 1, CPHA = 0)
Definition: bc_spi.h:51
void bc_spi_set_manual_cs_control(bool manual_cs_control)
Enable manual control of CS pin.
Definition: bc_spi.c:182
SPI communication speed is 8 MHz.
Definition: bc_spi.h:33
void bc_spi_set_mode(bc_spi_mode_t mode)
Set SPI mode of operation.
Definition: bc_spi.c:155
bc_spi_mode_t
SPI mode of operation.
Definition: bc_spi.h:42
SPI communication speed is 500 kHz.
Definition: bc_spi.h:21
SPI event is completed.
Definition: bc_spi.h:63
SPI mode of operation is 1 (CPOL = 0, CPHA = 1)
Definition: bc_spi.h:48
SPI communication speed is 125 kHz.
Definition: bc_spi.h:15
SPI communication speed is 4 MHz.
Definition: bc_spi.h:30
SPI communication speed is 250 kHz.
Definition: bc_spi.h:18
SPI mode of operation is 3 (CPOL = 1, CPHA = 1)
Definition: bc_spi.h:54
bool bc_spi_is_ready(void)
Check if is ready for transfer.
Definition: bc_spi.c:187
SPI communication speed is 2 MHz.
Definition: bc_spi.h:27
bc_spi_mode_t bc_spi_get_mode(void)
Get SPI mode of operation.
Definition: bc_spi.c:177
bool bc_spi_async_transfer(const void *source, void *destination, size_t length, void(*event_handler)(bc_spi_event_t event, void *event_param), void(*event_param))
Execute async SPI transfer.
Definition: bc_spi.c:267
void bc_spi_set_timing(uint16_t cs_delay, uint16_t delay, uint16_t cs_quit)
Set SPI timing.
Definition: bc_spi.c:141
bc_spi_speed_t
SPI communication speed.
Definition: bc_spi.h:12
bc_spi_event_t
SPI event.
Definition: bc_spi.h:60
void bc_spi_init(bc_spi_speed_t speed, bc_spi_mode_t mode)
Initialize SPI channel.
Definition: bc_spi.c:64
SPI communication speed is 1 MHz.
Definition: bc_spi.h:24
bc_spi_speed_t bc_spi_get_speed(void)
Get SPI communication speed.
Definition: bc_spi.c:150
SPI mode of operation is 0 (CPOL = 0, CPHA = 0)
Definition: bc_spi.h:45
bool bc_spi_transfer(const void *source, void *destination, size_t length)
Execute SPI transfer.
Definition: bc_spi.c:192