void ob_setNetID( unsigned char* nid ) {
	char i;
	for(i=0; i<NETID_SIZE; i++) {
		ob_int_mgmt.NetID[i]=nid[i];
	}

	nRFAPI_SetTxMAC( ob_int_mgmt.NetID, NETID_SIZE);
	nRFAPI_SetRxMAC( ob_int_mgmt.NetID, NETID_SIZE, ob_int_mgmt.Pipes);
}
Exemple #2
0
unsigned char nRFAPI_Init(
    unsigned char channel,
    const unsigned char *mac,
    unsigned char mac_size,
    unsigned char features
)
{
    unsigned char i;

    // init lower layer
    nRFCMD_Init();

    // check validity
    if(	mac_size<3 ||
            mac_size>5 ||
            !nRFAPI_DetectChip()
      )
        return 0;

    // update mac
    nRFAPI_SetSizeMac(mac_size);
    nRFAPI_SetTxMAC(mac,mac_size);

    // enables pipe
    nRFAPI_SetRxMAC(mac,mac_size,0);
    nRFAPI_PipesEnable(ERX_P0);
    nRFAPI_PipesAck(0);

    // set payload sizes
    for(i=0; i<=5; i++)
        nRFAPI_SetPipeSizeRX(i,2);

    // set TX retry count
    nRFAPI_TxRetries(0);

    // set selected channel
    nRFAPI_SetChannel(channel);

    // set Tx power
    nRFAPI_SetTxPower(3);

    // flush FIFOs
    nRFAPI_FlushRX();
    nRFAPI_FlushTX();

    nRFAPI_SetRxMode(0);

    if(features != 0)
        nRFAPI_SetFeatures(features);

    return 1;
}
static void
PtUpdateWmcuId (unsigned char broadcast)
{
    /* update jamming data channel id */
    if (broadcast)
        nRFAPI_SetTxMAC (broadcast_mac, sizeof (broadcast_mac));
    else
    {
        jam_mac[sizeof (jam_mac) - 1] = env.e.mcu_id;
        nRFAPI_SetTxMAC (jam_mac, sizeof (jam_mac));
    }

    /* update WMCU id for response channel */
    wmcu_mac[sizeof (wmcu_mac) - 1] = env.e.mcu_id;
    nRFAPI_SetRxMAC (wmcu_mac, sizeof (wmcu_mac), 1);
}
Exemple #4
0
uint8_t
nRFAPI_Init (uint8_t channel,
	     const uint8_t * mac, uint8_t mac_size, uint8_t features)
{
  uint8_t i;

  // init IO layer of nRF24L01
  nRFCMD_Init ();

  /* wait for nRF to boot */
  pmu_sleep_ms(10);

  // check validity
  if (mac_size < 3 || mac_size > 5 || !nRFAPI_DetectChip ())
    return 0;

  // update mac
  nRFAPI_SetSizeMac (mac_size);
  nRFAPI_SetTxMAC (mac, mac_size);

  // enables pipe
  nRFAPI_SetRxMAC (mac, mac_size, 0);
  nRFAPI_PipesEnable (ERX_P0);
  nRFAPI_PipesAck (0);

  // set payload sizes
  for (i = 0; i <= 5; i++)
    nRFAPI_SetPipeSizeRX (i, 16);

  // set TX retry count
  nRFAPI_TxRetries (0);

  // set selected channel
  nRFAPI_SetChannel (channel);

  // set Tx power
  nRFAPI_SetTxPower (3);

  // flush FIFOs
  nRFAPI_FlushRX ();
  nRFAPI_FlushTX ();

  if (features != 0)
    nRFAPI_SetFeatures (features);

  return 1;
}