TimeSyncBlock
Wire protocol v1 of the time-sync characteristic (GattUuids.TIME_SYNC_CHARACTERISTIC, firmware 3.8.0+), shared with the device firmware. The device builds the 20-byte value inside its read handler from its own clock and the sample it numbered last, so one timed read ties the host's clock, the device's clock and the ADS1299 sample counter together (see TimeSync in :core). Little-endian:
| off | type | field | meaning |
|---|---|---|---|
| 0 | u8 | version | 1; any other value is not understood |
| 1 | u8 | flags | FLAG_STREAMING, FLAG_IMPEDANCE, FLAG_SAMPLE_VALID; other bits ignored |
| 2 | u8 | stream_gen | low 8 bits of the stream generation of the anchored sample |
| 3 | u8 | seq | incremented on every read the device answers |
| 4 | u32 | sample_number | sample numbered last, as the packet footers count; 0 without SAMPLE_VALID |
| 8 | u32 | sample_age_us | device time since that sample's DRDY; SAMPLE_AGE_INVALID without SAMPLE_VALID, SAMPLE_AGE_MAX saturated |
| 12 | u32 | t_now_us | low 32 bits of the device's microsecond clock, taken first in the read handler |
| 16 | u16 | conn_interval | the link's connection interval, 1.25 ms units |
| 18 | u16 | reserved | 0 |
Properties
Impedance mode: the sample counter is not uniform in time (it jumps a sweep at a time).
A sample has been numbered since the stream started.
The ADS1299 is converting.
sample_age_us without FLAG_SAMPLE_VALID.
sample_age_us saturated: this or more, so not a usable point.
Functions
The reply's fields, or null when value is not a v1 reply: shorter than REPLY_SIZE — an empty read is what both firmware without the characteristic and a failed read return — or of another version. A longer value is read as v1, for whatever a later version appends.