Hardware abstraction layer (HAL
) for communicating over TWI/I2C
with the display. Basic settings like the speed of the bus can be defined in twi.h
.
Hardware-defined TWI makes communication inflexible with regard to ports, as these cannot be switched.
TWI-Bus speed definition
The TWI transmission speed can be set up within the F_TWI
macro (100 kHz
is set by default).
#define F_TWI 100000UL
Prescaler for TWI clock generation
The TWI bitrate register can only take 8 Bits
so it is necessary to setup the correct prescaler. The faster the bus goes the lower should be the prescaler.
Calculation of the bitrate register (allowed values: 1-255
):
#define TWI_PRESCALER 0
Valid prescaler values are
0
,1
,2
, and3
, representing division factors of1
,4
,16
, and64
respectively.
For a more detailed view of the possible parameters that can be set in twi.h
, take a look at the OLED Doxygen documentation (OLDD
).