NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
|
Two-Wire Interface Controller (TWI) HW driver source file. More...
#include <neorv32.h>
Functions | |
int | neorv32_twi_available (void) |
void | neorv32_twi_setup (int prsc, int cdiv, int clkstr) |
int | neorv32_twi_get_fifo_depth (void) |
void | neorv32_twi_disable (void) |
void | neorv32_twi_enable (void) |
int | neorv32_twi_sense_scl (void) |
int | neorv32_twi_sense_sda (void) |
int | neorv32_twi_busy (void) |
int | neorv32_twi_get (uint8_t *data) |
int | neorv32_twi_trans (uint8_t *data, int mack) |
void | neorv32_twi_generate_stop (void) |
void | neorv32_twi_generate_start (void) |
void | neorv32_twi_send_nonblocking (uint8_t data, int mack) |
void | neorv32_twi_generate_stop_nonblocking (void) |
void | neorv32_twi_generate_start_nonblocking (void) |
Two-Wire Interface Controller (TWI) HW driver source file.
int neorv32_twi_available | ( | void | ) |
Check if TWI unit was synthesized.
int neorv32_twi_busy | ( | void | ) |
Check if TWI controller is busy (TWI bus engine busy or TX FIFO not empty).
void neorv32_twi_disable | ( | void | ) |
Disable TWI controller.
void neorv32_twi_enable | ( | void | ) |
Enable TWI controller.
void neorv32_twi_generate_start | ( | void | ) |
Generate START (or REPEATED-START) condition.
void neorv32_twi_generate_start_nonblocking | ( | void | ) |
Generate START (or REPEATED-START) condition.
void neorv32_twi_generate_stop | ( | void | ) |
Generate STOP condition.
void neorv32_twi_generate_stop_nonblocking | ( | void | ) |
Generate STOP condition.
int neorv32_twi_get | ( | uint8_t * | data | ) |
Get received data + ACK/NACH from RX FIFO.
[in,out] | data | Pointer for returned data (uint8_t). |
int neorv32_twi_get_fifo_depth | ( | void | ) |
Get TWI FIFO depth.
void neorv32_twi_send_nonblocking | ( | uint8_t | data, |
int | mack ) |
Send data byte (RX can be read via neorv32_twi_get()).
[in] | data | Data byte to be send. |
[in] | mack | Generate ACK by host controller when set. |
int neorv32_twi_sense_scl | ( | void | ) |
Get current state of SCL bus line.
int neorv32_twi_sense_sda | ( | void | ) |
Get current state of SDA bus line.
void neorv32_twi_setup | ( | int | prsc, |
int | cdiv, | ||
int | clkstr ) |
Enable and configure TWI controller. The TWI control register bits are listed in NEORV32_TWI_CTRL_enum.
[in] | prsc | Clock prescaler select (0..7). See NEORV32_CLOCK_PRSC_enum. |
[in] | cdiv | Clock divider (0..15). |
[in] | clkstr | Enable (allow) clock stretching. |
int neorv32_twi_trans | ( | uint8_t * | data, |
int | mack ) |
TWI transfer: send data byte and also receive data byte.
[in,out] | data | Pointer for TX/RX data (uint8_t). |
[in] | mack | Generate ACK by host controller when set. |