47 lines
997 B
C++
47 lines
997 B
C++
#include <Arduino.h>
|
|
#include <RFM69.h>
|
|
#include <SPI.h>
|
|
|
|
#define SERIAL_BAUD 115200
|
|
|
|
using namespace Codingfield::Communication;
|
|
|
|
SPIClass spi(HSPI);
|
|
std::unique_ptr<CodingField::Communication::RFM69> radio;
|
|
|
|
void setup() {
|
|
Serial.begin(SERIAL_BAUD);
|
|
delay(10);
|
|
Serial.println("Init started");
|
|
|
|
spi.begin();
|
|
radio.reset(new RFM69($spi, 15));
|
|
|
|
if(radio->IsRfm69()) {
|
|
auto temperature = radio->ReadTemperature();
|
|
Serial.println("Temp: " + String(temperature));
|
|
|
|
radio->SetOperatingMode(RFM69::Standby);
|
|
radio->SetDataModulation(RFM69::ModulationShapings::NoShaping,
|
|
RFM69::ModulationTypes::FSK,
|
|
RFM69DataModes::Packet);
|
|
radio->setBitRate(0x0116); // 115200
|
|
radio->setFrequencyDevian(0x047C); // 70kHz
|
|
radio->setFrequency(0x00d913e8); // 915.25MHz
|
|
|
|
radio->SetOperatingMode();
|
|
|
|
|
|
|
|
} else {
|
|
Serial.println("No RFM69 found");
|
|
}
|
|
|
|
Serial.println("Starting loop()");
|
|
}
|
|
|
|
void loop() {
|
|
delay(1000);
|
|
Serial.println("Loop");
|
|
}
|