Radio communication with NRF24
Embed:
(wiki syntax)
Show/hide line numbers
NodeConfig.h
00001 #ifndef __NODECONFIG_H_ 00002 #define __NODECONFIG_H_ 00003 00004 //#include <Arduino.h> 00005 #include "RF24.h" 00006 00007 00008 #define DEFAULT_NETWORK_PREFIX 0x424D45L // All network node has a common 3 byte address prefix 00009 #define DEFAULT_NODE_ADDRESS 0x424D455555L 00010 #define DEFAULT_SYNC_ADDRESS 0x3333333333L 00011 #define DEFAULT_GW_ID 0x0000 00012 #define DEFAULT_RADIO_CHANNEL 96 00013 #define DEFAULT_PA_LEVEL RF24_PA_MAX 00014 #define DEFAULT_DATA_RATE RF24_2MBPS 00015 00016 class SSRadio; 00017 00018 class NodeConfig { 00019 friend class SSRadio; 00020 00021 private: 00022 uint32_t netPrefix; 00023 uint16_t nodeId; 00024 uint16_t gwId; 00025 uint64_t syncAddress; 00026 00027 uint8_t channel; // Radio channel 00028 rf24_pa_dbm_e paLevel; // PA level 00029 rf24_datarate_e dataRate; // The transmission speed 00030 00031 PinName cePin; // CE pin 00032 PinName csnPin; // CS pin 00033 00034 public: 00035 NodeConfig(PinName _cepin, PinName _cspin); 00036 00037 void setNodeId(uint16_t nodeId); 00038 void setGwId(uint16_t gwId); 00039 void setNetPrefix(uint32_t netPrefix); 00040 void setSyncAddress(uint64_t syncAddress); 00041 void setChannel(uint8_t channel); 00042 void setSpeed(rf24_datarate_e dataRate); 00043 00044 uint16_t getNodeId(); // Returns ID from EEPROM or UinqID. If no ID in EEPROM, then create one 00045 }; 00046 00047 #endif // NODECONFIG_H
Generated on Thu Jul 21 2022 05:52:22 by 1.7.2