-
Notifications
You must be signed in to change notification settings - Fork 24
Initialization
bool SSD1306_Init_I2C( struct SSD1306_Device* DeviceHandle, int Width, int Height, int I2CAddress, int ResetPin, WriteCommandProc WriteCommand, WriteDataProc WriteData, ResetProc Reset );
Sets up the device structure using user supplied callbacks for writing commands, data, and resetting the display in hardware.
Note: See ifaces/default_if_i2c.c for an example on how these are implemented
- Pointer to object which will be the display device handle
- Width of display
- Height of display
- I2C Address
- GPIO Number of reset pin (Optional: Pass -1 if not using a reset pin)
- Callback to a function which will write a command over the i2c bus
- Callback to a function which will write data over the i2c bus
- Callback to a function that will reset the device via hardware means
- True if the device structure was successfully initialized
Note: Because this display is write only we cannot guarantee that the display was ACTUALLY initialized.
A return value of true just means there were no errors during setup of local structures.
bool SSD1306_Init_SPI( struct SSD1306_Device* DeviceHandle, int Width, int Height, int ResetPin, int CSPin, spi_device_handle_t SPIHandle, WriteCommandProc WriteCommand, WriteDataProc WriteData, ResetProc Reset )
Sets up the device structure for use with the SPI bus using user provided callbacks for writing commands, data, and hardware reset.
Note: See ifaces/default_if_spi.c for an example on how this is implemented
- Pointer to object which will be the display device handle
- Width of display
- Height of display
- GPIO Number of reset pin (Optional: Pass -1 if not using a reset pin)
- GPIO Number of chip select pin
- SPI Handle provided by spi_bus_add_device
- Callback to write a command byte over the SPI bus
- Callback to write data bytes over the SPI bus
- Callback to handle hardware reset
True: Device structures were properly allocated and initialized
Note: Because this display is write only we cannot guarantee that the display was ACTUALLY initialized.
A return value of true just means there were no errors during setup of local structures.
SSD1306_HWReset( struct SSD1306_Device* DeviceHandle )
Calls the hardware reset handler provided by the user or the default interface.
If there was no reset pin set, it will return true since it's not required and thus not an error.
Otherwise, it will return whatever value the hardware reset callback returns.