rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
knob_task.h File Reference

The rotary knob's reader: an MT6701 at 0x06 on an I2C (Inter-Integrated Circuit) bus of its own (BOARD_KNOB_PIN_SDA, BOARD_KNOB_PIN_SCL), polled from a task of its own. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Functions

void knob_task_attach (void)
 Set up the knob's bus and register the sensor on it.
void knob_task_start (void)
void knob_task_set_enabled (bool on)
int knob_task_take (void)

Detailed Description

The rotary knob's reader: an MT6701 at 0x06 on an I2C (Inter-Integrated Circuit) bus of its own (BOARD_KNOB_PIN_SDA, BOARD_KNOB_PIN_SCL), polled from a task of its own.

The sensor is registered on the bus once, before the control task starts, and the task reads it only while the setting is on, so a panel with the knob off sends nothing to 0x06. While the knob has no reference the task probes 0x06 before reading, so a panel with the knob on and no sensor logs nothing per poll. What it hands over is motion, a count of steps since the last take, never an angle: a knob that stops answering stops adding to it.

SPDX-License-Identifier: MIT

Function Documentation

◆ knob_task_attach()

void knob_task_attach ( void )

Set up the knob's bus and register the sensor on it.

Call once, before knob_task_start(). Sends nothing. A bus or a device that does not come up is logged; the task then reads nothing.

◆ knob_task_set_enabled()

void knob_task_set_enabled ( bool on)

Poll the sensor (true) or leave the bus alone (false).

◆ knob_task_start()

void knob_task_start ( void )

Create the task. Call once, after knob_task_attach().

◆ knob_task_take()

int knob_task_take ( void )

The steps turned since the last call, signed; clears the count.