Exemplo n.º 1
0
static bool expbrdScan(void)
{
  uint8_t i = 0;
  bool status = false;

  if (owScan(&nBoards))
  {
    DEBUG_PRINT("Found %d memories.\n", nBoards);
  }
  else
  {
    DEBUG_PRINT("Scan [FAILED].\n");
  }

  for (i = 0; i < nBoards; i++)
  {
    if (owRead(i, EXPBRD_OW_ADDR, sizeof(ExpbrdData), (uint8_t *)&expbrdData[i]))
    {
      if (expbrdIsValid(&expbrdData[i]))
      {
        DEBUG_PRINT("Info board %i:\n", i);
        expbrdPrintData(&expbrdData[i]);
        status = true;
      }
    }
    else
    {
      DEBUG_PRINT("Reading board nr:%d [FAILED].\n", i);
    }
  }

  return status;
}
Exemplo n.º 2
0
static bool expbrdScan(void)
{
  uint8_t i = 0;
  bool status = false;
#if 1
  if (owScan(&nBoards))
  {
    DEBUG_PRINT("Found %d memories.\n", nBoards);
  }
  else
  {
    DEBUG_PRINT("Scan [FAILED].\n");
  }


#if 0
  expbrdData[0].header = EXPBRD_ID;
  expbrdData[0].vid    = EXPBRD_VID_BITCRAZE;
  expbrdData[0].pid    = EXPBRD_PID_LEDRING;
  expbrdData[0].crc = crcSlow( (uint8_t *)&expbrdData[0], sizeof(ExpbrdData) - 1);

  status = owWrite(0, EXPBRD_OW_ADDR, sizeof(ExpbrdData), (uint8_t *)&expbrdData[0]);

  if( status == true )
  {
	  DEBUG_PRINT("owWrite LED Ring OK\n");
  }
  else
  {
	  DEBUG_PRINT("owWrite LED Ring Fail\n");
  }
#endif



  for (i = 0; i < nBoards; i++)
  {
    if (owRead(i, EXPBRD_OW_ADDR, sizeof(ExpbrdData), (uint8_t *)&expbrdData[i]))
    {
      if (expbrdIsValid(&expbrdData[i]))
      {
        DEBUG_PRINT("Info board %i:\n", i);
        expbrdPrintData(&expbrdData[i]);
        status = true;
      }
    }
    else
    {
      DEBUG_PRINT("Reading board nr:%d [FAILED].\n", i);
    }
  }
#endif
  /*
  nBoards = 1;
  expbrdData[0].header = EXPBRD_ID;
  expbrdData[0].vid    = EXPBRD_VID_BITCRAZE;
  expbrdData[0].pid    = EXPBRD_PID_LEDRING;
  expbrdData[0].crc = crcSlow( (uint8_t *)&expbrdData[0], sizeof(ExpbrdData) - 1);
  */

  owScan(&nBoards);

  return status;
}