[Firebug-cvs] fireboard/fireboard/sensors/leadtek9546 gps_driver.nc,1.6,1.7 gps_driverM.nc,1.8,1.9 l
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2004-03-26 00:50:19
|
Update of /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17017/leadtek9546 Modified Files: gps_driver.nc gps_driverM.nc leadtek_9546.c leadtek_9546.h Log Message: Changed to HLSensor. Index: leadtek_9546.h =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546/leadtek_9546.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** leadtek_9546.h 3 Feb 2004 20:06:44 -0000 1.5 --- leadtek_9546.h 26 Mar 2004 00:39:27 -0000 1.6 *************** *** 63,67 **** * Authors: * - * $Id$ */ --- 63,66 ---- *************** *** 81,84 **** --- 80,86 ---- #define LEADTEK_9546_H + const uint8_t LEADTEK_POWER_ON = 1; + + // The actual values for each of these may vary, // especially characters per field, which may be *************** *** 102,106 **** #define NMEA_END2 "\n" //0x0A //ultimate byte of NMEA string - #define NMEA_GSV_MASK "0x0001" #define NMEA_GSA_MASK "0x0002" --- 104,107 ---- *************** *** 139,146 **** const uint8_t gps_syncmode_off[] = {" ""$LTC,SYNCMODE,0*6F" NMEA_END1 NMEA_END2}; ! const uint8_t gps_test[] = {" ""$LTC,1552,1*69" NMEA_END1 NMEA_END2}; ! const uint8_t gps_test1[] = {" ""$LTC,1551,3,4*70" NMEA_END1 NMEA_END2}; ! typedef struct _gga_msg GGA_Msg; typedef struct _gps_msg GPS_Msg; --- 140,150 ---- const uint8_t gps_syncmode_off[] = {" ""$LTC,SYNCMODE,0*6F" NMEA_END1 NMEA_END2}; ! const uint8_t gps_test[] = {" ""$LTC,1552,1*69" NMEA_END1 NMEA_END2}; ! const uint8_t gps_test1[] = {" ""$LTC,1551,3,4*70" NMEA_END1 NMEA_END2}; ! ! const uint8_t vtg_disable[] = {" ""$PSRF103,05,00,00,01*21" NMEA_END1 NMEA_END2}; ! ! //typedef struct _gga_msg GGA_Msg; typedef struct _gps_msg GPS_Msg; *************** *** 159,164 **** // 18 bytes. ! struct _gga_msg { uint8_t hours; uint8_t minutes; --- 163,169 ---- // 18 bytes. ! typedef struct GGAMsg { + uint16_t mote_id; uint8_t hours; uint8_t minutes; *************** *** 170,175 **** uint8_t NSEWind; uint8_t num_sats; ! }; #endif /* LEADTEK_9546_H */ --- 175,184 ---- uint8_t NSEWind; uint8_t num_sats; ! } GGAMsg; ! + enum { + AM_GGAMSG = 129 + }; #endif /* LEADTEK_9546_H */ Index: leadtek_9546.c =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546/leadtek_9546.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** leadtek_9546.c 29 Jan 2004 14:53:36 -0000 1.1 --- leadtek_9546.c 26 Mar 2004 00:39:27 -0000 1.2 *************** *** 22,25 **** --- 22,40 ---- } + + unsigned char + leadtek_crc(char * message, int size) { + + unsigned char cs = 0; + int index = 1; + + while (message[index] != '*') { + + cs = cs ^ message[index++]; + } + + return cs; + } + int main(int argc, char ** argv) { *************** *** 28,31 **** --- 43,55 ---- char data2[] = {"$GPGGA,023129.762,3754.1755,N,12218.2682,W,1,08,1.1,-19.4,M,,,,0000"}; + + /////////////////////// Leadtek stuff + char vtg_enable_1_Hz[] = {"$PSRF103,05,00,01,01*"}; + char vtg_disable[] = {"$PSRF103,05,00,00,01*"}; + char gga_query_cs[] = {"$PSRF103,00,01,00,01*"}; + char debug_on[] ={"$PSRF105,1*"}; + char debug_off[] ={"$PSRF105,0*"}; + + ///////////////////////////// const uint8_t gps_gga_mask_crc[] = {"$LTC,NMEA," NMEA_GGA_MASK}; const uint8_t gps_rmc_mask_crc[] = {"$LTC,NMEA," NMEA_RMC_MASK}; *************** *** 39,45 **** --- 63,76 ---- printf("string: %s, crc: %x\n",data2,crc(data2,strlen(data2))); + printf("string: %s, crc: %x\n",gps_syncmode_off_crc,crc(gps_syncmode_off_crc,strlen(gps_syncmode_off_crc))); printf("string: %s, crc: %x\n",gps_test_crc,crc(gps_test_crc,strlen(gps_test_crc))); + printf("vtg_enable_1_Hz: %s cs: %x\n",vtg_enable_1_Hz,leadtek_crc(vtg_enable_1_Hz,strlen(vtg_enable_1_Hz))); + printf("vtg_disable: %s cs: %x\n",vtg_disable,leadtek_crc(vtg_disable,strlen(vtg_disable))); + printf("gga_query_cs: %s cs: %x\n",gga_query_cs,leadtek_crc(gga_query_cs,strlen(gga_query_cs))); + printf("debug_on: %s cs: %x\n",debug_on,leadtek_crc(debug_on,strlen(debug_on))); + printf("debug_off: %s cs: %x\n",debug_off,leadtek_crc(debug_off,strlen(debug_off))); + return 0; Index: gps_driverM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546/gps_driverM.nc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gps_driverM.nc 3 Feb 2004 20:06:44 -0000 1.8 --- gps_driverM.nc 26 Mar 2004 00:39:27 -0000 1.9 *************** *** 1,5 **** - /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ - - /** * Parts of this code were written or modified for FireBug project --- 1,2 ---- *************** *** 19,23 **** interface StdControl; ! interface Sensor; command void readGps(); --- 16,20 ---- interface StdControl; ! interface HLSensor; command void readGps(); *************** *** 43,47 **** command result_t load_gga_struct(char gga_fields[GGA_FIELDS][GPS_CHAR_PER_FIELD]); ! command result_t log_gga_data_to_eeprom(GGA_Msg * pGGA); } --- 40,44 ---- command result_t load_gga_struct(char gga_fields[GGA_FIELDS][GPS_CHAR_PER_FIELD]); ! command result_t log_gga_data_to_eeprom(GGAMsg * pGGA); } *************** *** 70,74 **** uint8_t gps_state; ! GGA_Msg gga_msg = {0}; /** This is essentially thread safe, because once it is --- 67,71 ---- uint8_t gps_state; ! GGAMsg gga_msg = {0}; /** This is essentially thread safe, because once it is *************** *** 84,88 **** command result_t StdControl.init() { ! init_debug(); call Leds.init(); /** Control.init in GpsPacket.nc */ --- 81,85 ---- command result_t StdControl.init() { ! //init_debug(); call Leds.init(); /** Control.init in GpsPacket.nc */ *************** *** 185,189 **** ! command result_t log_gga_data_to_eeprom(GGA_Msg * pGGA) { #if 0 --- 182,186 ---- ! command result_t log_gga_data_to_eeprom(GGAMsg * pGGA) { #if 0 *************** *** 246,261 **** GPS_MsgPtr gps_data = (GPS_MsgPtr)data; ! signal Sensor.dataReady(gps_data); ! #if 0 if ((call isGGA(gps_data->data))) { call parse_gga(gps_data); ! //if (have_gps_fix) { ! //signal Sensor.dataReady(gps_data); ! call spew_to_uart(gps_data); ! signal Sensor.dataReady(&gga_msg); ! //} } #endif --- 243,258 ---- GPS_MsgPtr gps_data = (GPS_MsgPtr)data; ! #if DBG_USR2 ! signal HLSensor.dataReady(gps_data); ! #else if ((call isGGA(gps_data->data))) { call parse_gga(gps_data); ! if (have_gps_fix) { ! //call spew_to_uart(gps_data); ! signal HLSensor.dataReady(&gga_msg); ! } } #endif *************** *** 436,446 **** /////////////////////////////////////////////////////////// ! command result_t Sensor.init() { ! //SODbg(DBG_USR2, "gps_driverM.Sensor.init()\n"); return SUCCESS; } ! command result_t Sensor.powerOn() { //SODbg(DBG_USR2, "gps_driverM.Sensor.powerOn()\n"); --- 433,443 ---- /////////////////////////////////////////////////////////// ! command result_t HLSensor.init() { ! //SODbg(DBG_USR2, "gps_driverM.HLSensor.init()\n"); return SUCCESS; } ! command result_t HLSensor.powerOn(uint8_t power_level) { //SODbg(DBG_USR2, "gps_driverM.Sensor.powerOn()\n"); *************** *** 450,458 **** } ! default event result_t Sensor.powerOnDone() { return SUCCESS; } ! command result_t Sensor.powerOff() { //call stopGps(); --- 447,455 ---- } ! default event result_t HLSensor.powerOnDone() { return SUCCESS; } ! command result_t HLSensor.powerOff() { //call stopGps(); *************** *** 463,471 **** } have_gps_fix = 0; ! signal Sensor.powerOffDone(); return SUCCESS; } ! default event result_t Sensor.powerOffDone() { return SUCCESS; } --- 460,468 ---- } have_gps_fix = 0; ! signal HLSensor.powerOffDone(); return SUCCESS; } ! default event result_t HLSensor.powerOffDone() { return SUCCESS; } *************** *** 474,478 **** * NMEA string. */ ! command result_t Sensor.setSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } --- 471,475 ---- * NMEA string. */ ! command result_t HLSensor.setSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } *************** *** 481,501 **** * NMEA string. */ ! command result_t Sensor.getSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } ! command result_t Sensor.startSampling() { return SUCCESS; } ! command result_t Sensor.stopSampling() { return SUCCESS; } ! command result_t Sensor.sampleOnce() { return SUCCESS; } ! default event result_t Sensor.dataReady(void * userdata) { return SUCCESS; } --- 478,498 ---- * NMEA string. */ ! command result_t HLSensor.getSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } ! command result_t HLSensor.startSampling() { return SUCCESS; } ! command result_t HLSensor.stopSampling() { return SUCCESS; } ! command result_t HLSensor.sampleOnce() { return SUCCESS; } ! default event result_t HLSensor.dataReady(void * userdata) { return SUCCESS; } *************** *** 508,512 **** * the UART and loading into the LeadTek. */ ! command result_t Sensor.loadProgram(uint8_t * program) { TOS_Msg msg = {0}; --- 505,509 ---- * the UART and loading into the LeadTek. */ ! command result_t HLSensor.loadProgram(uint8_t * program, uint8_t length) { TOS_Msg msg = {0}; *************** *** 520,524 **** ! signal Sensor.dataReady((void*)program); return call GpsSend.send(&msg); --- 517,521 ---- ! signal HLSensor.dataReady((void*)program); return call GpsSend.send(&msg); *************** *** 531,535 **** * and signaled. */ ! async default event result_t Sensor.error(uint16_t error_code) { return SUCCESS; } --- 528,532 ---- * and signaled. */ ! async default event result_t HLSensor.error(uint16_t error_code) { return SUCCESS; } Index: gps_driver.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/leadtek9546/gps_driver.nc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gps_driver.nc 3 Feb 2004 20:06:44 -0000 1.6 --- gps_driver.nc 26 Mar 2004 00:39:27 -0000 1.7 *************** *** 1,3 **** - /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ /** --- 1,2 ---- *************** *** 44,48 **** interface StdControl; ! interface Sensor; } } --- 43,47 ---- interface StdControl; ! interface HLSensor; } } *************** *** 57,61 **** gps_driverM.StdControl = StdControl; ! Sensor = gps_driverM; StdControl = MicaWbSwitch; --- 56,60 ---- gps_driverM.StdControl = StdControl; ! HLSensor = gps_driverM; StdControl = MicaWbSwitch; |