mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2026-04-06 06:55:06 +00:00
adding display support and many other stuff
This commit is contained in:
parent
3585af057a
commit
5eec516fb9
35 changed files with 4519 additions and 1479 deletions
42
lib/Display/SSD1306.cpp
Normal file
42
lib/Display/SSD1306.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include "SSD1306.h"
|
||||
|
||||
SSD1306::SSD1306(TwoWire * wire, uint8_t address, OLEDDISPLAY_GEOMETRY g)
|
||||
: OLEDDisplay(g), _wire(wire), _address(address)
|
||||
{
|
||||
sendInitCommands();
|
||||
}
|
||||
|
||||
SSD1306::~SSD1306()
|
||||
{
|
||||
}
|
||||
|
||||
void SSD1306::display(Bitmap * bitmap)
|
||||
{
|
||||
sendCommand(PAGEADDR);
|
||||
sendCommand(0x0);
|
||||
sendCommand(0xFF);
|
||||
|
||||
sendCommand(COLUMNADDR);
|
||||
sendCommand(0x0);
|
||||
sendCommand(getWidth() - 1);
|
||||
|
||||
for (int i = 0; i < getWidth() * getHeight() / 8; )
|
||||
{
|
||||
Wire.beginTransmission(_address);
|
||||
Wire.write(0x40);
|
||||
for (uint8_t x = 0; x < 16; x++)
|
||||
{
|
||||
Wire.write(bitmap->_buffer[i]);
|
||||
i++;
|
||||
}
|
||||
Wire.endTransmission();
|
||||
}
|
||||
}
|
||||
|
||||
void SSD1306::sendCommand(uint8_t command)
|
||||
{
|
||||
_wire->beginTransmission(_address);
|
||||
_wire->write(0x80);
|
||||
_wire->write(command);
|
||||
_wire->endTransmission();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue