[Hell] Update to 5.0.0
This commit is contained in:
parent
727e4b4703
commit
d7701c3ec7
4 changed files with 17 additions and 16 deletions
|
@ -49,7 +49,7 @@ void setup() {
|
|||
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
|
||||
// int state = radio.begin();
|
||||
|
||||
if(state == ERR_NONE) {
|
||||
if(state == RADIOLIB_ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
Serial.print(F("failed, code "));
|
||||
|
@ -62,7 +62,7 @@ void setup() {
|
|||
// base frequency: 434.0 MHz
|
||||
// speed: 122.5 Baud ("Feld Hell")
|
||||
state = hell.begin(434.0);
|
||||
if(state == ERR_NONE) {
|
||||
if(state == RADIOLIB_ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
Serial.print(F("failed, code "));
|
||||
|
|
|
@ -52,7 +52,7 @@ void setup() {
|
|||
// (RF69, CC1101, Si4432 etc.), use the basic begin() method
|
||||
// int state = radio.begin();
|
||||
|
||||
if(state == ERR_NONE) {
|
||||
if(state == RADIOLIB_ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
Serial.print(F("failed, code "));
|
||||
|
@ -65,7 +65,7 @@ void setup() {
|
|||
// AFSK tone frequency: 400 Hz
|
||||
// speed: 122.5 Baud ("Feld Hell")
|
||||
state = hell.begin(400);
|
||||
if(state == ERR_NONE) {
|
||||
if(state == RADIOLIB_ERR_NONE) {
|
||||
Serial.println(F("success!"));
|
||||
} else {
|
||||
Serial.print(F("failed, code "));
|
||||
|
|
|
@ -30,15 +30,16 @@ int16_t HellClient::begin(float base, float rate) {
|
|||
|
||||
size_t HellClient::printGlyph(uint8_t* buff) {
|
||||
// print the character
|
||||
Module* mod = _phy->getMod();
|
||||
for(uint8_t mask = 0x40; mask >= 0x01; mask >>= 1) {
|
||||
for(int8_t i = HELL_FONT_HEIGHT - 1; i >= 0; i--) {
|
||||
uint32_t start = Module::micros();
|
||||
for(int8_t i = RADIOLIB_HELL_FONT_HEIGHT - 1; i >= 0; i--) {
|
||||
uint32_t start = mod->micros();
|
||||
if(buff[i] & mask) {
|
||||
transmitDirect(_base, _baseHz);
|
||||
} else {
|
||||
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
|
||||
uint8_t buff[HELL_FONT_WIDTH];
|
||||
uint8_t buff[RADIOLIB_HELL_FONT_WIDTH];
|
||||
buff[0] = 0x00;
|
||||
for(uint8_t i = 0; i < HELL_FONT_WIDTH - 2; i++) {
|
||||
buff[i + 1] = RADIOLIB_PROGMEM_READ_BYTE(&HellFont[pos][i]);
|
||||
for(uint8_t i = 0; i < RADIOLIB_HELL_FONT_WIDTH - 2; 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
|
||||
return(printGlyph(buff));
|
||||
|
@ -90,7 +91,7 @@ size_t HellClient::print(__FlashStringHelper* fstr) {
|
|||
PGM_P p = reinterpret_cast<PGM_P>(fstr);
|
||||
size_t n = 0;
|
||||
while(true) {
|
||||
char c = RADIOLIB_PROGMEM_READ_BYTE(p++);
|
||||
char c = RADIOLIB_NONVOLATILE_READ_BYTE(p++);
|
||||
if(c == '\0') {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
#include "../AFSK/AFSK.h"
|
||||
|
||||
#define HELL_FONT_WIDTH 7
|
||||
#define HELL_FONT_HEIGHT 7
|
||||
#define RADIOLIB_HELL_FONT_WIDTH 7
|
||||
#define RADIOLIB_HELL_FONT_HEIGHT 7
|
||||
|
||||
// font definition: characters are stored in rows,
|
||||
// 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
|
||||
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
|
||||
{ 0b0001000, 0b0001000, 0b0001000, 0b0000000, 0b0001000 }, // !
|
||||
{ 0b0010100, 0b0010100, 0b0000000, 0b0000000, 0b0000000 }, // "
|
||||
|
@ -149,7 +149,7 @@ class HellClient {
|
|||
size_t println(unsigned long, int = DEC);
|
||||
size_t println(double, int = 2);
|
||||
|
||||
#ifndef RADIOLIB_GODMODE
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
private:
|
||||
#endif
|
||||
PhysicalLayer* _phy;
|
||||
|
|
Loading…
Add table
Reference in a new issue