void DW1000RangingClass::startAsAnchor(char address[], const byte mode[]){ //save the address DW1000.convertToByte(address, _currentAddress); //write the address on the DW1000 chip DW1000.setEUI(address); Serial.print("device address: "); Serial.println(address); //we need to define a random short address: randomSeed(analogRead(0)); _currentShortAddress[0]=random(0,256); _currentShortAddress[1]=random(0,256); //we configur the network for mac filtering //(device Address, network ID, frequency) DW1000Ranging.configureNetwork(_currentShortAddress[0]*256+_currentShortAddress[1], 0xDECA, mode); //general start: generalStart(); //defined type as anchor _type=ANCHOR; Serial.println("### ANCHOR ###"); }
void DW1000RangingClass::startAsTag(DW1000Device myDevice, DW1000Device networkDevices[]){ //we copy our network array into _networkDevices memcpy(_networkDevices, networkDevices, sizeof(DW1000Device)); byte address[8]; myDevice.getAddress(address); DW1000.setEUI(address); generalStart(); //defined type as anchor _type=TAG; if(DEBUG){ Serial.println("### START AS TAG ###"); } //we can start to poll: (this is the TAG which start to poll) transmitPoll(); }
void DW1000RangingClass::startAsAnchor(DW1000Device myDevice, DW1000Device networkDevices[]){ //we copy our network array into _networkDevices memcpy(_networkDevices, networkDevices, sizeof(DW1000Device)); //we set the address of our device: byte address[8]; myDevice.getAddress(address); DW1000.setEUI(address); //general start: generalStart(); //defined type as anchor _type=ANCHOR; if(DEBUG){ Serial.println("### START AS ANCHOR ###"); } }