[Hell] Update to 5.0.0

This commit is contained in:
jgromes 2021-11-14 11:39:33 +01:00
parent 727e4b4703
commit d7701c3ec7
4 changed files with 17 additions and 16 deletions

View file

@ -49,7 +49,7 @@ void setup() {
// (RF69, CC1101, Si4432 etc.), use the basic begin() method // (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin(); // int state = radio.begin();
if(state == ERR_NONE) { if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
Serial.print(F("failed, code ")); Serial.print(F("failed, code "));
@ -62,7 +62,7 @@ void setup() {
// base frequency: 434.0 MHz // base frequency: 434.0 MHz
// speed: 122.5 Baud ("Feld Hell") // speed: 122.5 Baud ("Feld Hell")
state = hell.begin(434.0); state = hell.begin(434.0);
if(state == ERR_NONE) { if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
Serial.print(F("failed, code ")); Serial.print(F("failed, code "));

View file

@ -52,7 +52,7 @@ void setup() {
// (RF69, CC1101, Si4432 etc.), use the basic begin() method // (RF69, CC1101, Si4432 etc.), use the basic begin() method
// int state = radio.begin(); // int state = radio.begin();
if(state == ERR_NONE) { if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
Serial.print(F("failed, code ")); Serial.print(F("failed, code "));
@ -65,7 +65,7 @@ void setup() {
// AFSK tone frequency: 400 Hz // AFSK tone frequency: 400 Hz
// speed: 122.5 Baud ("Feld Hell") // speed: 122.5 Baud ("Feld Hell")
state = hell.begin(400); state = hell.begin(400);
if(state == ERR_NONE) { if(state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!")); Serial.println(F("success!"));
} else { } else {
Serial.print(F("failed, code ")); Serial.print(F("failed, code "));

View file

@ -30,15 +30,16 @@ int16_t HellClient::begin(float base, float rate) {
size_t HellClient::printGlyph(uint8_t* buff) { size_t HellClient::printGlyph(uint8_t* buff) {
// print the character // print the character
Module* mod = _phy->getMod();
for(uint8_t mask = 0x40; mask >= 0x01; mask >>= 1) { for(uint8_t mask = 0x40; mask >= 0x01; mask >>= 1) {
for(int8_t i = HELL_FONT_HEIGHT - 1; i >= 0; i--) { for(int8_t i = RADIOLIB_HELL_FONT_HEIGHT - 1; i >= 0; i--) {
uint32_t start = Module::micros(); uint32_t start = mod->micros();
if(buff[i] & mask) { if(buff[i] & mask) {
transmitDirect(_base, _baseHz); transmitDirect(_base, _baseHz);
} else { } else {
standby(); standby();
} }
while(Module::micros() - start < _pixelDuration); while(mod->micros() - start < _pixelDuration);
} }
} }
@ -75,12 +76,12 @@ size_t HellClient::write(uint8_t b) {
} }
// fetch character from flash // fetch character from flash
uint8_t buff[HELL_FONT_WIDTH]; uint8_t buff[RADIOLIB_HELL_FONT_WIDTH];
buff[0] = 0x00; buff[0] = 0x00;
for(uint8_t i = 0; i < HELL_FONT_WIDTH - 2; i++) { for(uint8_t i = 0; i < RADIOLIB_HELL_FONT_WIDTH - 2; i++) {
buff[i + 1] = RADIOLIB_PROGMEM_READ_BYTE(&HellFont[pos][i]); buff[i + 1] = RADIOLIB_NONVOLATILE_READ_BYTE(&HellFont[pos][i]);
} }
buff[HELL_FONT_WIDTH - 1] = 0x00; buff[RADIOLIB_HELL_FONT_WIDTH - 1] = 0x00;
// print the character // print the character
return(printGlyph(buff)); return(printGlyph(buff));
@ -90,7 +91,7 @@ size_t HellClient::print(__FlashStringHelper* fstr) {
PGM_P p = reinterpret_cast<PGM_P>(fstr); PGM_P p = reinterpret_cast<PGM_P>(fstr);
size_t n = 0; size_t n = 0;
while(true) { while(true) {
char c = RADIOLIB_PROGMEM_READ_BYTE(p++); char c = RADIOLIB_NONVOLATILE_READ_BYTE(p++);
if(c == '\0') { if(c == '\0') {
break; break;
} }

View file

@ -8,13 +8,13 @@
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
#define HELL_FONT_WIDTH 7 #define RADIOLIB_HELL_FONT_WIDTH 7
#define HELL_FONT_HEIGHT 7 #define RADIOLIB_HELL_FONT_HEIGHT 7
// font definition: characters are stored in rows, // font definition: characters are stored in rows,
// least significant byte of each character is the first row // least significant byte of each character is the first row
// Hellschreiber use 7x7 characters, but this simplified font uses only 5x5 - the extra bytes aren't stored // Hellschreiber use 7x7 characters, but this simplified font uses only 5x5 - the extra bytes aren't stored
static const uint8_t HellFont[64][HELL_FONT_WIDTH - 2] RADIOLIB_PROGMEM = { static const uint8_t HellFont[64][RADIOLIB_HELL_FONT_WIDTH - 2] RADIOLIB_NONVOLATILE = {
{ 0b0000000, 0b0000000, 0b0000000, 0b0000000, 0b0000000 }, // space { 0b0000000, 0b0000000, 0b0000000, 0b0000000, 0b0000000 }, // space
{ 0b0001000, 0b0001000, 0b0001000, 0b0000000, 0b0001000 }, // ! { 0b0001000, 0b0001000, 0b0001000, 0b0000000, 0b0001000 }, // !
{ 0b0010100, 0b0010100, 0b0000000, 0b0000000, 0b0000000 }, // " { 0b0010100, 0b0010100, 0b0000000, 0b0000000, 0b0000000 }, // "
@ -149,7 +149,7 @@ class HellClient {
size_t println(unsigned long, int = DEC); size_t println(unsigned long, int = DEC);
size_t println(double, int = 2); size_t println(double, int = 2);
#ifndef RADIOLIB_GODMODE #if !defined(RADIOLIB_GODMODE)
private: private:
#endif #endif
PhysicalLayer* _phy; PhysicalLayer* _phy;