Macros for abstracting OLED TWI (I2C) communication interface.
More...
Macros for abstracting OLED TWI (I2C) communication interface.
These macros provide a unified interface for starting, stopping, and sending data over the TWI bus to the OLED display, abstracting the use of either software-based or hardware-based TWI implementations.
- Note
- When OLED_USE_SOFT_TWI is defined, the macros use software TWI functions; otherwise, hardware TWI is used.
Individual macros:
- OLED_START(MODE): Initiates a TWI start condition and sends the OLED’s I2C address with the specified mode (MODE indicates read or write) to begin communication.
- OLED_STOP(): Sends a TWI stop condition to end communication and then inserts a delay (OLED_IDLE_TIME_US) to allow the OLED sufficient processing time before the next communication.
- OLED_DATA(): Sends the control byte indicating that the following bytes will be data (pixel or graphic data) to the OLED display, rather than commands.
This abstraction simplifies OLED communication by hiding the underlying method, enabling easy switching between hardware and software TWI implementations without changing higher-level code.
◆ OLED_DATA
Value:
#define OLED_CONTROL_DATA
Control byte indicating data for the OLED display.
Definition oled.h:99
TWI_Error twi_soft_set(unsigned char data)
Transmit a byte of data on the TWI bus.
Definition twi_soft.c:156
◆ OLED_START
#define OLED_START |
( |
| MODE | ) |
|
Value:
#define OLED_ADDRESS
I2C (TWI) slave address of the OLED display.
Definition oled.h:73
TWI_Error twi_soft_address(unsigned char address, TWI_Operation operation)
Sends the slave address with the read/write operation on the TWI bus.
Definition twi_soft.c:140
TWI_Error twi_soft_start(void)
Generate a TWI start or repeated start condition.
Definition twi_soft.c:87
◆ OLED_STOP
Value:
#define OLED_IDLE_TIME_US
Delay time in microseconds after OLED TWI/I2C stop condition.
Definition oled.h:144
void twi_soft_stop(void)
Stop the TWI (I2C) transmission.
Definition twi_soft.c:116
◆ TWI_SOFT_HEADER