Ejemplo n.º 1
0
/*
** ===================================================================
**     Method      :  CLS1_SendNum8s (component Shell)
**     Description :
**         Sends an 8bit signed number to the given I/O
**     Parameters  :
**         NAME            - DESCRIPTION
**         val             - number to print
**         io              - I/O callbacks to be used for printing.
**     Returns     : Nothing
** ===================================================================
*/
void CLS1_SendNum8s(int8_t val, CLS1_StdIO_OutErr_FctType io)
{
  unsigned char buf[sizeof("-123")];

  UTIL1_Num8sToStr(buf, sizeof(buf), val);
  CLS1_SendStr(buf, io);
}
Ejemplo n.º 2
0
static void RADIO_PrintStatus(const CLS1_StdIOType *io) {
  uint8_t buf[24];
  uint8_t val0, val1;
  int8_t val;
  
  CLS1_SendStatusStr((unsigned char*)"Radio", (unsigned char*)"\r\n", io->stdOut);
  
  CLS1_SendStatusStr((unsigned char*)"  state", RadioStateStr(RADIO_AppStatus), io->stdOut);
  CLS1_SendStr((unsigned char*)"\r\n", io->stdOut);
  
  CLS1_SendStatusStr((unsigned char*)"  sniff", RADIO_isSniffing?(unsigned char*)"yes\r\n":(unsigned char*)"no\r\n", io->stdOut);
  
  (void)RF1_GetChannel(&val0);
  UTIL1_Num8uToStr(buf, sizeof(buf), val0);
  UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n");
  CLS1_SendStatusStr((unsigned char*)"  channel", buf, io->stdOut);

  (void)RF1_GetOutputPower(&val);
  UTIL1_Num8sToStr(buf, sizeof(buf), val);
  UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" dBm\r\n");
  CLS1_SendStatusStr((unsigned char*)"  power", buf, io->stdOut);
 
  (void)RF1_ReadObserveTxRegister(&val0, &val1);
  UTIL1_Num8uToStr(buf, sizeof(buf), val0);
  UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" lost, ");
  UTIL1_strcatNum8u(buf, sizeof(buf), val1);
  UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" retry\r\n");
  CLS1_SendStatusStr((unsigned char*)"  OBSERVE_TX", buf, io->stdOut);
#if 0  /* The RPD status will get reset very fast by another (e.g. WLAN) packet. So this is not really a useful feature :-( */
  (void)RF1_ReadReceivedPowerDetector(&val0); /*! \todo only works in RX mode, but somehow this still does not work? */
  if (val0&1) {
    UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"1, > -64 dBm\r\n");
  } else {
    UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"0, < -64 dBm\r\n");
  }
  CLS1_SendStatusStr((unsigned char*)"  RPD", buf, io->stdOut);
#endif
}