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

The KST page and the programming port's hardware it drives; see iomcu.h for the other files. More...

#include "iomcu.h"

Functions

uint8_t kst_hw_pin (void *ctx, uint8_t port)
 Returns the pin of a programming port for the KST wire driver.
bool kst_hw_take (void *ctx, uint8_t port, uint8_t pin)
 Takes the programming port's pin for the KST wire driver.
void kst_hw_give (void *ctx)
 Gives the programming port's pin back from the KST wire driver.
void kst_hw_supply (void *ctx, supply_port_view_t *out)
 Fills the supply view of the KST port.
bool kst_hw_supply_set (void *ctx, bool on, uint16_t mv, uint16_t ma)
 Sets the supply of the KST port.
void kst_read (void *ctx, uint8_t off, uint8_t n, uint16_t *out)
 Reads the KST page.
uint8_t kst_write (void *ctx, uint8_t off, uint8_t n, const uint16_t *in)
 Writes the KST page.

Detailed Description

The KST page and the programming port's hardware it drives; see iomcu.h for the other files.

SPDX-License-Identifier: MIT

Function Documentation

◆ kst_hw_give()

void kst_hw_give ( void * ctx)

Gives the programming port's pin back from the KST wire driver.

Parameters
ctxUnused.

◆ kst_hw_pin()

uint8_t kst_hw_pin ( void * ctx,
uint8_t port )

Returns the pin of a programming port for the KST wire driver.

Parameters
ctxUnused.
portIndex of the programming port.
Returns
The GPIO number, or the value prog_port_wire_pin() gives for a port with no pin.

◆ kst_hw_supply()

void kst_hw_supply ( void * ctx,
supply_port_view_t * out )

Fills the supply view of the KST port.

Parameters
ctxUnused.
outReceives the port's supply view.

◆ kst_hw_supply_set()

bool kst_hw_supply_set ( void * ctx,
bool on,
uint16_t mv,
uint16_t ma )

Sets the supply of the KST port.

No ON while the supply's wiring is not in flash, as the SUPPLY page refuses one: a restart in the run could not switch the module off.

Parameters
ctxUnused.
onTrue to switch the supply on.
mvSet voltage in millivolts, for ON.
maSet current in milliamps, for ON.
Returns
False for an ON while the wiring is not saved; otherwise what supply_page_port_set() returns.

◆ kst_hw_take()

bool kst_hw_take ( void * ctx,
uint8_t port,
uint8_t pin )

Takes the programming port's pin for the KST wire driver.

Parameters
ctxUnused.
portIndex of the programming port. Not used here.
pinGPIO number to take.
Returns
True when the KST line opened on the pin.

◆ kst_read()

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

Reads the KST page.

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

◆ kst_write()

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

Writes the KST 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.