apps/tag_mesh/src/main.c
static void 
slot_cb(struct dpl_event *ev){
    assert(ev);
    tdma_slot_t * slot = (tdma_slot_t *) dpl_event_get_arg(ev);
    tdma_instance_t * tdma = slot->parent;
    uint16_t idx = slot->idx;
    struct uwb_rng_instance *rng = (struct uwb_rng_instance*)slot->arg;

    hal_gpio_toggle(LED_BLINK_PIN);  
    uint64_t dx_time = tdma_tx_slot_start(tdma, idx) & 0xFFFFFFFFFE00UL;
  
    /* Range with the clock master by default */
    struct uwb_ccp_instance *ccp = tdma->ccp;
    uint16_t node_address = ccp->frames[0]->short_address;

    /* Select single-sided or double sided twr every second slot */    
    int mode = DWT_DS_TWR_EXT;
    //if (slot->idx%2==0) {
    //mode = DWT_SS_TWR_EXT;
        //}
    uwb_rng_request_delay_start(rng, node_address, dx_time, mode);
}
/*! 
 * @fn slot_cb(struct os_event * ev)
 *
 * @brief In this example slot_cb is used to initiate a range request. The slot_cb is scheduled 
 * MYNEWT_VAL(OS_LATENCY) in advance of the transmit epoch and a delayed start request is issued in advance of 
 * the required epoch. The transmission timing is controlled precisely by the DW1000 with the transmission time 
 * defined by the value of the dw_time variable. If the OS_LATENCY value is set too small the range request 
 * function will report a start_tx_error. In a synchronized network, the node device switches the transceiver 
 * to receiver mode for the same epoch; and will either receive the inbound frame or timeout after the frame 
 * duration as elapsed. This ensures that the transceiver is in receive mode for the minimum time required.   
 *
 * input parameters
 * @param inst - struct os_event *  
 *
 * output parameters
 *
 * returns none 
 */
@fn slot_cb(struct os_event * ev)
@brief In this example slot_cb is used to initiate a range request. The slot_cb is scheduled
MYNEWT_VAL(OS_LATENCY) in advance of the transmit epoch and a delayed start request is issued in advance of
the required epoch. The transmission timing is controlled precisely by the DW1000 with the transmission time
defined by the value of the dw_time variable. If the OS_LATENCY value is set too small the range request
function will report a start_tx_error. In a synchronized network, the node device switches the transceiver
to receiver mode for the same epoch; and will either receive the inbound frame or timeout after the frame
duration as elapsed. This ensures that the transceiver is in receive mode for the minimum time required.

input parameters
@param inst - struct os_event

output parameters

returns none
@fn slot_cb ( struct os_event * ev ) @brief In this example slot_cb is used to initiate a range request . The slot_cb is scheduled MYNEWT_VAL ( OS_LATENCY ) in advance of the transmit epoch and a delayed start request is issued in advance of the required epoch . The transmission timing is controlled precisely by the DW1000 with the transmission time defined by the value of the dw_time variable . If the OS_LATENCY value is set too small the range request function will report a start_tx_error . In a synchronized network the node device switches the transceiver to receiver mode for the same epoch ; and will either receive the inbound frame or timeout after the frame duration as elapsed . This ensures that the transceiver is in receive mode for the minimum time required . input parameters @param inst - struct os_event output parameters returns none
static void 
slot_cb(struct dpl_event *ev){
    assert(ev);
    tdma_slot_t * slot = (tdma_slot_t *) dpl_event_get_arg(ev);
    tdma_instance_t * tdma = slot->parent;
    uint16_t idx = slot->idx;
    struct uwb_rng_instance *rng = (struct uwb_rng_instance*)slot->arg;
    hal_gpio_toggle(LED_BLINK_PIN);  
    uint64_t dx_time = tdma_tx_slot_start(tdma, idx) & 0xFFFFFFFFFE00UL;
    struct uwb_ccp_instance *ccp = tdma->ccp;
    uint16_t node_address = ccp->frames[0]->short_address;
    int mode = DWT_DS_TWR_EXT;
    uwb_rng_request_delay_start(rng, node_address, dx_time, mode);
}
static void slot_cb ( struct dpl_event * ev ) { assert ( ev ) ; tdma_slot_t * slot = ( tdma_slot_t * ) dpl_event_get_arg ( ev ) ; tdma_instance_t * tdma = slot -> parent ; uint16_t idx = slot -> idx ; struct uwb_rng_instance * rng = ( struct uwb_rng_instance * ) slot -> arg ; hal_gpio_toggle ( LED_BLINK_PIN ) ; uint64_t dx_time = tdma_tx_slot_start ( tdma , idx ) & 0xFFFFFFFFFE00UL ; struct uwb_ccp_instance * ccp = tdma -> ccp ; uint16_t node_address = ccp -> frames [ 0 ] -> short_address ; int mode = DWT_DS_TWR_EXT ; uwb_rng_request_delay_start ( rng , node_address , dx_time , mode ) ; }
@fn slot_cb(struct os_event * ev)
 @brief In this example slot_cb is used to initiate a range request.
@fn slot_cb ( struct os_event * ev ) @brief In this example slot_cb is used to initiate a range request .
/* Range with the clock master by default */ /* Select single-sided or double sided twr every second slot */ //if (slot->idx%2==0) { //mode = DWT_SS_TWR_EXT; //}