Loading...
Searching...
No Matches
phone_level.h
Go to the documentation of this file.
1
14#pragma once
15#include <stdint.h>
16
17// PHONE_NO_LEVEL and WIRE_NO_PLUGIN are generated from the phone's cap table, so the two sides
18// cannot drift
19#include "wire/wire_caps.g.h"
20
25
33static inline int phone_level_read(int32_t sent)
34{
35 if (sent == WIRE_NO_PLUGIN)
36 {
37 return WIRE_NO_PLUGIN;
38 }
39
40 if (sent < 0)
41 {
42 return PHONE_NO_LEVEL;
43 }
44
45 return sent > 100 ? 100 : (int)sent;
46}
47
static int phone_level_read(int32_t sent)
Reads one level off the wire.
Definition phone_level.h:33
Strip caps and marker values shared by the phone and the watch.
#define WIRE_NO_PLUGIN
Sent in place of a plugin reading while nothing on the phone serves it.
Definition wire_caps.g.h:32
#define PHONE_NO_LEVEL
The phone's battery level for no reading.
Definition wire_caps.g.h:31