[Hell] Added method to invert text color (#529)
This commit is contained in:
parent
2faa4b5d71
commit
ed43f8062e
4 changed files with 22 additions and 1 deletions
|
@ -90,6 +90,12 @@ void loop() {
|
||||||
// string saved in flash
|
// string saved in flash
|
||||||
hell.print(F("Flash String"));
|
hell.print(F("Flash String"));
|
||||||
|
|
||||||
|
// in AFSK mode, it is possible to invert the text colors
|
||||||
|
// use white text on black background
|
||||||
|
hell.setInversion(true);
|
||||||
|
hell.print("Inverted String");
|
||||||
|
hell.setInversion(false);
|
||||||
|
|
||||||
// character
|
// character
|
||||||
hell.print('c');
|
hell.print('c');
|
||||||
|
|
||||||
|
|
|
@ -223,6 +223,7 @@ getRangingResult KEYWORD2
|
||||||
|
|
||||||
# Hellschreiber
|
# Hellschreiber
|
||||||
printGlyph KEYWORD2
|
printGlyph KEYWORD2
|
||||||
|
setInversion KEYWORD2
|
||||||
|
|
||||||
# AFSK
|
# AFSK
|
||||||
tone KEYWORD2
|
tone KEYWORD2
|
||||||
|
|
|
@ -49,6 +49,10 @@ size_t HellClient::printGlyph(uint8_t* buff) {
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HellClient::setInversion(bool invert) {
|
||||||
|
_inv = invert;
|
||||||
|
}
|
||||||
|
|
||||||
size_t HellClient::write(const char* str) {
|
size_t HellClient::write(const char* str) {
|
||||||
if(str == NULL) {
|
if(str == NULL) {
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -295,7 +299,7 @@ int16_t HellClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
|
||||||
int16_t HellClient::standby() {
|
int16_t HellClient::standby() {
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
if(_audio != nullptr) {
|
if(_audio != nullptr) {
|
||||||
return(_audio->noTone());
|
return(_audio->noTone(_inv));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return(_phy->standby());
|
return(_phy->standby());
|
||||||
|
|
|
@ -119,9 +119,18 @@ class HellClient {
|
||||||
\brief Method to "print" a buffer of pixels, this is exposed to allow users to send custom characters.
|
\brief Method to "print" a buffer of pixels, this is exposed to allow users to send custom characters.
|
||||||
|
|
||||||
\param buff Buffer of pixels to send, in a 7x7 pixel array.
|
\param buff Buffer of pixels to send, in a 7x7 pixel array.
|
||||||
|
|
||||||
|
\returns Always returns the number of printed glyphs (1).
|
||||||
*/
|
*/
|
||||||
size_t printGlyph(uint8_t* buff);
|
size_t printGlyph(uint8_t* buff);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Invert text color.
|
||||||
|
|
||||||
|
\param invert Whether to enable color inversion (white text on black background), or not (black text on white background)
|
||||||
|
*/
|
||||||
|
void setInversion(bool invert);
|
||||||
|
|
||||||
size_t write(const char* str);
|
size_t write(const char* str);
|
||||||
size_t write(uint8_t* buff, size_t len);
|
size_t write(uint8_t* buff, size_t len);
|
||||||
size_t write(uint8_t b);
|
size_t write(uint8_t b);
|
||||||
|
@ -159,6 +168,7 @@ class HellClient {
|
||||||
|
|
||||||
uint32_t _base = 0, _baseHz = 0;
|
uint32_t _base = 0, _baseHz = 0;
|
||||||
uint32_t _pixelDuration = 0;
|
uint32_t _pixelDuration = 0;
|
||||||
|
bool _inv = false;
|
||||||
|
|
||||||
size_t printNumber(unsigned long, uint8_t);
|
size_t printNumber(unsigned long, uint8_t);
|
||||||
size_t printFloat(double, uint8_t);
|
size_t printFloat(double, uint8_t);
|
||||||
|
|
Loading…
Add table
Reference in a new issue