Radio communication with NRF24
Diff: NodeConfig.cpp
- Revision:
- 0:9f5a444886a8
diff -r 000000000000 -r 9f5a444886a8 NodeConfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NodeConfig.cpp Fri Oct 06 20:17:36 2017 +0000 @@ -0,0 +1,53 @@ +#include "NodeConfig.h" + +#if defined(__AVR_ATmega328P__) +#include <EEPROM.h> +#include "Entropy.h" +#endif + +uint16_t NodeConfig::getNodeId() { + + uint16_t id; + + return id; +} + +NodeConfig::NodeConfig(PinName cePin, PinName csnPin) { + + this->cePin = cePin; + this->csnPin = csnPin; + + this->netPrefix = DEFAULT_NETWORK_PREFIX; + this->syncAddress = DEFAULT_SYNC_ADDRESS; + this->channel = DEFAULT_RADIO_CHANNEL; + this->dataRate = DEFAULT_DATA_RATE; + this->paLevel = DEFAULT_PA_LEVEL; + this->nodeId = getNodeId(); + this->gwId = DEFAULT_GW_ID; +} + +void NodeConfig::setChannel(uint8_t channel) { + this->channel = channel; +} + +void NodeConfig::setSpeed(rf24_datarate_e dataRate) { + this->dataRate = dataRate; +} + +void NodeConfig::setNetPrefix(uint32_t netPrefix) { + this->netPrefix = netPrefix; +} + +void NodeConfig::setNodeId(uint16_t nodeId) { + this->nodeId = nodeId; +} + +void NodeConfig::setGwId(uint16_t gwId) { + this->gwId = gwId; +} + +void NodeConfig::setSyncAddress(uint64_t syncAddress) { + this->syncAddress = syncAddress; +} + +