void arduino_loop(void) { #ifdef TARGET_COO vDelayMsec(100); suli_uart_printf(NULL, NULL, "random:%d\r\n", random()); #elif TARGET_ROU uint8 tmp[sizeof(tsApiSpec)]={0}; tsApiSpec apiSpec; int16 temper = suli_analog_read(temp_pin); sprintf(tmp, "R-HeartBeat:%ld\r\n", temper); PCK_vApiSpecDataFrame(&apiSpec, 0xec, 0x00, tmp, strlen(tmp)); /* Air to Coordinator */ uint16 size = i32CopyApiSpec(&apiSpec, tmp); if(API_bSendToAirPort(UNICAST, 0x0000, tmp, size)) { suli_uart_printf(NULL, NULL, "<HeartBeat%d>\r\n", random()); } #else /* Finish user job */ static jobCnt = 0; uint8 tmp[sizeof(tsApiSpec)]={0}; tsApiSpec apiSpec; int16 temper = suli_analog_read(temp_pin); sprintf(tmp, "E-HeartBeat:%ld\r\n", temper); PCK_vApiSpecDataFrame(&apiSpec, 0xec, 0x00, tmp, strlen(tmp)); /* Air to Coordinator */ uint16 size = i32CopyApiSpec(&apiSpec, tmp); if(API_bSendToAirPort(UNICAST, 0x0000, tmp, size)) { suli_uart_printf(NULL, NULL, "<HeartBeat%d>\r\n", jobCnt); jobCnt++; } if(10 == jobCnt) { jobCnt = 0; Sleep(3000); } #endif }
/* * write an integer * num - number to write */ void suli_uart_write_int(void *uart_device, int16 uart_num, int32 num) { suli_uart_printf(uart_device, uart_num, "%ld", num); }