Skip to content

Commit

Permalink
#45
Browse files Browse the repository at this point in the history
  • Loading branch information
moononournation committed Jan 10, 2024
1 parent fb5bbc9 commit 72f5fe6
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 36 deletions.
2 changes: 1 addition & 1 deletion examples/ImgViewer/ImgViewerPng/ImgViewerPng.ino
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void setup()
gfx->fillScreen(BLACK);
for (int16_t x = 0; x < w; x += 5)
{
gfx->drawFastVLine(x, 0, h, PINK);
gfx->drawFastVLine(x, 0, h, PALERED);
}

#ifdef GFX_BL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ int32_t testText()
gfx->println(F("Size 8"));

gfx->setTextSize(9);
gfx->setTextColor(PINK);
gfx->setTextColor(PALERED);
gfx->println(F("Size 9"));

return micros() - start;
Expand Down
2 changes: 1 addition & 1 deletion examples/PDQgraphicstest/PDQgraphicstest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ int32_t testText()
gfx->println(F("Size 8"));

gfx->setTextSize(9);
gfx->setTextColor(PINK);
gfx->setTextColor(PALERED);
gfx->println(F("Size 9"));

return micros() - start;
Expand Down
4 changes: 2 additions & 2 deletions src/Arduino_GFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
#define RGB565_WHITE RGB565(255, 255, 255)
#define RGB565_ORANGE RGB565(255, 165, 0)
#define RGB565_GREENYELLOW RGB565(173, 255, 41)
#define RGB565_PINK RGB565(255, 130, 198)
#define RGB565_PALERED RGB565(255, 130, 198)

// Color definitions
#ifndef DISABLE_COLOR_DEFINES
Expand All @@ -72,7 +72,7 @@
#define WHITE RGB565_WHITE
#define ORANGE RGB565_ORANGE
#define GREENYELLOW RGB565_GREENYELLOW
#define PINK RGB565_PINK
#define PALERED RGB565_PALERED
#endif

// Many (but maybe not all) non-AVR board installs define macros
Expand Down
8 changes: 4 additions & 4 deletions src/databus/Arduino_Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void Arduino_Wire::write(uint8_t d)
_wire->write(d);
}

void Arduino_Wire::writeCommand(uint8_t c)
void Arduino_Wire::writeCommand(uint8_t)
{
// println("Wire::writeCommand()");
// not implemented.
Expand Down Expand Up @@ -85,19 +85,19 @@ void Arduino_Wire::writePixels(uint16_t *, uint32_t)
}

#if !defined(LITTLE_FOOT_PRINT)
void Arduino_Wire::writeBytes(uint8_t *data, uint32_t len)
void Arduino_Wire::writeBytes(uint8_t *, uint32_t)
{
// println("Wire::writeBytes()");
// not implemented
}
#endif // !defined(LITTLE_FOOT_PRINT)

void Arduino_Wire::writeRegister(uint8_t reg, uint8_t *data, size_t len)
void Arduino_Wire::writeRegister(uint8_t, uint8_t *, size_t)
{
// println("Wire::writeRegister()");
}

