Nol.A SDK Library 26.11.2
For IoT System Software Development
Loading...
Searching...
No Matches
st-nucleo-f429zi/LoRaWAN/main.cpp
#include <cox.h>
#include <algorithm>
#include <LoRaMacKR920SKT.hpp>
#include <ctype.h>
#include "SX1276Wiring.hpp"
#include "usbd_conf.h"
#include "usbd_core.h"
#include "usbd_hid.h"
#include "usbd_desc.h"
SX1276Wiring SX1276 = SX1276Wiring(
Spi,
A0, //Reset
D10, //CS
A4, //RxTx
D2, //DIO0
D3, //DIO1
D4, //DIO2
D5, //DIO3
A3 //DIO4
);
/* In order to measure current in idle mode, define MEASURE_CURRENT_IN_SLEEP below. */
//#define MEASURE_CURRENT_IN_SLEEP
Timer timerHello;
Timer timerSend;
USBD_HandleTypeDef usb;
LoRaMacKR920SKT LoRaWAN = LoRaMacKR920SKT(SX1276);
#define OVER_THE_AIR_ACTIVATION 1
#if (OVER_THE_AIR_ACTIVATION == 1)
static const uint8_t devEui[] = "\x00\x11\x22\x33\x44\x55\x66\x77";
static const uint8_t appEui[] = "\x00\x00\x00\x00\x00\x00\x00\x00";
static const uint8_t appKey[] = "\xf9\x2b\x61\x4f\x43\x20\x1a\x97\xc7\x2a\x12\x7b\x96\x7d\x83\x3c";
#else
static const uint8_t NwkSKey[] = "\xa4\x88\x55\xad\xe9\xf8\xf4\x6f\xa0\x94\xb1\x98\x36\xc3\xc0\x86";
static const uint8_t AppSKey[] = "\x7a\x56\x2a\x75\xd7\xa3\xbd\x89\xa3\xde\x53\xe1\xcf\x7f\x1c\xc7";
static uint32_t DevAddr = 0x06e632e8;
#endif //OVER_THE_AIR_ACTIVATION
static void taskPeriodicSend(void *) {
LoRaMacFrame *f = new LoRaMacFrame(255);
if (!f) {
printf("* Out of memory\n");
return;
}
f->port = 1;
strcpy((char *) f->buf, "Test");
f->len = strlen((char *) f->buf);
/* Uncomment below lines to specify parameters manually. */
// f->freq = 922500000;
// f->modulation = Radio::MOD_LORA;
// f->meta.LoRa.bw = Radio::BW_125kHz;
// f->meta.LoRa.sf = Radio::SF7;
// f->power = 1; /* Index 1 => MaxEIRP - 2 dBm */
f->numTrials = 5;
error_t err = LoRaWAN.send(f);
printf("* Sending periodic report (%p:%s (%u byte)): %d\n", f, f->buf, f->len, err);
if (err != ERROR_SUCCESS) {
delete f;
timerSend.startOneShot(10000);
}
}
static void eventLoRaWANJoin(
bool joined,
const uint8_t *joinedDevEui,
const uint8_t *joinedAppEui,
const uint8_t *joinedAppKey,
const uint8_t *joinedNwkSKey,
const uint8_t *joinedAppSKey,
uint32_t joinedDevAddr,
const RadioPacket &frame,
uint32_t airTime
) {
#if (OVER_THE_AIR_ACTIVATION == 1)
if (joined) {
if (joinedNwkSKey && joinedAppSKey) {
// Status is OK, node has joined the network
printf("* Joined to the network!\n");
postTask(taskPeriodicSend, NULL);
} else {
printf("* PseudoAppKey joining done!\n");
}
} else {
printf("* Join failed. Retry to join\n");
LoRaWAN.beginJoining(devEui, appEui, appKey);
}
#endif
}
static void eventLoRaWANSendDone(LoRaMac &, LoRaMacFrame *frame) {
printf("* Send done(%d): [%p] destined for port[%u], Freq:%lu Hz, Power:%d dBm, # of Tx:%u, ", frame->result, frame, frame->port, frame->freq, frame->power, frame->numTrials);
if (frame->modulation == Radio::MOD_LORA) {
const char *strBW[] = { "Unknown", "125kHz", "250kHz", "500kHz", "Unexpected value" };
if (frame->meta.LoRa.bw > 3) {
frame->meta.LoRa.bw = (Radio::LoRaBW_t) 4;
}
printf("LoRa, SF:%u, BW:%s, ", frame->meta.LoRa.sf, strBW[frame->meta.LoRa.bw]);
} else if (frame->modulation == Radio::MOD_FSK) {
printf("FSK, ");
} else {
printf("Unkndown modulation, ");
}
printf("UNCONFIRMED");
} else if (frame->type == LoRaMacFrame::CONFIRMED) {
printf("CONFIRMED");
} else if (frame->type == LoRaMacFrame::MULTICAST) {
printf("MULTICAST (error)");
} else if (frame->type == LoRaMacFrame::PROPRIETARY) {
printf("PROPRIETARY");
} else {
printf("unknown type");
}
printf(" frame\n");
delete frame;
timerSend.startOneShot(10000);
}
static void eventLoRaWANReceive(LoRaMac &lw, const LoRaMacFrame *frame) {
printf("* Received:");
for (uint8_t i = 0; i < frame->len; i++) {
printf(" %02X", frame->buf[i]);
}
printf(" (");
frame->printTo(Serial);
printf(")\n");
if (
) {
// If there is no pending send frames, send an empty frame to ack or pull more frames.
LoRaMacFrame *emptyFrame = new LoRaMacFrame(0);
if (emptyFrame) {
error_t err = LoRaWAN.send(emptyFrame);
if (err != ERROR_SUCCESS) {
delete emptyFrame;
}
}
}
}
static void eventLoRaWANJoinRequested(LoRaMac &, uint32_t frequencyHz, const LoRaMac::DatarateParams_t &dr) {
printf("* JoinRequested(Frequency: %lu Hz, Modulation: ", frequencyHz);
if (dr.mod == Radio::MOD_FSK) {
printf("FSK\n");
} else if (dr.mod == Radio::MOD_LORA) {
const char *strLoRaBW[] = { "UNKNOWN", "125kHz", "250kHz", "500kHz" };
printf("LoRa, SF:%u, BW:%s\n", dr.param.LoRa.sf, strLoRaBW[dr.param.LoRa.bw]);
}
}
static void eventLoRaWANLinkADRReqReceived(LoRaMac &l, const uint8_t *payload) {
printf("* LoRaWAN LinkADRReq received: [");
for (uint8_t i = 0; i < 4; i++) {
printf(" %02X", payload[i]);
}
printf(" ]\n");
}
static void printChannelInformation(LoRaMac &lw) {
for (uint8_t i = 0; i < lw.MaxNumChannels; i++) {
if (p) {
printf(" - [%u] Frequency:%lu Hz\n", i, p->Frequency);
} else {
printf(" - [%u] disabled\n", i);
}
}
printf(" - Default DR%u:", lw.getCurrentDatarateIndex());
if (dr->mod == Radio::MOD_LORA) {
printf("LoRa(SF%u BW:", dr->param.LoRa.sf);
switch (dr->param.LoRa.bw) {
case Radio::BW_125kHz: printf("125kHz\n"); break;
case Radio::BW_250kHz: printf("250kHz\n"); break;
case Radio::BW_500kHz: printf("500kHz\n"); break;
default: printf("(unexpected:%u)\n", dr->param.LoRa.bw); break;
}
} else if (dr->mod == Radio::MOD_FSK) {
printf("FSK\n");
} else {
printf("Unknown modulation\n");
}
printf(" - Default Tx index: %d\n", lw.getCurrentTxPowerIndex());
printf(
" - # of repetitions of unconfirmed uplink frames: %u\n",
);
}
static void eventLoRaWANLinkADRAnsSent(LoRaMac &l, uint8_t status) {
printf("* LoRaWAN LinkADRAns sent with status 0x%02X.\n", status);
printChannelInformation(l);
}
static void eventLoRaWANDutyCycleReqReceived(LoRaMac &lw, const uint8_t *payload) {
printf("* LoRaWAN DutyCycleReq received: [");
for (uint8_t i = 0; i < 1; i++) {
printf(" %02X", payload[i]);
}
printf(" ]\n");
}
static void eventLoRaWANDutyCycleAnsSent(LoRaMac &lw) {
printf("* LoRaWAN DutyCycleAns sent. Current MaxDCycle is %u.\n", lw.getMaxDutyCycle());
}
static void eventLoRaWANRxParamSetupReqReceived(LoRaMac &lw, const uint8_t *payload) {
printf("* LoRaWAN RxParamSetupReq received: [");
for (uint8_t i = 0; i < 4; i++) {
printf(" %02X", payload[i]);
}
printf(" ]\n");
}
static void eventLoRaWANRxParamSetupAnsSent(LoRaMac &lw, uint8_t status) {
printf("* LoRaWAN RxParamSetupAns sent with status 0x%02X. Current Rx1Offset is %u, and Rx2 channel is (DR%u, %lu Hz).\n", status, lw.getRx1DrOffset(), lw.getRx2Datarate(), lw.getRx2Frequency());
}
static void eventLoRaWANDevStatusReqReceived(LoRaMac &lw) {
printf("* LoRaWAN DevStatusReq received.\n");
}
static void eventLoRaWANDevStatusAnsSent(LoRaMac &lw, uint8_t bat, uint8_t margin) {
printf("* LoRaWAN DevStatusAns sent. (");
if (bat == 0) {
printf("Powered by external power source. ");
} else if (bat == 255) {
printf("Battery level cannot be measured. ");
} else {
printf("Battery: %lu %%. ", map(bat, 1, 254, 0, 100));
}
if (bitRead(margin, 5) == 1) {
margin |= bit(7) | bit(6);
}
printf(" SNR: %d)\n", (int8_t) margin);
}
static void eventLoRaWANNewChannelReqReceived(LoRaMac &lw, const uint8_t *payload) {
printf("* LoRaWAN NewChannelReq received [");
for (uint8_t i = 0; i < 5; i++) {
printf(" %02X", payload[i]);
}
printf(" ]\n");
}
static void eventLoRaWANNewChannelAnsSent(LoRaMac &lw, uint8_t status) {
printf("* LoRaWAN NewChannelAns sent with (Datarate range %s and channel frequency %s).\n", (bitRead(status, 1) == 1) ? "OK" : "NOT OK", (bitRead(status, 0) == 1) ? "OK" : "NOT OK");
for (uint8_t i = 0; i < lw.MaxNumChannels; i++) {
if (p) {
printf(" - [%u] Frequency:%lu Hz\n", i, p->Frequency);
} else {
printf(" - [%u] disabled\n", i);
}
}
}
static void eventLoRaWANRxTimingSetupReqReceived(LoRaMac &lw, const uint8_t *payload) {
printf("* LoRaWAN RxTimingSetupReq received: [");
for (uint8_t i = 0; i < 1; i++) {
printf(" %02X", payload[i]);
}
printf(" ]\n");
}
static void eventLoRaWANRxTimingSetupAnsSent(LoRaMac &lw) {
printf("* LoRaWAN RxTimingSetupAns sent. Current Rx1 delay is %u msec, and Rx2 delay is %u msec.\n", lw.getRx1Delay(), lw.getRx2Delay());
}
static void taskHello(void *) {
Serial.println("Serial) Hello World!");
Serial2.println("Serial2) Hello World!");
}
static void moveCursor(int8_t x, int8_t y) {
uint8_t buf[4];
buf[0] = 0;
buf[1] = x;
buf[2] = y;
buf[3] = 0;
USBD_HID_SendReport(&usb, buf, 4);
}
static void changeClass() {
LoRaMacFrame *f = new LoRaMacFrame(20);
if (f == NULL) {
printf("- Not enough memory\n");
return;
}
if (LoRaWAN.getDeviceClass() == LoRaMac::CLASS_A) {
printf("- Change class A to C\n");
f->len = sprintf((char *) f->buf, "\"class\":\"C\"");
} else {
printf("- Change class C to A\n");
f->len = sprintf((char *) f->buf, "\"class\":\"A\"");
}
f->port = 223;
error_t err = LoRaWAN.send(f);
printf(
"* Sending class configuration message (%s (%u byte)): %d\n",
f->buf, f->len, err
);
if (err == ERROR_SUCCESS) {
if (LoRaWAN.getDeviceClass() == LoRaMac::CLASS_A) {
} else {
}
} else {
delete f;
}
}
static void eventSerialRx(SerialPort &p) {
while (p.available() > 0) {
char c = p.read();
if (isprint(c)) {
p.write(c);
}
switch(c) {
case 'a':
case 'A':
// Left
moveCursor(-5, 0);
break;
case 'w':
case 'W':
// Up
moveCursor(0, -5);
break;
case 's':
case 'S':
// Down
moveCursor(0, 5);
break;
case 'd':
case 'D':
// Right
moveCursor(5, 0);
break;
case 'c':
case 'C':
changeClass();
break;
}
}
}
void setup() {
/* LD3 */
pinMode(PB14, OUTPUT);
digitalWrite(PB14, LOW);
/* LD2 */
pinMode(PB7, OUTPUT);
digitalWrite(PB7, LOW);
Serial.begin(115200);
Serial.println("*** [ST Nucleo-F429ZI] Basic Functions ***");
Serial.onReceive(eventSerialRx);
#ifndef MEASURE_CURRENT_IN_SLEEP
Serial.listen();
#endif
Serial2.begin(115200);
Serial2.println("*** [ST Nucleo-F429ZI] Basic Functions ***");
Serial2.onReceive(eventSerialRx);
#ifndef MEASURE_CURRENT_IN_SLEEP
Serial2.listen();
#endif
USBD_StatusTypeDef s;
if ((s = USBD_Init(&usb, &hid, 0)) != USBD_OK) {
Serial.printf("* USBD_Init() failed: %d\n", s);
return;
}
if ((s = USBD_RegisterClass(&usb, USBD_HID_CLASS)) != USBD_OK) {
Serial.printf("* USBD_RegisterClass() failed: %d\n", s);
return;
}
if ((s = USBD_Start(&usb)) != USBD_OK) {
Serial.printf("* USBD_Start() failed: %d\n", s);
return;
}
timerHello.onFired(taskHello, NULL);
timerHello.startPeriodic(1000);
timerSend.onFired(taskPeriodicSend, NULL);
LoRaWAN.begin();
LoRaWAN.onSendDone(eventLoRaWANSendDone);
LoRaWAN.onReceive(eventLoRaWANReceive);
LoRaWAN.onJoin(eventLoRaWANJoin);
LoRaWAN.onJoinRequested(eventLoRaWANJoinRequested);
LoRaWAN.onLinkADRReqReceived(eventLoRaWANLinkADRReqReceived);
LoRaWAN.onLinkADRAnsSent(eventLoRaWANLinkADRAnsSent);
LoRaWAN.onDutyCycleReqReceived(eventLoRaWANDutyCycleReqReceived);
LoRaWAN.onDutyCycleAnsSent(eventLoRaWANDutyCycleAnsSent);
LoRaWAN.onRxParamSetupReqReceived(eventLoRaWANRxParamSetupReqReceived);
LoRaWAN.onRxParamSetupAnsSent(eventLoRaWANRxParamSetupAnsSent);
LoRaWAN.onDevStatusReqReceived(eventLoRaWANDevStatusReqReceived);
LoRaWAN.onDevStatusAnsSent(eventLoRaWANDevStatusAnsSent);
LoRaWAN.onNewChannelReqReceived(eventLoRaWANNewChannelReqReceived);
LoRaWAN.onNewChannelAnsSent(eventLoRaWANNewChannelAnsSent);
LoRaWAN.onRxTimingSetupReqReceived(eventLoRaWANRxTimingSetupReqReceived);
LoRaWAN.onRxTimingSetupAnsSent(eventLoRaWANRxTimingSetupAnsSent);
LoRaWAN.setPublicNetwork(false);
printChannelInformation(LoRaWAN);
#if (OVER_THE_AIR_ACTIVATION == 0)
printf("ABP!\n");
LoRaWAN.setABP(NwkSKey, AppSKey, DevAddr);
LoRaWAN.setNetworkJoined(true);
postTask(taskPeriodicSend, NULL);
#else
printf("Trying to join\n");
#if 0
LoRaWAN.setNetworkJoined(false);
LoRaWAN.beginJoining(devEui, appEui, appKey);
#else
LoRaWAN.setNetworkJoined(true);
LoRaWAN.beginJoining(devEui, appEui, appKey);
#endif
#endif
}
LoRaWAN frame.
Definition LoRaMac.hpp:88
FrameType_t type
Frame type.
Definition LoRaMac.hpp:102
Radio::LoRaSF_t sf
송신시 사용할, 또는 수신시 사용된 spreading factor
Definition LoRaMac.hpp:189
int16_t power
송신시 사용할 Tx power table index (LoRaMac::MaxTxPower ~ LoRaMac::MinTxPower), 송신 완료 콜백시 출력 세기(단위: dBm) 또는...
Definition LoRaMac.hpp:146
Radio::LoRaBW_t bw
송신시 사용할, 또는 수신시 사용된 bandwidth
Definition LoRaMac.hpp:206
struct LoRaMacFrame::@024007217170142272131231362111253110374345035353::@215311014042340047327077224045033277162306213223 LoRa
modulation 이 Radio::MOD_LORA 인 경우 사용되는 변수
uint8_t numTrials
전송 횟수
Definition LoRaMac.hpp:116
union LoRaMacFrame::@024007217170142272131231362111253110374345035353 meta
변복조 방식에 대한 속성
@ MULTICAST
Definition LoRaMac.hpp:95
@ PROPRIETARY
Definition LoRaMac.hpp:96
@ UNCONFIRMED
Definition LoRaMac.hpp:93
@ CONFIRMED
Definition LoRaMac.hpp:94
uint8_t port
Port number.
Definition LoRaMac.hpp:107
대한민국 920~923MHz 대역을 사용하는 SK 텔레콤용 LoRaMac
Definition LoRaMacKR920SKT.hpp:23
void setABP(const uint8_t *nwkSKey, const uint8_t *appSKey, uint32_t devAddr)
ABP를 사용하도록 설정합니다.
error_t beginJoining(const uint8_t *devEui, const uint8_t *appEui, const uint8_t *appKey)
OTAA Join을 시도합니다.
void setNetworkJoined(bool joined)
SK Telecom Enhanced Provisioning 사용 여부를 결정합니다.
Definition LoRaMac.hpp:272
uint32_t Frequency
Frequency in Hz.
Definition LoRaMac.hpp:277
LoRaWAN 단말 장치들을 위한 MAC 프로토콜
Definition LoRaMac.hpp:253
uint32_t getRx2Frequency()
Rx2에서 사용할 주파수를 가져옵니다.
Definition LoRaMac.hpp:1270
void onRxTimingSetupAnsSent(void(*func)(LoRaMac &))
RxTimingSetupReq MAC command를 수신시 호출될 콜백함수를 지정합니다.
void onNewChannelAnsSent(void(*func)(LoRaMac &, uint8_t status))
NewChannelAns MAC command를 송신시 호출될 콜백함수를 지정합니다.
uint8_t getRx1DrOffset()
Rx1에 적용될 DR offset을 가져옵니다.
Definition LoRaMac.hpp:1286
void onDevStatusReqReceived(void(*func)(LoRaMac &))
DevStatusReq MAC command를 수신시 호출될 콜백함수를 지정합니다.
void onRxTimingSetupReqReceived(void(*func)(LoRaMac &, const uint8_t *))
RxTimingSetupReq MAC command를 수신시 호출될 콜백함수를 지정합니다.
void onRxParamSetupReqReceived(void(*func)(LoRaMac &, const uint8_t *))
RxParamSetupReq MAC command를 수신시 호출될 콜백함수를 지정합니다.
bool framePending
Frame pending.
Definition LoRaMac.hpp:464
DeviceClass_t getDeviceClass()
Device class를 가져옵니다.
virtual error_t begin(uint8_t(*getBatteryLevel)()=NULL)
LoRaMAC layer initialization.
uint8_t getCurrentDatarateIndex()
현재 설정된 기본 datarate 인덱스를 가져옵니다.
uint8_t getRx2Datarate()
Rx2에서 사용할 DR을 가져옵니다.
Definition LoRaMac.hpp:1254
void onJoinRequested(void(*func)(LoRaMac &, uint32_t frequencyHz, const DatarateParams_t &))
JoinRequest 메시지를 보낼 때 호출될 콜백함수를 지정합니다.
uint8_t getMaxDutyCycle()
현재의 최대 duty cycle을 가져옵니다.
void onLinkADRReqReceived(void(*func)(LoRaMac &, const uint8_t *))
LinkADRReq MAC command를 수신시 호출될 콜백함수를 지정합니다.
virtual const ChannelParams_t * getChannel(uint8_t index)=0
채널 정보를 가져옵니다.
uint8_t getNumRepetitions()
현재 설정된 unconfirmed uplink frame에 적용되는 반복 전송 횟수를 가져옵니다.
void onRxParamSetupAnsSent(void(*func)(LoRaMac &, uint8_t status))
RxParamSetupAns MAC command를 송신시 호출될 콜백함수를 지정합니다.
uint8_t getCurrentTxPowerIndex()
기본 Tx power index를 가져옵니다.
uint8_t const MaxNumChannels
최대 채널 수
Definition LoRaMac.hpp:396
void onDevStatusAnsSent(void(*func)(LoRaMac &, uint8_t bat, uint8_t margin))
DevStatusAns MAC command를 송신시 호출될 콜백함수를 지정합니다.
void onDutyCycleReqReceived(void(*func)(LoRaMac &, const uint8_t *))
DutyCycleReq MAC command를 수신시 호출될 콜백함수를 지정합니다.
void onJoin(void(*func)(LoRaMac &mac, bool result, const uint8_t *devEui, const uint8_t *appEui, const uint8_t *appKey, const uint8_t *nwkSKey, const uint8_t *appSKey, uint32_t devAddr, const RadioPacket &frame, uint32_t airTime))
Join이 완료되었을 때 호출될 콜백함수를 지정합니다.
void onSendDone(void(*sendDoneHandler)(LoRaMac &, LoRaMacFrame *))
전송이 완료될 때 호출될 함수를 지정합니다.
void onLinkADRAnsSent(void(*func)(LoRaMac &, uint8_t status))
LinkADRAns MAC command를 송신시 호출될 콜백함수를 지정합니다.
uint16_t getRx1Delay()
Tx 종료 후 Rx1 window가 열릴 때까지의 지연 시간(단위: 밀리초)을 가져옵니다.
@ CLASS_A
LoRaWAN Classs A.
Definition LoRaMac.hpp:259
@ CLASS_C
LoRaWAN Class C.
Definition LoRaMac.hpp:269
error_t setDeviceClass(DeviceClass_t c)
Device class를 설정합니다.
void onDutyCycleAnsSent(void(*func)(LoRaMac &))
DutyCycleAns MAC command를 송신시 호출될 콜백함수를 지정합니다.
void onNewChannelReqReceived(void(*func)(LoRaMac &, const uint8_t *))
NewChannelReq MAC command를 수신시 호출될 콜백함수를 지정합니다.
void setPublicNetwork(bool enable)
공용 LoRaWAN 네트워크를 사용할지 설정합니다.
void onReceive(void(*receiveHandler)(LoRaMac &radio, const LoRaMacFrame *frame))
수신이 완료될 때 호출될 함수를 지정합니다.
const DatarateParams_t * getDatarate(uint8_t index) const
Datarate 정보를 가져옵니다.
uint16_t getRx2Delay()
Tx 종료 후 Rx2 window가 열릴 때까지의 지연 시간(단위: 밀리초)을 가져옵니다.
error_t send(LoRaMacFrame *frame)
frame 을 전송합니다.
uint8_t getNumPendingSendFrames()
전송 대기 중인 프레임 갯수를 구합니다.
무선 패킷
Definition RadioPacket.hpp:59
Radio::Modulation_t modulation
송신시 사용할, 또는 수신시 사용된 변복조 방식
Definition RadioPacket.hpp:160
uint32_t freq
송신시 사용할, 또는 수신시 사용된 주파수 (단위: Hz)
Definition RadioPacket.hpp:143
Result_t result
송신 또는 수신 패킷 처리 결과
Definition RadioPacket.hpp:131
시리얼 포트를 제어하기 위한 클래스
Definition SerialPort.hpp:76
virtual size_t write(uint8_t val)
문자 하나를 출력합니다.
virtual int read()
포트 내부 버퍼에 수신된 문자를 하다 꺼냅니다.
virtual int available()
포트 내부 수신버퍼에 수신된 문자의 갯수를 반환합니다.
Timer는 일정 시간 이후에 1회 실행될 작업, 매 일정 시간마다 실행될 작업 등을 위한 기능입니다.
Definition Timer.hpp:61
bool startOneShot(uint32_t millis, bool interrupt=false)
작업함수를 millis 밀리초 이후 1회 실행합니다.
bool startPeriodic(uint32_t millis, bool interrupt=false)
작업함수를 매 millis 밀리초 주기로 반복하여 실행합니다.
void onFired(void(*func)(void *), void *args=nullptr)
타이머 만료시 실행시킬 작업함수를 지정합니다.
API and definitions.
#define bitRead(v, n)
수의 한 비트를 읽습니다.
Definition nola-common.h:339
#define bit(n)
특정 비트를 구합니다.
Definition nola-common.h:330
long map(long x, long in_min, long in_max, long out_min, long out_max)
수를 어떤 범위에서 다른 범위로 매핑시킵니다.
@ ERROR_SUCCESS
Definition nola-common.h:119
bool digitalWrite(int8_t pin, int value)
pin 를 HIGH 또는 LOW 로 설정합니다.
bool pinMode(int8_t pin, enum ioDirection direction)
pin 을 direction 방향을 갖는 디지털 핀으로 동작하도록 설정합니다.
bool digitalToggle(int8_t pin)
pin 을 토글합니다.
@ OUTPUT
Definition nola-common.h:383
SPI & Spi
SerialPort & Serial2
bool postTask(void(*func)(void *), void *args)
작업을 나중에 실행되도록 게시합니다.
LoRaBW_t
LoRa Bandwidth Type.
Definition Radio.hpp:107
@ BW_250kHz
Definition Radio.hpp:110
@ BW_125kHz
Definition Radio.hpp:109
@ BW_500kHz
Definition Radio.hpp:111
@ MOD_FSK
Definition Radio.hpp:67
@ MOD_LORA
Definition Radio.hpp:68
Definition LoRaMac.hpp:359