Loading...
Searching...
No Matches
weather_wire.h
Go to the documentation of this file.
1
14#pragma once
15#include <stdbool.h>
16#include <stdint.h>
17
22
23// WEATHER_NO_TEMP and WEATHER_FORECAST_COLS are generated from the phone's cap table, so the two
24// sides of the strip cannot drift. The marker has to sit outside the real range, since a
25// temperature can be negative and zero is a reading. The 2x4 panel stacks two rows of four, which
26// is what the column count is sized for
27#include "wire/wire_caps.g.h"
28
30typedef struct
31{
32 uint8_t code;
33 int16_t temp;
35
37typedef struct
38{
39 uint8_t code;
40 int16_t temp_max;
41 int16_t temp_min;
43
45typedef struct
46{
47 uint8_t count;
48 uint8_t base_hour;
49 uint8_t step_hours;
52
60
73bool weather_hourly_decode(const uint8_t *buf, uint16_t len, WeatherHourly *out);
74
87bool weather_daily_decode(const uint8_t *buf, uint16_t len, WeatherDaily *out);
88
bool weather_hourly_decode(const uint8_t *buf, uint16_t len, WeatherHourly *out)
Unpacks an hourly forecast off the wire.
Definition weather_wire.c:19
bool weather_daily_decode(const uint8_t *buf, uint16_t len, WeatherDaily *out)
Unpacks a 7-day forecast off the wire.
Definition weather_wire.c:52
The 7-day strip. count is 0 until a reading lands.
Definition weather_wire.h:55
WeatherDayCol col[WEATHER_FORECAST_COLS]
The daily columns, filled up to count.
Definition weather_wire.h:58
uint8_t count
How many columns are filled (0 means none yet).
Definition weather_wire.h:56
uint8_t base_weekday
Weekday of the first column (0 means Sunday).
Definition weather_wire.h:57
One daily forecast column: a sky code plus the day's high and low.
Definition weather_wire.h:38
int16_t temp_min
The day's low in the user's unit.
Definition weather_wire.h:41
uint8_t code
Sky code that picks an icon from the shared list (255 means unknown).
Definition weather_wire.h:39
int16_t temp_max
The day's high in the user's unit.
Definition weather_wire.h:40
One hourly forecast column: a sky code plus a temperature (WEATHER_NO_TEMP for none).
Definition weather_wire.h:31
int16_t temp
Temperature in the user's unit.
Definition weather_wire.h:33
uint8_t code
Sky code that picks an icon from the shared list (255 means unknown).
Definition weather_wire.h:32
The hourly strip. count is 0 until a reading lands.
Definition weather_wire.h:46
WeatherHourCol col[WEATHER_FORECAST_COLS]
The hourly columns, filled up to count.
Definition weather_wire.h:50
uint8_t step_hours
Hours between columns.
Definition weather_wire.h:49
uint8_t count
How many columns are filled (0 means none yet).
Definition weather_wire.h:47
uint8_t base_hour
Hour of day of the first column (0 to 23).
Definition weather_wire.h:48
Strip caps and marker values shared by the phone and the watch.
#define WEATHER_FORECAST_COLS
How many columns a forecast strip carries.
Definition wire_caps.g.h:29