#include <Arduino.h>
#include <HardwareSerial.h>
#define E32_TTL_1W
#define FREQUENCY_868
#include "LoRa_E32.h"
#define LoRa_E32_DEBUG
#define DEBUG_PRINTER Serial
#define Receiver Serial2
uint32_t serialConfig = SERIAL_8N1;
#define rxE32pin 27
#define txE32pin 19
#define M0 33
#define M1 35
#define AUX 34
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
void setup()
{
Serial.begin(115200);
delay(500);
Receiver.begin(9600, SERIAL_8N1, rxE32pin, txE32pin);
delay(500);
LoRa_E32 e32ttl100(&Receiver, AUX, M0, M1);
// Startup all pins and UART
e32ttl100.begin();
ResponseStructContainer c;
c = e32ttl100.getConfiguration();
// It's important get configuration pointer before all other operation
Configuration configuration = *(Configuration *)c.data;
Serial.println(c.status.getResponseDescription());
Serial.println(c.status.code);
printParameters(configuration);
ResponseStructContainer cMi;
cMi = e32ttl100.getModuleInformation();
// It's important get information pointer before all other operation
ModuleInformation mi = *(ModuleInformation *)cMi.data;
Serial.println(cMi.status.getResponseDescription());
Serial.println(cMi.status.code);
printModuleInformation(mi);
c.close();
cMi.close();
}
void loop()
{
}
void printParameters(struct Configuration configuration)
{
Serial.println("----------------------------------------");
Serial.print(F("HEAD BIN: "));
Serial.print(configuration.HEAD, BIN);
Serial.print(" ");
Serial.print(configuration.HEAD, DEC);
Serial.print(" ");
Serial.println(configuration.HEAD, HEX);
Serial.println(F(" "));
Serial.print(F("AddH BIN: "));
Serial.println(configuration.ADDH, BIN);
Serial.print(F("AddL BIN: "));
Serial.println(configuration.ADDL, BIN);
Serial.print(F("Chan BIN: "));
Serial.print(configuration.CHAN, DEC);
Serial.print(" -> ");
Serial.println(configuration.getChannelDescription());
Serial.println(F(" "));
Serial.print(F("SpeedParityBit BIN : "));
Serial.print(configuration.SPED.uartParity, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getUARTParityDescription());
Serial.print(F("SpeedUARTDataRate BIN : "));
Serial.print(configuration.SPED.uartBaudRate, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getUARTBaudRate());
Serial.print(F("SpeedAirDataRate BIN : "));
Serial.print(configuration.SPED.airDataRate, BIN);
Serial.print(" -> ");
Serial.println(configuration.SPED.getAirDataRate());
Serial.print(F("OptionTrans BIN : "));
Serial.print(configuration.OPTION.fixedTransmission, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getFixedTransmissionDescription());
Serial.print(F("OptionPullup BIN : "));
Serial.print(configuration.OPTION.ioDriveMode, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getIODroveModeDescription());
Serial.print(F("OptionWakeup BIN : "));
Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
Serial.print(F("OptionFEC BIN : "));
Serial.print(configuration.OPTION.fec, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getFECDescription());
Serial.print(F("OptionPower BIN : "));
Serial.print(configuration.OPTION.transmissionPower, BIN);
Serial.print(" -> ");
Serial.println(configuration.OPTION.getTransmissionPowerDescription());
Serial.println("----------------------------------------");
}
void printModuleInformation(struct ModuleInformation moduleInformation)
{
Serial.println("----------------------------------------");
Serial.print(F("HEAD BIN: "));
Serial.print(moduleInformation.HEAD, BIN);
Serial.print(" ");
Serial.print(moduleInformation.HEAD, DEC);
Serial.print(" ");
Serial.println(moduleInformation.HEAD, HEX);
Serial.print(F("Freq.: "));
Serial.println(moduleInformation.frequency, HEX);
Serial.print(F("Version : "));
Serial.println(moduleInformation.version, HEX);
Serial.print(F("Features : "));
Serial.println(moduleInformation.features, HEX);
Serial.println("----------------------------------------");
}
Thank's
Claudio, Torino
EByte E32 868T30D reboot loop
Ciao Renzo,
for a particular use case, I need to add an EBYTE 868T30D as LoRa receiver to TTGO T-CALL SIM800L board.
I use PlatformIO with your library