static void _gps_task(void *arg) { u8_t size; u8_t marker; u8_t type[5]; u8_t body[128]; nmeaINFO info; //GPS解码后得到的信息 nmeaPARSER parser; //解码时使用的数据结构 nmea_zero_INFO(&info); //初始化NMEA数据结构体 nmea_parser_init(&parser);//初始化NMEA数据结构体 _gps_init(); os_driver_ioctl(_gps_dev, SET_EMPTY_FIFO, 0); // 清空接收缓冲队列 OS_RTT_printf(0, "GPS Task implementation \n"); while (1) { memset((void *) &marker, 0, sizeof(marker)); size = _gps_read(&marker, 1); if (size == 0) { msleep(200); continue; } if (marker != '$') continue; memset((void *) &type, 0, sizeof(type)); _gps_read((u8_t *) type, 5); OS_RTT_printf(0, "Type:%s \n", type); if (type[0] != 'G' || type[1] != 'N' || type[2] != 'Z' || type[3] != 'D' || type[4] != 'A') { continue; } else { _gps_read((u8_t *) body, 27); OS_RTT_printf(0, "Rec:%s \n", body); } } }
标签:u8,void,NMEA,marker,type,gps From: https://www.cnblogs.com/ncepu/p/16655465.html