79#define KNOB_I2C_ADDR 0x06
82 "the knob's address is one the panel board answers at");
85#define KNOB_REG_ANGLE_HI 0x03
87#define KNOB_REG_ANGLE_LO 0x04
94#define KNOB_POLL_READS 3
98#define KNOB_COUNTS 16384
101#define KNOB_POLL_MS 10
102#define KNOB_POLL_IDLE_MS 100
112#define KNOB_MAX_STEP (KNOB_COUNTS / 4)
117#define KNOB_SCALE_DEG_DEFAULT 270
118#define KNOB_SCALE_DEG_MIN 90
119#define KNOB_SCALE_DEG_MAX 720
uint16_t knob_decode(uint8_t hi, uint8_t lo)
The datasheet's angle, 0..16383, rising counter-clockwise seen from the chip's top: hi read from KNOB...
Definition knob.c:19
bool knob_attach(knob_t *k, unsigned addr)
Take addr as the sensor's address and forget the reference.
Definition knob.c:29
float knob_span_fraction(int steps, int scale_deg)
Fraction of a slider's span that steps moves it when the span is scale_deg degrees of knob.
Definition knob.c:90
#define KNOB_I2C_ADDR
The MT6701's default 7-bit address.
Definition knob.h:79
void knob_reset(knob_t *k)
Forget the reference: the next usable reading moves nothing.
Definition knob.c:47
int knob_poll_addr(const knob_t *k)
The address the next poll reads, or -1 for a knob that is not attached: then no transaction is made.
Definition knob.c:37
bool knob_poll_probe_first(const knob_t *k)
Whether the next poll probes the address before its reads: an attached knob with no reference.
Definition knob.c:42
#define KNOB_POLL_READS
The reads of one poll, one byte each, in this order: 0x03, 0x04, 0x03.
Definition knob.h:94
uint16_t knob_clockwise(uint16_t angle)
angle mirrored, rising clockwise seen from the top: 0 stays 0.
Definition knob.c:24
int knob_poll_done(knob_t *k, bool answered, const uint8_t bytes[KNOB_POLL_READS])
End one poll.
Definition knob.c:78
int knob_feed(knob_t *k, bool usable, uint16_t raw)
Feed one poll.
Definition knob.c:53
#define k
Short name for kst_panel_k inside the overlay's seven files.
Definition kst_panel_int.h:238
The I2C (Inter-Integrated Circuit) addresses taken on the 7-inch ESP32-P4 display board's buses,...
#define PANEL_I2C_RESERVED(a)
The table as a constant expression, for a _Static_assert on an address fixed at build time.
Definition panel_i2c.h:55
The state of one knob: its attachment and its reference angle.
Definition knob.h:145
uint16_t ref
The first reading, the reference the knob's travel is counted from.
Definition knob.h:153
uint8_t addr
Definition knob.h:147
bool attached
Definition knob.h:146
bool have_ref
Definition knob.h:148