A GPS disciplined clock

Dependencies:   net lpc1768 crypto clock web log

Committer:
andrewboyson
Date:
Thu Feb 20 15:25:34 2020 +0000
Revision:
87:5052e316994a
Parent:
60:7cab896b0fd4
Found that NMEA messages could be out by up to 5 seconds so adjusted the confidence value to ten minutes.; Modified home web page to show the GPS module status.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 27:eb5728b9052b 1 #include <stdint.h>
andrewboyson 27:eb5728b9052b 2 #include <stdio.h>
andrewboyson 27:eb5728b9052b 3
andrewboyson 28:7fb6b4e9ab80 4 #include "http.h"
andrewboyson 28:7fb6b4e9ab80 5 #include "rtc.h"
andrewboyson 28:7fb6b4e9ab80 6 #include "clk.h"
andrewboyson 28:7fb6b4e9ab80 7 #include "clktime.h"
andrewboyson 28:7fb6b4e9ab80 8 #include "clkgov.h"
andrewboyson 28:7fb6b4e9ab80 9 #include "clkutc.h"
andrewboyson 28:7fb6b4e9ab80 10 #include "pps.h"
andrewboyson 34:d9586fc921dc 11 #include "nmea.h"
andrewboyson 27:eb5728b9052b 12
andrewboyson 55:a1bd0572c8b6 13 void WebHomeAjax()
andrewboyson 27:eb5728b9052b 14 {
andrewboyson 27:eb5728b9052b 15 HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL);
andrewboyson 27:eb5728b9052b 16
andrewboyson 38:b7879c0ae0d9 17 clktime now = ClkNowTai();
andrewboyson 60:7cab896b0fd4 18 clktime fraction = now & ((1UL << CLK_TIME_ONE_SECOND_SHIFT) - 1);
andrewboyson 60:7cab896b0fd4 19 clktime ms = (fraction * 1000) >> CLK_TIME_ONE_SECOND_SHIFT;
andrewboyson 87:5052e316994a 20 HttpAddInt16AsHex(ms);
andrewboyson 87:5052e316994a 21 HttpAddChar('\n');
andrewboyson 87:5052e316994a 22
andrewboyson 87:5052e316994a 23 char nibble;
andrewboyson 87:5052e316994a 24 nibble = 0;
andrewboyson 87:5052e316994a 25 if (!NmeaSerialMessagesStopped) nibble |= 0x08; //bit 12
andrewboyson 87:5052e316994a 26 if (!NmeaFixMessagesStopped ) nibble |= 0x04; //bit 11
andrewboyson 87:5052e316994a 27 if (!NmeaTimeMessagesStopped ) nibble |= 0x02; //bit 10
andrewboyson 87:5052e316994a 28 if (PpsIsStable() ) nibble |= 0x01; //bit 9
andrewboyson 87:5052e316994a 29 HttpAddNibbleAsHex(nibble);
andrewboyson 87:5052e316994a 30
andrewboyson 87:5052e316994a 31 nibble = 0;
andrewboyson 87:5052e316994a 32 if (NmeaTimeIsStable() ) nibble |= 0x08; //bit 8
andrewboyson 87:5052e316994a 33 if (RtcIsSet() ) nibble |= 0x04; //bit 7
andrewboyson 87:5052e316994a 34 if (ClkTimeIsSet() ) nibble |= 0x02; //bit 6
andrewboyson 87:5052e316994a 35 if (ClkGovIsReceivingTime ) nibble |= 0x01; //bit 5
andrewboyson 87:5052e316994a 36 HttpAddNibbleAsHex(nibble);
andrewboyson 87:5052e316994a 37
andrewboyson 87:5052e316994a 38 nibble = 0;
andrewboyson 87:5052e316994a 39 if (ClkGovRateIsSynced ) nibble |= 0x08; //bit 4
andrewboyson 87:5052e316994a 40 if (ClkGovTimeIsSynced ) nibble |= 0x04; //bit 3
andrewboyson 87:5052e316994a 41 HttpAddNibbleAsHex(nibble);
andrewboyson 87:5052e316994a 42 HttpAddChar('\n');
andrewboyson 87:5052e316994a 43
andrewboyson 87:5052e316994a 44 HttpAddInt12AsHex(ClkUtcGetNextEpochMonth1970());
andrewboyson 87:5052e316994a 45 HttpAddChar('\n');
andrewboyson 87:5052e316994a 46
andrewboyson 87:5052e316994a 47 HttpAddInt16AsHex(ClkUtcGetEpochOffset());
andrewboyson 87:5052e316994a 48 HttpAddChar('\n');
andrewboyson 27:eb5728b9052b 49 }
andrewboyson 27:eb5728b9052b 50