Code for 'Smart Regulator' featured in 'Model Engineer', November 2020 on. Contains all work to August 2020 including all code described. Top level algorithm development is quite spares, leaving some work for you! Any questions - jon@jons-workshop.com
Dependencies: mbed BufferedSerial Servo2 PCT2075 I2CEeprom FastPWM
gps_mod.h
00001 #ifndef MBED_GPS_MOD_H 00002 #define MBED_GPS_MOD_H 00003 00004 #include "mbed.h" 00005 const static double PI = 2.0 * acos(0.0), 00006 deg2rad = (PI / 180.0), 00007 km2miles = (39370.0/36.0/1760.0); 00008 class gps_mod 00009 { 00010 enum {NULLST, WAITING4DOLLAR, GOTDOLLAR, GOTHDR, WAITING4CR, WAITING4LF}; 00011 const static int MAXMSGLEN = 86; 00012 // private: by default 00013 bool inmsg, newdata; 00014 int ch, state, i, chcnt; 00015 char hdracc[8], dest[6*(MAXMSGLEN + 4)], 00016 posfix[4], 00017 numofsats[4], 00018 latstr[16], 00019 longstr[16], 00020 altistr[16], 00021 speed_mphourstr[16], 00022 headingstr[16], 00023 datestr[16], 00024 timestr[16]; 00025 char * destptr; 00026 public: 00027 //BufferedSoftSerial gps_module (PinName _pinTx, PinName _pinRx); 00028 gps_mod(); 00029 int update(); 00030 void tock_handler(); 00031 char * position_fix_indicator (); 00032 char * message(int); 00033 char * time (); 00034 char * date (); 00035 char * heading (); 00036 char * mph (); 00037 char * sat_count (); 00038 char * latitude(); 00039 char * longitude(); 00040 char * altitude(); 00041 bool fix_valid(); 00042 bool new_data(); 00043 double mergedegmin (char *, char *); 00044 double lat_merged (); 00045 double lon_merged (); 00046 }; 00047 00048 //class Flasher { 00049 //public: 00050 // Flasher(PinName pin); 00051 // void flash(int n); 00052 // 00053 //private: 00054 // DigitalOut _pin; 00055 //}; 00056 00057 #endif 00058
Generated on Fri Jul 22 2022 15:22:19 by
1.7.2