Updated dev files for RadioLib 3.x
This commit is contained in:
parent
030ea09c17
commit
97136945a7
5 changed files with 25 additions and 25 deletions
|
@ -8,16 +8,17 @@ int16_t SIM800::begin(long speed) {
|
|||
// set module properties
|
||||
_mod->AtLineFeed = "\r\n";
|
||||
_mod->baudrate = speed;
|
||||
_mod->init(USE_UART, INT_0);
|
||||
_mod->init(RADIOLIB_USE_UART);
|
||||
Module::pinMode(_mod->getIrq(), INPUT);
|
||||
|
||||
// empty UART buffer (garbage data)
|
||||
_mod->ATemptyBuffer();
|
||||
|
||||
// power on
|
||||
pinMode(_mod->getInt0(), OUTPUT);
|
||||
digitalWrite(_mod->getInt0(), LOW);
|
||||
Module::pinMode(_mod->getIrq(), OUTPUT);
|
||||
Module::digitalWrite(_mod->getIrq(), LOW);
|
||||
delay(1000);
|
||||
pinMode(_mod->getInt0(), INPUT);
|
||||
Module::pinMode(_mod->getIrq(), INPUT);
|
||||
|
||||
// test AT setup
|
||||
if(!_mod->ATsendCommand("AT")) {
|
||||
|
@ -34,10 +35,10 @@ int16_t SIM800::begin(long speed) {
|
|||
|
||||
void SIM800::shutdown() {
|
||||
// power off
|
||||
pinMode(_mod->getInt0(), OUTPUT);
|
||||
digitalWrite(_mod->getInt0(), LOW);
|
||||
delay(1500);
|
||||
pinMode(_mod->getInt0(), INPUT);
|
||||
Module::pinMode(_mod->getIrq(), OUTPUT);
|
||||
Module::digitalWrite(_mod->getIrq(), LOW);
|
||||
delay(1000);
|
||||
Module::pinMode(_mod->getIrq(), INPUT);
|
||||
}
|
||||
|
||||
int16_t SIM800::sendSMS(const char* num, const char* msg) {
|
||||
|
|
|
@ -43,8 +43,7 @@ int16_t PSKClient::begin(int pin, float carrier, float rate, uint16_t audioFreq)
|
|||
_bitDuration = (uint32_t)(1000000.0/rate);
|
||||
|
||||
// calculate 24-bit frequency
|
||||
uint32_t mult = 1;
|
||||
_carrier = (carrier * (mult << _phy->getDivExponent())) / _phy->getCrystalFreq();
|
||||
_carrier = (carrier * 1000000.0) / _phy->getFreqStep();
|
||||
|
||||
// set FSK frequency deviation to 0
|
||||
int16_t state = _phy->setFrequencyDeviation(0);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _KITELIB_PSK_H
|
||||
#define _KITELIB_PSK_H
|
||||
|
||||
#include "TypeDef.h"
|
||||
#include "PhysicalLayer.h"
|
||||
#include "../../TypeDef.h"
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
|
||||
// Varicode character table: - position in table corresponds to ASCII code
|
||||
// - value in table corresponds to Varicode code
|
||||
|
@ -142,41 +142,41 @@ class VaricodeString {
|
|||
VaricodeString(char c);
|
||||
VaricodeString(const char* str);
|
||||
~VaricodeString();
|
||||
|
||||
|
||||
size_t length();
|
||||
uint16_t* byteArr();
|
||||
|
||||
|
||||
private:
|
||||
char* _str;
|
||||
size_t _len;
|
||||
|
||||
|
||||
uint16_t getBits(char c);
|
||||
};
|
||||
|
||||
class PSKClient {
|
||||
public:
|
||||
PSKClient(PhysicalLayer* phy);
|
||||
|
||||
|
||||
// basic methods
|
||||
int16_t begin(int pin, float base, float rate = 31.25, uint16_t audioFreq = 400);
|
||||
size_t write(uint16_t* buff, size_t len);
|
||||
size_t write(uint16_t code);
|
||||
|
||||
|
||||
size_t print(VaricodeString &);
|
||||
size_t print(const char[]);
|
||||
|
||||
|
||||
size_t println(void);
|
||||
size_t println(VaricodeString &);
|
||||
size_t println(const char[]);
|
||||
|
||||
|
||||
private:
|
||||
PhysicalLayer* _phy;
|
||||
|
||||
|
||||
int _pin;
|
||||
uint16_t _audioFreq;
|
||||
uint32_t _carrier;
|
||||
uint16_t _bitDuration;
|
||||
|
||||
|
||||
void mark();
|
||||
void space();
|
||||
};
|
||||
|
|
|
@ -9,10 +9,10 @@ int16_t PagerClient::begin(float base, uint16_t speed) {
|
|||
_bitDuration = (uint32_t)1000000/speed;
|
||||
|
||||
// calculate 24-bit frequency
|
||||
_base = (base * (uint32_t(1) << _phy->getDivExponent())) / _phy->getCrystalFreq();
|
||||
_base = (base * 1000000.0) / _phy->getFreqStep();
|
||||
|
||||
// calculate module carrier frequency resolution
|
||||
uint16_t step = round((_phy->getCrystalFreq() * 1000000) / (uint32_t(1) << _phy->getDivExponent()));
|
||||
uint16_t step = round(_phy->getFreqStep());
|
||||
|
||||
// calculate raw frequency shift
|
||||
_shift = FREQ_SHIFT_HZ/step;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef _RADIOLIB_PAGER_H
|
||||
#define _RADIOLIB_PAGER_H
|
||||
|
||||
#include "TypeDef.h"
|
||||
#include "PhysicalLayer.h"
|
||||
#include "../../TypeDef.h"
|
||||
#include "../PhysicalLayer/PhysicalLayer.h"
|
||||
|
||||
// supported encoding schemes
|
||||
#define ASCII 0
|
||||
|
|
Loading…
Add table
Reference in a new issue