Spim#
- group bsp_spim
Control the SPIM peripheral.
- Author
Alexandre Abadie alexandre.abadie@inria.fr
- Copyright
Inria, 2024-present
Defines
-
DB_SPIM_FREQ_125K#
SPIM frequency register values (must be left shifted by 6)
125 kHz
-
DB_SPIM_FREQ_250K#
250 kHz
-
DB_SPIM_FREQ_500K#
500 kHz
-
DB_SPIM_FREQ_1M#
1 MHz
-
DB_SPIM_FREQ_2M#
2 MHz
-
DB_SPIM_FREQ_4M#
4 MHz
-
DB_SPIM_FREQ_8M#
8 MHz
-
DB_SPIM_FREQ_16M#
16 MHz
-
DB_SPIM_FREQ_32M#
32 MHz
Enums
-
enum db_spim_mode_t#
SPIM mode.
Values:
-
enumerator DB_SPIM_MODE_0#
CPOL = 0 (Active High), CPHA = 0 (Leading)
-
enumerator DB_SPIM_MODE_1#
CPOL = 0 (Active High), CPHA = 1 (Trailing)
-
enumerator DB_SPIM_MODE_2#
CPOL = 1 (Active Low), CPHA = 0 (Leading)
-
enumerator DB_SPIM_MODE_3#
CPOL = 1 (Active Low), CPHA = 1 (Trailing)
-
enumerator DB_SPIM_MODE_0#
Functions
-
void db_spim_init(const db_spim_conf_t *conf)#
Initialize the SPIM peripheral.
- Parameters:
conf – [in] pointer to configuration struct
-
void db_spim_begin(const gpio_t *cs, db_spim_mode_t mode, uint32_t freq)#
Begin transmission on SPIM.
- Parameters:
cs – [in] Pointer to the chip select pin
mode – [in] SPI mode
freq – [in] SPI clock frequency
-
void db_spim_end(const gpio_t *cs)#
End transmission on SPIM.
- Parameters:
cs – [in] Pointer to the chip select pin
-
void db_spim_send(const void *bytes, size_t len)#
Send bytes over SPI.
- Parameters:
bytes – [in] Pointer to the input bytes
len – [in] Length of the bytes to send
-
void db_spim_receive(const void *bytes, size_t len)#
Receive bytes over SPI.
- Parameters:
bytes – [in] Pointer to the output bytes
len – [in] Length of the bytes to receive
-
struct db_spim_conf_t#
SPIM pin configuration.