Common Fraise API.
More...
Common Fraise API.
|
|
bool | fraise_putbytes (const char *data, uint8_t len) |
| Send a raw bytes message. More...
|
|
void | fraise_put_init () |
| Initialize the 'put' buffer.
|
|
void | fraise_put_int8 (int8_t b) |
|
void | fraise_put_uint8 (uint8_t b) |
|
void | fraise_put_int16 (int16_t b) |
|
void | fraise_put_uint16 (uint16_t b) |
|
void | fraise_put_int32 (int32_t b) |
|
void | fraise_put_uint32 (uint32_t b) |
|
bool | fraise_put_send () |
| Send the 'put' buffer with fraise_putbytes()
|
|
|
- Note
- These functions are only valid when called from fraise_receivebytes() or fraise_receivebytes_broadcast(). If there's not enough data left, they return 0.
|
int8_t | fraise_get_int8 () |
|
uint8_t | fraise_get_uint8 () |
|
int16_t | fraise_get_int16 () |
|
uint16_t | fraise_get_uint16 () |
|
int32_t | fraise_get_int32 () |
|
uint32_t | fraise_get_uint32 () |
|
void | fraise_init_get_buffer (const char *data, uint8_t len) |
| Init the 'get' buffer. More...
|
|
|
|
bool | claim_pio_sm_irq (const pio_program_t *program, PIO *pio_hw, uint *sm, uint *program_offset, uint *irq) |
| Request attribution of a pio/sm (and optionnaly irq) for a given pio program. More...
|
|
◆ fraise_putbytes()
bool fraise_putbytes |
( |
const char * |
data, |
|
|
uint8_t |
len |
|
) |
| |
Send a raw bytes message.
- Parameters
-
data | the address of the first byte to send |
len | the number of bytes to send |
- Returns
- false if the TX buffer is full, true otherwise
◆ fraise_puts()
bool fraise_puts |
( |
const char * |
msg | ) |
|
Send a text message.
- Parameters
-
msg | the text message to send, must be a null-terminated string |
- Returns
- false if the TX buffer is full, true otherwise
◆ fraise_putchar()
void fraise_putchar |
( |
char |
c | ) |
|
push a single character to the text buffer
- Parameters
-
- Note
- the message will be sent with fraise_puts() and flushed after each
\n
(newline) character
◆ fraise_printf()
void fraise_printf |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Push a printf-formatted buffered text to the text buffer.
- Parameters
-
fmt,... | the formatted text |
- Note
- the message will be sent and flushed after each
\n
character (fraise_printf() internally calls fraise_putchar())
◆ setup()
Setup the application (optional user defined)
- Note
- the user can define this function, which will be automatically called once at startup
◆ loop()
Application loop (optional user defined)
- Note
- the user can define this function, which will be called repeatedly after setup()
◆ fraise_receivebytes()
void fraise_receivebytes |
( |
const char * |
data, |
|
|
uint8_t |
len |
|
) |
| |
Receive raw bytes (optional user defined)
- Parameters
-
data | the buffer containing the received bytes |
len | the number of received bytes |
- Note
- the user can define this function, which will be called when a raw bytes message has been received
◆ fraise_receivechars()
void fraise_receivechars |
( |
const char * |
data, |
|
|
uint8_t |
len |
|
) |
| |
Receive text message (optional user defined)
- Parameters
-
data | the buffer containing the received characters |
len | the number of received characters |
- Note
- the user can define this function, which will be called when a text message has been received
◆ fraise_receivebytes_broadcast()
void fraise_receivebytes_broadcast |
( |
const char * |
data, |
|
|
uint8_t |
len |
|
) |
| |
Receive broadcast raw bytes (optional user defined)
- Parameters
-
data | the buffer containing the received bytes |
len | the number of received bytes |
- Note
- the user can define this function, which will be called when a broadcast raw bytes message has been received
◆ fraise_receivechars_broadcast()
void fraise_receivechars_broadcast |
( |
const char * |
data, |
|
|
uint8_t |
len |
|
) |
| |
Receive broadcast text message (optional user defined)
- Parameters
-
data | the buffer containing the received characters |
len | the number of received characters |
- Note
- the user can define this function, which will be called when a broadcast text message has been received
◆ fraise_init_get_buffer()
void fraise_init_get_buffer |
( |
const char * |
data, |
|
|
uint8_t |
len |
|
) |
| |
◆ fraise_setup()
Initialize the Fraise driver.
- Note
- This is automatically called at startup, so in most cases you won't need it.
◆ fraise_get_pins()
void fraise_get_pins |
( |
int * |
rxpin, |
|
|
int * |
txpin, |
|
|
int * |
drvpin |
|
) |
| |
Get the pin numbers that Fraise is using.
- Parameters
-
rxpin | the address where to store the number of the RX pin |
txpin | the address where to store the number of the TX pin |
drvpin | the address where to store the number of the DRV pin |
◆ claim_pio_sm_irq()
bool claim_pio_sm_irq |
( |
const pio_program_t * |
program, |
|
|
PIO * |
pio_hw, |
|
|
uint * |
sm, |
|
|
uint * |
program_offset, |
|
|
uint * |
irq |
|
) |
| |
Request attribution of a pio/sm (and optionnaly irq) for a given pio program.
- Parameters
-
program | the pio program we want a sm to run |
pio_hw | the address where to store the available pio |
sm | the address where to store the index of the available state machine |
program_offset | the address where to store the offset from which the program can be written |
irq | if not null, the address where to store the index of the chosen irq |
- Returns
- false if this fails.