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

The PD mini driver's private functions, shared by pdmini.c and pdmini_jobs.c. More...

#include "pdmini.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Functions

void pdmini_start (pdmini_t *d, uint32_t now, const uint8_t *req, size_t n, bool write)
 Starts the transaction req of n bytes and its CRC8: attaches the pins and enters PD_ATTACH.
void pdmini_read1 (pdmini_t *d, uint32_t now, uint8_t cmd)
 Starts the one-byte read cmd.
void pdmini_finish (pdmini_t *d, uint32_t now, bool ok)
 Ends the transaction under way, ok when its reply was taken (a write: when its bytes left), and enters PD_GAP.
uint16_t pdmini_target_mv (const pdmini_t *d)
 The voltage set point the module is given for the one asked.
bool pdmini_under_line (const pdmini_t *d)
 Whether the input last read lies under the set point read back and PDMINI_HEADROOM_MV.
void pdmini_sag_hold (pdmini_t *d)
 The output switched off for the input, or its ON not written, and held off until an OFF is asked.

Detailed Description

The PD mini driver's private functions, shared by pdmini.c and pdmini_jobs.c.

Not part of the module's interface; another project includes pdmini.h only.

SPDX-License-Identifier: MIT

Function Documentation

◆ pdmini_finish()

void pdmini_finish ( pdmini_t * d,
uint32_t now,
bool ok )

Ends the transaction under way, ok when its reply was taken (a write: when its bytes left), and enters PD_GAP.

Parameters
dDriver state.
nowCurrent time, in milliseconds.
oktrue when its reply was taken (a write: when its bytes left).

◆ pdmini_read1()

void pdmini_read1 ( pdmini_t * d,
uint32_t now,
uint8_t cmd )

Starts the one-byte read cmd.

Parameters
dDriver state.
nowCurrent time, in milliseconds.
cmdCommand byte to read.

◆ pdmini_sag_hold()

void pdmini_sag_hold ( pdmini_t * d)

The output switched off for the input, or its ON not written, and held off until an OFF is asked.

Parameters
dDriver state.

◆ pdmini_start()

void pdmini_start ( pdmini_t * d,
uint32_t now,
const uint8_t * req,
size_t n,
bool write )

Starts the transaction req of n bytes and its CRC8: attaches the pins and enters PD_ATTACH.

write is true for a write.

Parameters
dDriver state.
nowCurrent time, in milliseconds.
reqRequest bytes, without the CRC8.
nNumber of bytes in req.
writetrue for a write, which has no reply.

◆ pdmini_target_mv()

uint16_t pdmini_target_mv ( const pdmini_t * d)

The voltage set point the module is given for the one asked.

Parameters
dDriver state.
Returns
Voltage in mV.

◆ pdmini_under_line()

bool pdmini_under_line ( const pdmini_t * d)

Whether the input last read lies under the set point read back and PDMINI_HEADROOM_MV.

Parameters
dDriver state.
Returns
true when the input is under the line.