Radio communication with NRF24

Dependents:   F030

Committer:
gume
Date:
Fri Oct 06 20:17:36 2017 +0000
Revision:
0:9f5a444886a8
Initial release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gume 0:9f5a444886a8 1 #include "NodeConfig.h"
gume 0:9f5a444886a8 2
gume 0:9f5a444886a8 3 #if defined(__AVR_ATmega328P__)
gume 0:9f5a444886a8 4 #include <EEPROM.h>
gume 0:9f5a444886a8 5 #include "Entropy.h"
gume 0:9f5a444886a8 6 #endif
gume 0:9f5a444886a8 7
gume 0:9f5a444886a8 8 uint16_t NodeConfig::getNodeId() {
gume 0:9f5a444886a8 9
gume 0:9f5a444886a8 10 uint16_t id;
gume 0:9f5a444886a8 11
gume 0:9f5a444886a8 12 return id;
gume 0:9f5a444886a8 13 }
gume 0:9f5a444886a8 14
gume 0:9f5a444886a8 15 NodeConfig::NodeConfig(PinName cePin, PinName csnPin) {
gume 0:9f5a444886a8 16
gume 0:9f5a444886a8 17 this->cePin = cePin;
gume 0:9f5a444886a8 18 this->csnPin = csnPin;
gume 0:9f5a444886a8 19
gume 0:9f5a444886a8 20 this->netPrefix = DEFAULT_NETWORK_PREFIX;
gume 0:9f5a444886a8 21 this->syncAddress = DEFAULT_SYNC_ADDRESS;
gume 0:9f5a444886a8 22 this->channel = DEFAULT_RADIO_CHANNEL;
gume 0:9f5a444886a8 23 this->dataRate = DEFAULT_DATA_RATE;
gume 0:9f5a444886a8 24 this->paLevel = DEFAULT_PA_LEVEL;
gume 0:9f5a444886a8 25 this->nodeId = getNodeId();
gume 0:9f5a444886a8 26 this->gwId = DEFAULT_GW_ID;
gume 0:9f5a444886a8 27 }
gume 0:9f5a444886a8 28
gume 0:9f5a444886a8 29 void NodeConfig::setChannel(uint8_t channel) {
gume 0:9f5a444886a8 30 this->channel = channel;
gume 0:9f5a444886a8 31 }
gume 0:9f5a444886a8 32
gume 0:9f5a444886a8 33 void NodeConfig::setSpeed(rf24_datarate_e dataRate) {
gume 0:9f5a444886a8 34 this->dataRate = dataRate;
gume 0:9f5a444886a8 35 }
gume 0:9f5a444886a8 36
gume 0:9f5a444886a8 37 void NodeConfig::setNetPrefix(uint32_t netPrefix) {
gume 0:9f5a444886a8 38 this->netPrefix = netPrefix;
gume 0:9f5a444886a8 39 }
gume 0:9f5a444886a8 40
gume 0:9f5a444886a8 41 void NodeConfig::setNodeId(uint16_t nodeId) {
gume 0:9f5a444886a8 42 this->nodeId = nodeId;
gume 0:9f5a444886a8 43 }
gume 0:9f5a444886a8 44
gume 0:9f5a444886a8 45 void NodeConfig::setGwId(uint16_t gwId) {
gume 0:9f5a444886a8 46 this->gwId = gwId;
gume 0:9f5a444886a8 47 }
gume 0:9f5a444886a8 48
gume 0:9f5a444886a8 49 void NodeConfig::setSyncAddress(uint64_t syncAddress) {
gume 0:9f5a444886a8 50 this->syncAddress = syncAddress;
gume 0:9f5a444886a8 51 }
gume 0:9f5a444886a8 52
gume 0:9f5a444886a8 53