|
ether2ser 0.1.0
Ethernet <-> synchronous V.24 bridge firmware for RP2040 + W5500
|
#include "baudrate_monitor.h"#include <assert.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "hardware/gpio.h"#include "hardware/sync.h"#include "hardware/timer.h"#include "pico/time.h"#include "pico/types.h"#include "platform/pinmap.h"#include "system/common.h"
Go to the source code of this file.
Macros | |
| #define | PIN_COUNT 25 |
| #define | BAUD_STALE_US 50000U |
| #define | BAUD_TIMER_MS 20 |
| #define | BAUD_EMA_ALPHA 0.2F |
Functions | |
| static void | rxc_edge_isr (uint gpio, uint32_t events) |
| float | baudrate_estimator_get_current_estimation (V24_PIN_T pin) |
| Get latest baudrate estimate. | |
| static bool | baud_timer_cb (repeating_timer_t *timer) |
| void | baudrate_estimator_init (V24_PIN_T pin) |
| Initialize baudrate estimator on a specific RX clock pin. | |
Variables | |
| static volatile uint32_t | edge_count [PIN_COUNT] = {0} |
| static repeating_timer_t | baud_timer |
| static volatile bool | baud_ready [PIN_COUNT] = {false} |
| static volatile float | baud_hz [PIN_COUNT] = {0.0F} |
| static size_t | current_pin_count = 0 |
| static volatile uint8_t | monitored_pin [PIN_COUNT] = {0} |
| static volatile uint64_t | first_edge_time_us [PIN_COUNT] = {0} |
| static volatile uint64_t | last_edge_time_us [PIN_COUNT] = {0} |
| #define BAUD_EMA_ALPHA 0.2F |
Definition at line 40 of file baudrate_monitor.c.
| #define BAUD_STALE_US 50000U |
Definition at line 36 of file baudrate_monitor.c.
| #define BAUD_TIMER_MS 20 |
Definition at line 38 of file baudrate_monitor.c.
| #define PIN_COUNT 25 |
Definition at line 34 of file baudrate_monitor.c.
|
static |
Definition at line 71 of file baudrate_monitor.c.
References BAUD_EMA_ALPHA, baud_hz, baud_ready, BAUD_STALE_US, current_pin_count, edge_count, first_edge_time_us, last_edge_time_us, monitored_pin, and US_PER_SECOND.
Referenced by baudrate_estimator_init().

| float baudrate_estimator_get_current_estimation | ( | V24_PIN_T | pin | ) |
Get latest baudrate estimate.
| pin | V.24 clock pin being monitored. |
Definition at line 65 of file baudrate_monitor.c.
References baud_hz, and baud_ready.
Referenced by print_status_event().

| void baudrate_estimator_init | ( | V24_PIN_T | pin | ) |
Initialize baudrate estimator on a specific RX clock pin.
| pin | V.24 clock pin to monitor. |
Definition at line 118 of file baudrate_monitor.c.
References baud_timer, baud_timer_cb(), BAUD_TIMER_MS, current_pin_count, monitored_pin, PIN_COUNT, and rxc_edge_isr().
Referenced by main().


|
static |
Definition at line 51 of file baudrate_monitor.c.
References edge_count, first_edge_time_us, and last_edge_time_us.
Referenced by baudrate_estimator_init().

|
static |
Definition at line 44 of file baudrate_monitor.c.
Referenced by baud_timer_cb(), and baudrate_estimator_get_current_estimation().
|
static |
Definition at line 43 of file baudrate_monitor.c.
Referenced by baud_timer_cb(), and baudrate_estimator_get_current_estimation().
|
static |
Definition at line 42 of file baudrate_monitor.c.
Referenced by baudrate_estimator_init().
|
static |
Definition at line 45 of file baudrate_monitor.c.
Referenced by baud_timer_cb(), and baudrate_estimator_init().
|
static |
Definition at line 41 of file baudrate_monitor.c.
Referenced by baud_timer_cb(), and rxc_edge_isr().
|
static |
Definition at line 48 of file baudrate_monitor.c.
Referenced by baud_timer_cb(), and rxc_edge_isr().
|
static |
Definition at line 49 of file baudrate_monitor.c.
Referenced by baud_timer_cb(), and rxc_edge_isr().
|
static |
Definition at line 46 of file baudrate_monitor.c.
Referenced by baud_timer_cb(), and baudrate_estimator_init().