本文整理汇总了C++中CLS1_GetStdio函数的典型用法代码示例。如果您正苦于以下问题:C++ CLS1_GetStdio函数的具体用法?C++ CLS1_GetStdio怎么用?C++ CLS1_GetStdio使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CLS1_GetStdio函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: APP_OnKeyPressed
void APP_OnKeyPressed(uint8_t keys) {
if (keys&1) {
CLS1_SendStr((uint8_t*)"SW3 pressed!\r\n", CLS1_GetStdio()->stdOut);
} else if (keys&2) {
CLS1_SendStr((uint8_t*)"SW2 pressed!\r\n", CLS1_GetStdio()->stdOut);
}
}
示例2: TestFlash
/**
* \brief Method to test the flash chip.
* @return void
*/
static void TestFlash(void) {
uint8_t errCode;
uint8_t test=55;
uint8_t result=27;
uint32_t testAddr=0x0000F300;
uint8_t status=1;
FLASH_Init();
WAIT1_Waitms(1000);
errCode = FLASH_ReadStatusReg(&status);
if(errCode!=ERR_OK) {
for(;;) {}
}
CLS1_SendStr((const unsigned char*)"\r\nStatus: ",CLS1_GetStdio()->stdOut);
CLS1_SendNum16u(status,CLS1_GetStdio()->stdOut);
for(;;) {}
errCode = FLASH_WriteByte(testAddr,&test);
if(errCode!=ERR_OK) {
for(;;) {}
}
errCode = FLASH_ReadByte(testAddr,&result);
if(errCode!=ERR_OK) {
for(;;) {}
}
CLS1_SendStr((const unsigned char*)"\r\nOutput: ",CLS1_GetStdio()->stdOut);
CLS1_SendNum16u(result,CLS1_GetStdio()->stdOut);
}
示例3: APP_OnKeyReleasedLong
void APP_OnKeyReleasedLong(uint8_t keys) {
if (keys&1) {
CLS1_SendStr((uint8_t*)"SW3 long released!\r\n", CLS1_GetStdio()->stdOut);
} else if (keys&2) {
CLS1_SendStr((uint8_t*)"SW2 long released!\r\n", CLS1_GetStdio()->stdOut);
}
}
示例4: portTASK_FUNCTION
static portTASK_FUNCTION(ShellTask, pvParameters) {
#if PL_HAS_SD_CARD
bool cardMounted = FALSE;
static FAT1_FATFS fileSystemObject;
#endif
unsigned char buf[48];
(void)pvParameters; /* not used */
buf[0] = '\0';
(void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable);
for(;;) {
#if PL_HAS_SD_CARD
(void)FAT1_CheckCardPresence(&cardMounted,
0 /* volume */, &fileSystemObject, CLS1_GetStdio());
if (cardMounted) {
//SD_GreenLed_On();
//SD_RedLed_Off();
} else {
//SD_GreenLed_Off();
//SD_RedLed_On();
}
#endif
(void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable);
FRTOS1_vTaskDelay(50/portTICK_RATE_MS);
LEDG_Neg();
}
}
示例5: Radio_StdIOSendChar
static void Radio_StdIOSendChar(byte ch) {
#define TX_BUF_SIZE (RADIO_MAX_TX_DATA_SIZE-sizeof("stdout ")) /* data size we can transmit in one message */
unsigned char buf[TX_BUF_SIZE+sizeof("stdout ")];
uint8_t i;
CLS1_GetStdio()->stdOut(ch); /* copy on local shell */
if (RadioTx_Put(ch)!=ERR_OK) {
/* lost character */
}
if (ch=='\n' || RadioTx_NofElements()>TX_BUF_SIZE) { /* send string over radio */
UTIL1_strcpy(buf, sizeof(buf), (unsigned char*)"stdout ");
i = sizeof("stdout ")-1;
while (i<sizeof(buf) && RadioTx_Get(&buf[i])==ERR_OK) {
i++;
}
if (RADIO_SendData(buf, i)!=ERR_OK) {
CLS1_GetStdio()->stdOut('\n');
CLS1_GetStdio()->stdOut('*');
CLS1_GetStdio()->stdOut('F');
CLS1_GetStdio()->stdOut('A');
CLS1_GetStdio()->stdOut('I');
CLS1_GetStdio()->stdOut('L');
CLS1_GetStdio()->stdOut('*');
CLS1_GetStdio()->stdOut('\n');
}
}
}
示例6: portTASK_FUNCTION
static portTASK_FUNCTION(ShellTask, pvParameters) {
unsigned char buf[48];
(void)pvParameters; /* not used */
buf[0] = '\0';
(void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable);
for(;;) {
(void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable);
FRTOS1_vTaskDelay(pdMS_TO_TICKS(10));
}
}
示例7: portTASK_FUNCTION
static portTASK_FUNCTION(ShellTask, pvParameters) {
unsigned char buf[32];
(void)pvParameters; /* not used */
buf[0] = '\0';
(void)CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable);
for(;;) {
(void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable);
FRTOS1_vTaskDelay(50/portTICK_RATE_MS);
LEDG_Neg();
}
}
示例8: SHELL_Run
void SHELL_Run(void) {
unsigned char buf[32];
unsigned char bTbuf[32];
buf[0]='\0';
bTbuf[0]='\0';
CLS1_ParseWithCommandTable((unsigned char*)CLS1_CMD_HELP, CLS1_GetStdio(), CmdParserTable);
for(;;) {
(void)CLS1_ReadAndParseWithCommandTable(buf, sizeof(buf), CLS1_GetStdio(), CmdParserTable);
(void)CLS1_ReadAndParseWithCommandTable(bTbuf, sizeof(bTbuf), &BT_stdio, CmdParserTable);
}
}
示例9: REF_Calibrate
void REF_Calibrate(bool start) {
if (start) {
isCalibrated = FALSE;
REF_InitSensorValues();
doMinMaxCalibration = TRUE;
CLS1_SendStr((unsigned char*)"start calibration...\r\n", CLS1_GetStdio()->stdOut);
} else {
doMinMaxCalibration = FALSE;
isCalibrated = TRUE;
CLS1_SendStr((unsigned char*)"calibration stopped.\r\n", CLS1_GetStdio()->stdOut);
}
}
示例10: REF_DumpHistory
void REF_DumpHistory(void) {
int i;
unsigned char buf[16];
CLS1_SendStr((unsigned char*)"history: #", CLS1_GetStdio()->stdOut);
CLS1_SendNum16u(REF_nofHistory, CLS1_GetStdio()->stdOut);
for (i=0;i<REF_NOF_SENSORS;i++) {
CLS1_SendStr((unsigned char*)" 0x", CLS1_GetStdio()->stdOut);
buf[0] = '\0'; UTIL1_strcatNum16Hex(buf, sizeof(buf), SensorHistory[i]);
CLS1_SendStr(buf, CLS1_GetStdio()->stdOut);
}
CLS1_SendStr((unsigned char*)"\r\n", CLS1_GetStdio()->stdOut);
}
示例11: WiznetSetup
static void WiznetSetup(void) {
CLS1_SendStr((unsigned char*)"Reset W5100.\r\n", CLS1_GetStdio()->stdOut);
/* reset device */
if (W5100_MemWriteByte(W5100_MR, W5100_MR_BIT_RST)!=ERR_OK) {
CLS1_SendStr((unsigned char*)"Failed to reset device!\r\n", CLS1_GetStdio()->stdErr);
}
CLS1_SendStr((unsigned char*)"Configure network.\r\n", CLS1_GetStdio()->stdOut);
/* configure network: IP address, gateway, netmask, MAC */
if (W5100_WriteConfig((w5100_config_t*)&W5100_config)!=ERR_OK) {
CLS1_SendStr((unsigned char*)"Failed to set Net Configuration!\r\n", CLS1_GetStdio()->stdErr);
}
CLS1_SendStr((unsigned char*)"Configure RX/TX memory.\r\n", CLS1_GetStdio()->stdOut);
/* we have 8 KByte we can use for the RX and TX sockets: */
if (W5100_MemWriteByte(W5100_RMSR,
W5100_xMSR_SOCKET_1_MEM_SIZE_2KB
|W5100_xMSR_SOCKET_2_MEM_SIZE_2KB
|W5100_xMSR_SOCKET_3_MEM_SIZE_2KB
|W5100_xMSR_SOCKET_4_MEM_SIZE_2KB
)!=ERR_OK)
{
CLS1_SendStr((unsigned char*)"Failed to set RX socket memory size!\r\n", CLS1_GetStdio()->stdErr);
}
if (W5100_MemWriteByte(W5100_TMSR,
W5100_xMSR_SOCKET_1_MEM_SIZE_2KB
|W5100_xMSR_SOCKET_2_MEM_SIZE_2KB
|W5100_xMSR_SOCKET_3_MEM_SIZE_2KB
|W5100_xMSR_SOCKET_4_MEM_SIZE_2KB
)!=ERR_OK)
{
CLS1_SendStr((unsigned char*)"Failed to set TX socket memory size!\r\n", CLS1_GetStdio()->stdErr);
}
CLS1_SendStr((unsigned char*)"done!\r\n", CLS1_GetStdio()->stdOut);
}
示例12: WriteUltraLight
static void WriteUltraLight(Uid *uid) {
MFRC522_StatusCode status;
uint8_t data[4] = {0x1, 0x2, 0x3, 0x4};
PICC_Type piccType = MFRC522_PICC_GetType(uid->sak);
if (piccType != PICC_TYPE_MIFARE_UL) {
CLS1_SendStr("Only works with MIFARE Ultralight cards!\r\n", CLS1_GetStdio()->stdErr);
return;
}
status = MFRC522_MIFARE_Ultralight_Write(2, data, sizeof(data));
if (status!=STATUS_OK) {
CLS1_SendStr("Failed writing!\r\n", CLS1_GetStdio()->stdErr);
}
}
示例13: SHELL_SendString
void SHELL_SendString(unsigned char *msg) {
#if PL_CONFIG_HAS_SHELL_QUEUE
SQUEUE_SendString(msg);
#else
CLS1_SendStr(msg, CLS1_GetStdio()->stdOut);
#endif
}
示例14: APP_Run
void APP_Run(void) {
DHTxx_ErrorCode res;
uint16_t temperature, humidity;
CLS1_ConstStdIOType *io = CLS1_GetStdio();
uint8_t buf[48];
#if DHTxx_SENSOR_TYPE_IS_DHT11
CLS1_SendStr("DHT11 Sensor Demo:\r\n", io->stdErr);
#else
CLS1_SendStr("DHT22 Sensor Demo:\r\n", io->stdErr);
#endif
WAIT1_Waitms(1000); /* wait one second after power-up to get the sensor stable */
for(;;) {
res = DHTxx_Read(&temperature, &humidity);
if (res!=DHTxx_OK) { /* error */
LEDR_Neg(); /* indicate error with red LED */
/* write error message */
CLS1_SendStr("ERROR: ", io->stdErr);
CLS1_SendStr(DHTxx_GetReturnCodeString(res), io->stdErr);
CLS1_SendStr("\r\n", io->stdErr);
} else { /* ok! */
LEDG_Neg();
/* write data values */
UTIL1_strcpy(buf, sizeof(buf), "Temperature ");
UTIL1_strcatNum32sDotValue100(buf, sizeof(buf), (int32_t)temperature);
UTIL1_strcat(buf, sizeof(buf), "°C, Humidity ");
UTIL1_strcatNum32sDotValue100(buf, sizeof(buf), (int32_t)humidity);
UTIL1_strcat(buf, sizeof(buf), "%\r\n");
CLS1_SendStr(buf, io->stdOut);
}
WAIT1_Waitms(DHTxx_SENSOR_PERIOD_MS); /* can only read sensor values with a certain frequency! */
}
}
示例15: portTASK_FUNCTION
static portTASK_FUNCTION(TraceTask, pvParameters) {
static unsigned char buf[128]; /* global buffer, to reduce stack size. We want to send things in one piece */
(void)pvParameters;
for(;;) {
if (traceChannel==TRACE_TO_NONE) {
FRTOS1_vTaskDelay(1000/portTICK_RATE_MS);
} else if (traceChannel==TRACE_TO_SHELL) {
buf[0] = '\0';
UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" => ");
if (traceAccel) {
int16_t x, y, z;
ACCEL_GetValues(&x, &y, &z);
UTIL1_strcat(buf, sizeof(buf), (unsigned char*)" X:");
UTIL1_strcatNum16sFormatted(buf, sizeof(buf), x, ' ', 6);
UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"; Y:");
UTIL1_strcatNum16sFormatted(buf, sizeof(buf), y, ' ', 6);
UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"; Z:");
UTIL1_strcatNum16sFormatted(buf, sizeof(buf), z, ' ', 6);
UTIL1_strcat(buf, sizeof(buf), (unsigned char*)"\r\n");
CLS1_SendStr(&buf[0], CLS1_GetStdio()->stdOut);
FRTOS1_vTaskDelay(100/portTICK_RATE_MS);
}
FRTOS1_vTaskDelay(25/portTICK_RATE_MS);
}
}
}