|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The PD mini's PIO UART. More...
#include "pd_uart.h"#include "hardware/gpio.h"#include "hardware/clocks.h"#include "hardware/pio.h"#include "pd_uart.pio.h"Data Structures | |
| struct | [struct].s |
| Driver state of the UART: the claimed machines and the pins. More... | |
Functions | |
| static void | rest (uint8_t pin) |
| A pin at rest: an input with a pull-down, driven by nothing here. | |
| bool | pd_uart_open (uint8_t tx, uint8_t rx, uint32_t baud) |
Claim the state machines for tx and rx at baud. | |
| void | pd_uart_close (void) |
| Release them; the pins stay at rest. | |
| static void | reset_machines (void) |
| Both machines stopped, emptied and back at their first instruction. | |
| void | pd_uart_baud (uint32_t baud) |
| Another rate for both machines, between transactions only: nothing happens while the UART is attached. | |
| void | pd_uart_attach (void *ctx) |
| Attach the UART to the pins for one transaction. | |
| void | pd_uart_detach (void *ctx) |
| Detach the UART; the pins go back to pulled-down inputs. | |
| void | pd_uart_send (void *ctx, const uint8_t *p, size_t n) |
| Send bytes on the attached UART. | |
| bool | pd_uart_getc (uint8_t *b) |
| A received byte, or false for none. | |
Variables | |
| static struct | s |
| void pd_uart_attach | ( | void * | ctx | ) |
Attach the UART to the pins for one transaction.
| ctx | Unused; passed by the driver's callback table. |
| void pd_uart_baud | ( | uint32_t | baud | ) |
Another rate for both machines, between transactions only: nothing happens while the UART is attached.
| baud | Baud rate. |
| void pd_uart_detach | ( | void * | ctx | ) |
Detach the UART; the pins go back to pulled-down inputs.
| ctx | Unused; passed by the driver's callback table. |
| bool pd_uart_getc | ( | uint8_t * | b | ) |
A received byte, or false for none.
| b | Receives the byte when true is returned. |
| bool pd_uart_open | ( | uint8_t | tx, |
| uint8_t | rx, | ||
| uint32_t | baud ) |
Claim the state machines for tx and rx at baud.
False, and nothing held, when no PIO block can reach the pins or has room.
| tx | GPIO number of the transmit pin. |
| rx | GPIO number of the receive pin. |
| baud | Baud rate. |
| void pd_uart_send | ( | void * | ctx, |
| const uint8_t * | p, | ||
| size_t | n ) |
Send bytes on the attached UART.
| ctx | Unused; passed by the driver's callback table. |
| p | Bytes to send. |
| n | Number of bytes in p. |
|
static |
A pin at rest: an input with a pull-down, driven by nothing here.
| pin | GPIO number. |