Exemplo n.º 1
0
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 ###");
    
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
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 ###");
    }
}