Radio communication with NRF24

Dependents:   F030

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NodeConfig.cpp Source File

NodeConfig.cpp

00001 #include "NodeConfig.h"
00002 
00003 #if defined(__AVR_ATmega328P__) 
00004 #include <EEPROM.h>
00005 #include "Entropy.h"
00006 #endif
00007 
00008 uint16_t NodeConfig::getNodeId() {
00009 
00010   uint16_t id;
00011   
00012   return id;
00013 }
00014 
00015 NodeConfig::NodeConfig(PinName cePin, PinName csnPin) {
00016 
00017     this->cePin = cePin;
00018     this->csnPin = csnPin;
00019     
00020     this->netPrefix = DEFAULT_NETWORK_PREFIX;
00021     this->syncAddress = DEFAULT_SYNC_ADDRESS;
00022     this->channel = DEFAULT_RADIO_CHANNEL;
00023     this->dataRate = DEFAULT_DATA_RATE;
00024     this->paLevel = DEFAULT_PA_LEVEL;
00025     this->nodeId = getNodeId();
00026     this->gwId = DEFAULT_GW_ID;
00027 }
00028 
00029 void NodeConfig::setChannel(uint8_t channel) {
00030     this->channel = channel;
00031 }
00032 
00033 void NodeConfig::setSpeed(rf24_datarate_e dataRate) {
00034     this->dataRate = dataRate;
00035 }
00036 
00037 void NodeConfig::setNetPrefix(uint32_t netPrefix) {
00038   this->netPrefix = netPrefix;
00039 }
00040 
00041 void NodeConfig::setNodeId(uint16_t nodeId) {
00042   this->nodeId = nodeId;
00043 }
00044 
00045 void NodeConfig::setGwId(uint16_t gwId) {
00046   this->gwId = gwId;
00047 }
00048 
00049 void NodeConfig::setSyncAddress(uint64_t syncAddress) {
00050     this->syncAddress = syncAddress;
00051 }
00052 
00053