![]() |
NEORV32 - Software Framework Documentation
|
Two-Wire Interface Controller (TWI) HW driver source file. More...
Functions | |
int | neorv32_twi_available (void) |
void | neorv32_twi_setup (int prsc, int cdiv, int csen) |
void | neorv32_twi_disable (void) |
void | neorv32_twi_enable (void) |
void | neorv32_twi_mack_enable (void) |
void | neorv32_twi_mack_disable (void) |
int | neorv32_twi_busy (void) |
int | neorv32_twi_start_trans (uint8_t a) |
int | neorv32_twi_trans (uint8_t d) |
uint8_t | neorv32_twi_get_data (void) |
void | neorv32_twi_generate_stop (void) |
void | neorv32_twi_generate_start (void) |
int | neorv32_twi_bus_claimed (void) |
Two-Wire Interface Controller (TWI) HW driver source file.
int neorv32_twi_available | ( | void | ) |
Check if TWI unit was synthesized.
int neorv32_twi_bus_claimed | ( | void | ) |
Check if the TWI bus is currently claimed by any controller.
int neorv32_twi_busy | ( | void | ) |
Check if TWI is busy.
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_stop | ( | void | ) |
Generate STOP condition.
uint8_t neorv32_twi_get_data | ( | void | ) |
Get received data from last transmission.
void neorv32_twi_mack_disable | ( | void | ) |
Deactivate sending ACKs by controller (MACK).
void neorv32_twi_mack_enable | ( | void | ) |
Activate sending ACKs by controller (MACK).
void neorv32_twi_setup | ( | int | prsc, |
int | cdiv, | ||
int | csen | ||
) |
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] | csen | Allow clock stretching when 1. |
int neorv32_twi_start_trans | ( | uint8_t | a | ) |
Generate START condition and send first byte (address including R/W bit).
[in] | a | Data byte including 7-bit address and R/W-bit (lsb). |
int neorv32_twi_trans | ( | uint8_t | d | ) |
Send data byte and also receive data byte (can be read via neorv32_twi_get_data()).
[in] | d | Data byte to be send. |