uint8_t Arduino_Wire::readRegister(uint8_t reg, uint8_t *data, size_t len)
uint8_t Arduino_Wire::readRegister(uint8_t, uint8_t *, size_t)
{
// println("Wire::readRegister()");
return 0;
Expand Down
47 changes: 31 additions & 16 deletions src/databus/Arduino_XCA9554SWSPI.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "Arduino_XCA9554SWSPI.h"

//#define XCA9554_DEBUG
// #define XCA9554_DEBUG

Arduino_XCA9554SWSPI::Arduino_XCA9554SWSPI(int8_t rst, int8_t cs, int8_t sck, int8_t mosi, TwoWire *wire, uint8_t i2c_addr)
: _rst(rst), _cs(cs), _sck(sck), _mosi(mosi), _wire(wire), _i2c_addr(i2c_addr)
: _rst(rst), _cs(cs), _sck(sck), _mosi(mosi), _wire(wire), _i2c_addr(i2c_addr)
{
}

Expand Down Expand Up @@ -71,14 +71,16 @@ void Arduino_XCA9554SWSPI::writeCommand(uint8_t c)
{
if (c & bit)
{
if (last_databit != 1) {
if (last_databit != 1)
{
last_databit = 1;
this->digitalWrite(_mosi, last_databit);
}
}
else
{
if (last_databit != 0) {
if (last_databit != 0)
{
last_databit = 0;
this->digitalWrite(_mosi, last_databit);
}
Expand All @@ -102,14 +104,20 @@ void Arduino_XCA9554SWSPI::write(uint8_t d)
this->digitalWrite(_sck, 1);

uint8_t bit = 0x80;
while (bit) {
if (d & bit) {
if (last_databit != 1) {
while (bit)
{
if (d & bit)
{
if (last_databit != 1)
{
last_databit = 1;
this->digitalWrite(_mosi, last_databit);
}
} else {
if (last_databit != 0) {
}
else
{
if (last_databit != 0)
{
last_databit = 0;
this->digitalWrite(_mosi, last_databit);
}
Expand All @@ -130,7 +138,7 @@ void Arduino_XCA9554SWSPI::writeRepeat(uint16_t, uint32_t)
// not implemented
}

void Arduino_XCA9554SWSPI::writeBytes(uint8_t *data, uint32_t len)
void Arduino_XCA9554SWSPI::writeBytes(uint8_t *, uint32_t)
{
// not implemented
}
Expand Down Expand Up @@ -171,7 +179,8 @@ uint8_t Arduino_XCA9554SWSPI::readRegister(uint8_t reg, uint8_t *data, size_t le
_wire->endTransmission();
_wire->requestFrom(_i2c_addr, len);
size_t index = 0;
while (index < len) {
while (index < len)
{
data[index++] = _wire->read();
#ifdef XCA9554_DEBUG
// printf("0x%02X, ", data[index-1]);
Expand All @@ -189,13 +198,18 @@ void Arduino_XCA9554SWSPI::pinMode(uint8_t pin, uint8_t mode)
{
uint8_t port = 0;
this->readRegister(XCA9554_CONFIG_PORT_REG, &port, 1);
if (mode == OUTPUT) {
if (mode == OUTPUT)
{
port &= ~(1UL << pin);
} else {
}
else
{
port |= (1UL << pin);
}
this->writeRegister(XCA9554_CONFIG_PORT_REG, &port, 1);
} else {
}
else
{
// println("xCA9554 not found");
}
}
Expand All @@ -207,7 +221,8 @@ void Arduino_XCA9554SWSPI::digitalWrite(uint8_t pin, uint8_t val)
uint8_t reg_data = output_buf;

reg_data &= ~(1UL << pin);
if (val == HIGH) {
if (val == HIGH)
{
reg_data |= (1UL << pin);
}
this->writeRegister(XCA9554_OUTPUT_PORT_REG, &reg_data, 1);
Expand All @@ -226,7 +241,7 @@ int Arduino_XCA9554SWSPI::digitalRead(uint8_t pin)
uint8_t port = 0;
this->readRegister(XCA9554_INPUT_PORT_REG, &port, 1);
// printf("Read 0x%02X\n", port);
return(port & (1UL << pin)) ? HIGH : LOW;
return (port & (1UL << pin)) ? HIGH : LOW;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/databus/Arduino_XL9535SWSPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void Arduino_XL9535SWSPI::writeRepeat(uint16_t, uint32_t)
// not implemented
}

void Arduino_XL9535SWSPI::writeBytes(uint8_t *data, uint32_t len)
void Arduino_XL9535SWSPI::writeBytes(uint8_t *, uint32_t)
{
// not implemented
}
Expand Down
21 changes: 11 additions & 10 deletions src/display/Arduino_SSD1306.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,14 @@ bool Arduino_SSD1306::begin(int32_t speed)
return true;
}

void Arduino_SSD1306::setBrightness(uint8_t brightness){
// _sendCommand(SSD1306_SETCONTRAST);
// ??? _sendCommand((brightness < 50) ? 0 : _contrast); ???
// _sendCommand((brightness < 50) ? 0 : 0x8f);
}; // setBrightness
void Arduino_SSD1306::setBrightness(uint8_t /* brightness */)
{
// _sendCommand(SSD1306_SETCONTRAST);
// ??? _sendCommand((brightness < 50) ? 0 : _contrast); ???
// _sendCommand((brightness < 50) ? 0 : 0x8f);
}

void Arduino_SSD1306::drawBitmap(int16_t xStart, int16_t yStart, uint8_t *bitmap, int16_t w, int16_t h, uint16_t color, uint16_t bg)
void Arduino_SSD1306::drawBitmap(int16_t xStart, int16_t yStart, uint8_t *bitmap, int16_t w, int16_t h, uint16_t /* color */, uint16_t /* bg */)
{
printf("SSD1306::drawBitmap %d/%d w:%d h:%d\n", xStart, yStart, w, h);
uint16_t bufferLength = TWI_BUFFER_LENGTH;
Expand Down Expand Up @@ -152,7 +153,7 @@ void Arduino_SSD1306::drawBitmap(int16_t xStart, int16_t yStart, uint8_t *bitmap
_bus->write(SSD1306_COLUMNADDR);
_bus->write(_colStart);
_bus->write(_colEnd);
// set column
// set column
_bus->endWrite();

// send out page data
Expand Down Expand Up @@ -187,7 +188,7 @@ void Arduino_SSD1306::drawIndexedBitmap(int16_t, int16_t, uint8_t *, uint16_t *,
// println("SSD1306::Not Implemented drawIndexedBitmap()");
}

void Arduino_SSD1306::draw3bitRGBBitmap(int16_t, int16_t, uint8_t *bitmap, int16_t w, int16_t h)
void Arduino_SSD1306::draw3bitRGBBitmap(int16_t, int16_t, uint8_t *, int16_t, int16_t)
{
// println("SSD1306::Not Implemented draw3bitRGBBitmap()");
}
Expand All @@ -202,9 +203,9 @@ void Arduino_SSD1306::draw24bitRGBBitmap(int16_t, int16_t, uint8_t *, int16_t, i
// println("SSD1306::Not Implemented draw24bitRGBBitmap()");
}

void Arduino_SSD1306::invertDisplay(bool i)
void Arduino_SSD1306::invertDisplay(bool)
{
// _bus->sendCommand(i ? ILI9488_INVON : ILI9488_INVOFF);
// println("SSD1306::Not Implemented invertDisplay()");
}

void Arduino_SSD1306::displayOn(void)
Expand Down

0 comments on commit 72f5fe6

Please sign in to comment.