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

The SUPPLY page and the PD mini behind it, and the current monitors' pages SENSE, SERVO_SENSE and SERVO_WIN, which core 1 reads the parts for; see iomcu.h for the other files. More...

#include <string.h>
#include "iomcu.h"
#include "pd_uart.h"
#include "sense_limit.h"
#include "sense_map.h"

Functions

void capabilities_update (void)
 Refreshes the IDENTITY page's capability word.
bool supply_rewire (void)
 Rebinds the supply's PD mini UART to the wiring in force.
static bool supply_probe (void)
void supply_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SUPPLY page.
uint8_t supply_take (uint8_t off, uint8_t n, const uint16_t *in, bool checked)
 Takes a SUPPLY write into the supply's wiring and output state.
uint8_t supply_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the SUPPLY page.
void sense_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SENSE page.
uint8_t sense_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the SENSE page.
void servo_sense_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SERVO_SENSE page.
void sense_map_rd (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SENSE_MAP page.
uint8_t sense_map_wr (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the SENSE_MAP page.
void sense_win_a_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SENSE_WIN_A page.
void sense_win_b_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SENSE_WIN_B page.
void sense_limit_rd (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SENSE_LIMIT page.
uint8_t sense_limit_wr (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the SENSE_LIMIT page.
void servo_win_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the SERVO_WIN page.
uint8_t servo_sense_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the SERVO_SENSE page.

Detailed Description

The SUPPLY page and the PD mini behind it, and the current monitors' pages SENSE, SERVO_SENSE and SERVO_WIN, which core 1 reads the parts for; see iomcu.h for the other files.

SPDX-License-Identifier: MIT

Function Documentation

◆ sense_limit_rd()

void sense_limit_rd ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SENSE_LIMIT page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ sense_limit_wr()

uint8_t sense_limit_wr ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the SENSE_LIMIT page.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ sense_map_rd()

void sense_map_rd ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SENSE_MAP page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ sense_map_wr()

uint8_t sense_map_wr ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the SENSE_MAP page.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ sense_read()

void sense_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SENSE page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ sense_win_a_read()

void sense_win_a_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SENSE_WIN_A page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ sense_win_b_read()

void sense_win_b_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SENSE_WIN_B page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ sense_write()

uint8_t sense_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the SENSE page.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ servo_sense_read()

void servo_sense_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SERVO_SENSE page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ servo_sense_write()

uint8_t servo_sense_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the SERVO_SENSE page.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.

◆ servo_win_read()

void servo_win_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SERVO_WIN page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ supply_read()

void supply_read ( void * ctx,
uint8_t off,
uint8_t n,
uint16_t * out )

Reads the SUPPLY page.

Parameters
ctxUnused.
offFirst register to read.
nNumber of registers to read.
outReceives the n register values.

◆ supply_rewire()

bool supply_rewire ( void )

Rebinds the supply's PD mini UART to the wiring in force.

Returns
True when the supply is disabled or its UART is attached. False when no PIO block can reach the pins or has room.

◆ supply_take()

uint8_t supply_take ( uint8_t off,
uint8_t n,
const uint16_t * in,
bool checked )

Takes a SUPPLY write into the supply's wiring and output state.

Parameters
offFirst register of the write.
nNumber of registers in the write.
inThe n register values.
checkedTrue for the wiring change a state read has shown the module off for (supply_page_wire_ready()); false for a write from the link.
Returns
0 to accept, or a link_nack_t to refuse.

◆ supply_write()

uint8_t supply_write ( void * ctx,
uint8_t off,
uint8_t n,
const uint16_t * in )

Writes the SUPPLY page.

Parameters
ctxUnused.
offFirst register to write.
nNumber of registers to write.
inThe n register values to write.
Returns
0 to accept, or a link_nack_t to refuse.