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

The INA3221 channels' current limits on their way to the IOmcu's SENSE_LIMIT page. More...

#include <stdatomic.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "link_host.h"
#include "link_pages.h"
#include "panel.h"
#include "sense_limit_link.h"
#include "sensors_rows.h"
#include "settings.h"
#include "settings_sensors.h"

Functions

void publish_limits (void)
 Takes the LIMIT and WATCHES rows for the control task; app_main, from the SENSORS observer.
void sense_limit_came_up (uint16_t minor)
 The link came up; control task.
void sense_limit_lost (void)
 The link went; control task. Clears s_sense_limits.
static void limit_alerts (void)
 The next alert into the band, when the band's slot is free.
void sense_limit_service (void)
 Serves SENSE_LIMIT, at most 2 exchanges, and sends the next band alert; control task, every poll.

Variables

static portMUX_TYPE s_limit_mux = portMUX_INITIALIZER_UNLOCKED
 Guards the limits and what each channel watches as the settings stand, both ways: written by the settings observer on app_main, read once a poll by the control task.
static uint16_t s_limit_want [LINK_SL_KEPT]
 Each channel's limit in mA, 0 for none; under s_limit_mux.
static uint8_t s_limit_watch [LINK_SL_KEPT]
 What each channel watches, SENS_W_* options; under s_limit_mux.
static sense_limit_link_t s_sense_limit
 The page's service; control task only.
atomic_uint s_sense_limits
 SETUP > SENSORS' LIMIT marks, sensors_rows_set_limits()'s word. Control task writes, app_main reads.

Detailed Description

The INA3221 channels' current limits on their way to the IOmcu's SENSE_LIMIT page.

Protocol 4.27, sense_limit_link.h: SETUP > SENSORS' LIMIT rows, published by the settings observer on app_main and taken by the control task, the page's service there, and the band alert when a channel's window passed its limit. An alert only: nothing here stops or switches anything.

SPDX-License-Identifier: MIT

Function Documentation

◆ sense_limit_came_up()

void sense_limit_came_up ( uint16_t minor)

The link came up; control task.

Parameters
minorthe IOmcu's protocol minor; below 27 nothing is sent to SENSE_LIMIT.

Variable Documentation

◆ s_sense_limits

atomic_uint s_sense_limits

SETUP > SENSORS' LIMIT marks, sensors_rows_set_limits()'s word. Control task writes, app_main reads.

sensors_rows_set_limits()'s word; control task writes, app_main reads.

SETUP > SENSORS' LIMIT marks, sensors_rows_set_limits()'s word. Control task writes, app_main reads.