Skip to content

Commit f625936

Browse files
committed
lib update
1 parent 27151f5 commit f625936

File tree

10 files changed

+339
-41
lines changed

10 files changed

+339
-41
lines changed

.pio/libdeps/ambilight/Adafruit GFX Library_ID13/.library.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"type": "git"
66
},
77
"platforms": [
8+
"asrmicro650x",
89
"atmelavr",
910
"atmelmegaavr",
1011
"atmelsam",
@@ -49,6 +50,6 @@
4950
"frameworks": [
5051
"arduino"
5152
],
52-
"version": "1.8.4",
53+
"version": "1.9.0",
5354
"homepage": null
5455
}

.pio/libdeps/ambilight/Adafruit GFX Library_ID13/Adafruit_GFX.cpp

Lines changed: 170 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ void Adafruit_GFX::getTextBounds(const __FlashStringHelper *str, int16_t x,
15291529
@param i True if you want to invert, false to make 'normal'
15301530
*/
15311531
/**************************************************************************/
1532-
void Adafruit_GFX::invertDisplay(boolean i) {
1532+
void Adafruit_GFX::invertDisplay(bool i) {
15331533
// Do nothing, must be subclassed if supported by hardware
15341534
}
15351535

@@ -1661,7 +1661,7 @@ void Adafruit_GFX_Button::initButtonUL(Adafruit_GFX *gfx, int16_t x1,
16611661
'pressed'
16621662
*/
16631663
/**************************************************************************/
1664-
void Adafruit_GFX_Button::drawButton(boolean inverted) {
1664+
void Adafruit_GFX_Button::drawButton(bool inverted) {
16651665
uint16_t fill, outline, text;
16661666

16671667
if (!inverted) {
@@ -1694,7 +1694,7 @@ void Adafruit_GFX_Button::drawButton(boolean inverted) {
16941694
@returns True if within button graphics outline
16951695
*/
16961696
/**************************************************************************/
1697-
boolean Adafruit_GFX_Button::contains(int16_t x, int16_t y) {
1697+
bool Adafruit_GFX_Button::contains(int16_t x, int16_t y) {
16981698
return ((x >= _x1) && (x < (int16_t)(_x1 + _w)) && (y >= _y1) &&
16991699
(y < (int16_t)(_y1 + _h)));
17001700
}
@@ -1705,17 +1705,15 @@ boolean Adafruit_GFX_Button::contains(int16_t x, int16_t y) {
17051705
@returns True if was not-pressed before, now is.
17061706
*/
17071707
/**************************************************************************/
1708-
boolean Adafruit_GFX_Button::justPressed() { return (currstate && !laststate); }
1708+
bool Adafruit_GFX_Button::justPressed() { return (currstate && !laststate); }
17091709

17101710
/**************************************************************************/
17111711
/*!
17121712
@brief Query whether the button was released since we last checked state
17131713
@returns True if was pressed before, now is not.
17141714
*/
17151715
/**************************************************************************/
1716-
boolean Adafruit_GFX_Button::justReleased() {
1717-
return (!currstate && laststate);
1718-
}
1716+
bool Adafruit_GFX_Button::justReleased() { return (!currstate && laststate); }
17191717

17201718
// -------------------------------------------------------------------------
17211719

@@ -1736,6 +1734,14 @@ boolean Adafruit_GFX_Button::justReleased() {
17361734
// scanline pad).
17371735
// NOT EXTENSIVELY TESTED YET. MAY CONTAIN WORST BUGS KNOWN TO HUMANKIND.
17381736

1737+
#ifdef __AVR__
1738+
// Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR
1739+
const uint8_t PROGMEM GFXcanvas1::GFXsetBit[] = {0x80, 0x40, 0x20, 0x10,
1740+
0x08, 0x04, 0x02, 0x01};
1741+
const uint8_t PROGMEM GFXcanvas1::GFXclrBit[] = {0x7F, 0xBF, 0xDF, 0xEF,
1742+
0xF7, 0xFB, 0xFD, 0xFE};
1743+
#endif
1744+
17391745
/**************************************************************************/
17401746
/*!
17411747
@brief Instatiate a GFX 1-bit canvas context for graphics
@@ -1765,18 +1771,10 @@ GFXcanvas1::~GFXcanvas1(void) {
17651771
@brief Draw a pixel to the canvas framebuffer
17661772
@param x x coordinate
17671773
@param y y coordinate
1768-
@param color 16-bit 5-6-5 Color to fill with
1774+
@param color Binary (on or off) color to fill with
17691775
*/
17701776
/**************************************************************************/
17711777
void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) {
1772-
#ifdef __AVR__
1773-
// Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR
1774-
static const uint8_t PROGMEM GFXsetBit[] = {0x80, 0x40, 0x20, 0x10,
1775-
0x08, 0x04, 0x02, 0x01},
1776-
GFXclrBit[] = {0x7F, 0xBF, 0xDF, 0xEF,
1777-
0xF7, 0xFB, 0xFD, 0xFE};
1778-
#endif
1779-
17801778
if (buffer) {
17811779
if ((x < 0) || (y < 0) || (x >= _width) || (y >= _height))
17821780
return;
@@ -1814,10 +1812,67 @@ void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) {
18141812
}
18151813
}
18161814

1815+
/**********************************************************************/
1816+
/*!
1817+
@brief Get the pixel color value at a given coordinate
1818+
@param x x coordinate
1819+
@param y y coordinate
1820+
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0
1821+
(off)
1822+
*/
1823+
/**********************************************************************/
1824+
bool GFXcanvas1::getPixel(int16_t x, int16_t y) const {
1825+
int16_t t;
1826+
switch (rotation) {
1827+
case 1:
1828+
t = x;
1829+
x = WIDTH - 1 - y;
1830+
y = t;
1831+
break;
1832+
case 2:
1833+
x = WIDTH - 1 - x;
1834+
y = HEIGHT - 1 - y;
1835+
break;
1836+
case 3:
1837+
t = x;
1838+
x = y;
1839+
y = HEIGHT - 1 - t;
1840+
break;
1841+
}
1842+
return getRawPixel(x, y);
1843+
}
1844+
1845+
/**********************************************************************/
1846+
/*!
1847+
@brief Get the pixel color value at a given, unrotated coordinate.
1848+
This method is intended for hardware drivers to get pixel value
1849+
in physical coordinates.
1850+
@param x x coordinate
1851+
@param y y coordinate
1852+
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0
1853+
(off)
1854+
*/
1855+
/**********************************************************************/
1856+
bool GFXcanvas1::getRawPixel(int16_t x, int16_t y) const {
1857+
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
1858+
return 0;
1859+
if (this->getBuffer()) {
1860+
uint8_t *buffer = this->getBuffer();
1861+
uint8_t *ptr = &buffer[(x / 8) + y * ((WIDTH + 7) / 8)];
1862+
1863+
#ifdef __AVR__
1864+
return ((*ptr) & pgm_read_byte(&GFXsetBit[x & 7])) != 0;
1865+
#else
1866+
return ((*ptr) & (0x80 >> (x & 7))) != 0;
1867+
#endif
1868+
}
1869+
return 0;
1870+
}
1871+
18171872
/**************************************************************************/
18181873
/*!
18191874
@brief Fill the framebuffer completely with one color
1820-
@param color 16-bit 5-6-5 Color to fill with
1875+
@param color Binary (on or off) color to fill with
18211876
*/
18221877
/**************************************************************************/
18231878
void GFXcanvas1::fillScreen(uint16_t color) {
@@ -1856,7 +1911,7 @@ GFXcanvas8::~GFXcanvas8(void) {
18561911
@brief Draw a pixel to the canvas framebuffer
18571912
@param x x coordinate
18581913
@param y y coordinate
1859-
@param color 16-bit 5-6-5 Color to fill with
1914+
@param color 8-bit Color to fill with. Only lower byte of uint16_t is used.
18601915
*/
18611916
/**************************************************************************/
18621917
void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) {
@@ -1886,10 +1941,58 @@ void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) {
18861941
}
18871942
}
18881943

1944+
/**********************************************************************/
1945+
/*!
1946+
@brief Get the pixel color value at a given coordinate
1947+
@param x x coordinate
1948+
@param y y coordinate
1949+
@returns The desired pixel's 8-bit color value
1950+
*/
1951+
/**********************************************************************/
1952+
uint8_t GFXcanvas8::getPixel(int16_t x, int16_t y) const {
1953+
int16_t t;
1954+
switch (rotation) {
1955+
case 1:
1956+
t = x;
1957+
x = WIDTH - 1 - y;
1958+
y = t;
1959+
break;
1960+
case 2:
1961+
x = WIDTH - 1 - x;
1962+
y = HEIGHT - 1 - y;
1963+
break;
1964+
case 3:
1965+
t = x;
1966+
x = y;
1967+
y = HEIGHT - 1 - t;
1968+
break;
1969+
}
1970+
return getRawPixel(x, y);
1971+
}
1972+
1973+
/**********************************************************************/
1974+
/*!
1975+
@brief Get the pixel color value at a given, unrotated coordinate.
1976+
This method is intended for hardware drivers to get pixel value
1977+
in physical coordinates.
1978+
@param x x coordinate
1979+
@param y y coordinate
1980+
@returns The desired pixel's 8-bit color value
1981+
*/
1982+
/**********************************************************************/
1983+
uint8_t GFXcanvas8::getRawPixel(int16_t x, int16_t y) const {
1984+
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
1985+
return 0;
1986+
if (buffer) {
1987+
return buffer[x + y * WIDTH];
1988+
}
1989+
return 0;
1990+
}
1991+
18891992
/**************************************************************************/
18901993
/*!
18911994
@brief Fill the framebuffer completely with one color
1892-
@param color 16-bit 5-6-5 Color to fill with
1995+
@param color 8-bit Color to fill with. Only lower byte of uint16_t is used.
18931996
*/
18941997
/**************************************************************************/
18951998
void GFXcanvas8::fillScreen(uint16_t color) {
@@ -1995,6 +2098,54 @@ void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) {
19952098
}
19962099
}
19972100

2101+
/**********************************************************************/
2102+
/*!
2103+
@brief Get the pixel color value at a given coordinate
2104+
@param x x coordinate
2105+
@param y y coordinate
2106+
@returns The desired pixel's 16-bit 5-6-5 color value
2107+
*/
2108+
/**********************************************************************/
2109+
uint16_t GFXcanvas16::getPixel(int16_t x, int16_t y) const {
2110+
int16_t t;
2111+
switch (rotation) {
2112+
case 1:
2113+
t = x;
2114+
x = WIDTH - 1 - y;
2115+
y = t;
2116+
break;
2117+
case 2:
2118+
x = WIDTH - 1 - x;
2119+
y = HEIGHT - 1 - y;
2120+
break;
2121+
case 3:
2122+
t = x;
2123+
x = y;
2124+
y = HEIGHT - 1 - t;
2125+
break;
2126+
}
2127+
return getRawPixel(x, y);
2128+
}
2129+
2130+
/**********************************************************************/
2131+
/*!
2132+
@brief Get the pixel color value at a given, unrotated coordinate.
2133+
This method is intended for hardware drivers to get pixel value
2134+
in physical coordinates.
2135+
@param x x coordinate
2136+
@param y y coordinate
2137+
@returns The desired pixel's 16-bit 5-6-5 color value
2138+
*/
2139+
/**********************************************************************/
2140+
uint16_t GFXcanvas16::getRawPixel(int16_t x, int16_t y) const {
2141+
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
2142+
return 0;
2143+
if (buffer) {
2144+
return buffer[x + y * WIDTH];
2145+
}
2146+
return 0;
2147+
}
2148+
19982149
/**************************************************************************/
19992150
/*!
20002151
@brief Fill the framebuffer completely with one color

0 commit comments

Comments
 (0)