A GPS disciplined clock
Dependencies: net lpc1768 crypto clock web log
web-this/home/web-home-ajax.c@60:7cab896b0fd4, 2019-05-01 (annotated)
- Committer:
- andrewboyson
- Date:
- Wed May 01 14:08:56 2019 +0000
- Revision:
- 60:7cab896b0fd4
- Parent:
- 59:d2d25c2265f8
- Child:
- 87:5052e316994a
Updated this site's js to use the web common ajax module
Who changed what in which revision?
User | Revision | Line number | New 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 | 60:7cab896b0fd4 | 20 | HttpAddInt16AsHex(ms ); HttpAddChar('\n'); |
andrewboyson | 60:7cab896b0fd4 | 21 | char byte = 0; |
andrewboyson | 60:7cab896b0fd4 | 22 | if (RtcIsSet() ) byte |= 0x01; |
andrewboyson | 60:7cab896b0fd4 | 23 | if (ClkTimeIsSet() ) byte |= 0x02; |
andrewboyson | 60:7cab896b0fd4 | 24 | if (PpsIsStable() ) byte |= 0x04; |
andrewboyson | 60:7cab896b0fd4 | 25 | if (NmeaTimeIsStable() ) byte |= 0x08; |
andrewboyson | 60:7cab896b0fd4 | 26 | if (ClkGovRateIsSynced ) byte |= 0x10; |
andrewboyson | 60:7cab896b0fd4 | 27 | if (ClkGovTimeIsSynced ) byte |= 0x20; |
andrewboyson | 60:7cab896b0fd4 | 28 | if (ClkUtcGetNextLeapEnable() ) byte |= 0x40; |
andrewboyson | 60:7cab896b0fd4 | 29 | if (ClkUtcGetNextLeapForward()) byte |= 0x80; |
andrewboyson | 60:7cab896b0fd4 | 30 | HttpAddByteAsHex (byte ); HttpAddChar('\n'); |
andrewboyson | 60:7cab896b0fd4 | 31 | HttpAddInt12AsHex(ClkUtcGetNextEpochMonth1970()); HttpAddChar('\n'); |
andrewboyson | 60:7cab896b0fd4 | 32 | HttpAddInt16AsHex(ClkUtcGetEpochOffset() ); HttpAddChar('\n'); |
andrewboyson | 27:eb5728b9052b | 33 | } |
andrewboyson | 27:eb5728b9052b | 34 |