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

The SENSE_TRACE build's ring, console and frame time. More...

#include "sense_trace_hw.h"
#include "hardware/pwm.h"
#include "pico/stdio.h"
#include "pico/stdio_usb.h"
#include "pico/stdlib.h"
#include "tusb.h"
#include "outputs_hw.h"
#include "sense_trace.h"

Functions

void sense_trace_hw_init (void)
 Core 0, before core 1 starts.
void sense_trace_hw_feed (const sense_svc_t *svc, uint64_t tick_us)
 Core 1, after each step of svc; tick_us is the time the tick started at, as the loop read it.
void sense_trace_hw_outputs (const outputs_t *o)
 Core 0, straight after outputs_hw_service(): each bound PWM slot's pulse of this pass, no longer than the slice's frame.
void sense_trace_hw_edge (uint64_t edge_us)
 Core 0: the capture's PWM edge, as outputs_hw_edge() stamped it.
void sense_trace_hw_pass (void)
 Core 0, once a pass: a character from the console, and the lines the console has room for.

Variables

static sense_trace_t s_trace
 The trace state.
static sense_trace_rec_t s_ring [SENSE_TRACE_HW_RING]
 The trace ring's memory.

Detailed Description

The SENSE_TRACE build's ring, console and frame time.

See sense_trace_hw.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ sense_trace_hw_edge()

void sense_trace_hw_edge ( uint64_t edge_us)

Core 0: the capture's PWM edge, as outputs_hw_edge() stamped it.

Parameters
edge_usThe capture's PWM edge time, in microseconds.

◆ sense_trace_hw_feed()

void sense_trace_hw_feed ( const sense_svc_t * svc,
uint64_t tick_us )

Core 1, after each step of svc; tick_us is the time the tick started at, as the loop read it.

Parameters
svcThe sensor service that has just stepped.
tick_usThe time the tick started at, in microseconds.

◆ sense_trace_hw_outputs()

void sense_trace_hw_outputs ( const outputs_t * o)

Core 0, straight after outputs_hw_service(): each bound PWM slot's pulse of this pass, no longer than the slice's frame.

A changed one is a command (sense_trace_pulse()), timed at the start of the frame that first carries it: now plus what the slice's counter has left of its frame, 1µs a count. The counter is read after the level was written, so a wrap between the two – some tens of µs in a frame of 2,500 to 25,000µs – puts the time one frame late.

Parameters
oThe output bank.