Prusa MINI Firmware overview
|
#include "uartslave.h"
#include <stdarg.h>
#include "stm32f4xx_hal.h"
#include "dbg.h"
|
int | uartslave_parse_mod_mask (uartslave_t *pslave, char *pstr, uint16_t *pmod_msk) |
|
int | uartslave_parse_cmd_id (uartslave_t *pslave, char *pstr, uint16_t *pcmd_id) |
|
int | uartslave_do_cmd (uartslave_t *pslave, uint16_t mod_msk, char cmd, uint16_t cmd_id, char *pstr) |
|
void | uartslave_init (uartslave_t *pslave, uartrxbuff_t *prxbuff, int size, char *pline) |
|
void | uartslave_cycle (uartslave_t *pslave) |
|
int | uartslave_printf (uartslave_t *pslave, const char *fmt,...) |
|
◆ uartslave_parse_mod_mask()
int uartslave_parse_mod_mask |
( |
uartslave_t * |
pslave, |
|
|
char * |
pstr, |
|
|
uint16_t * |
pmod_msk |
|
) |
| |
22 if (strncmp(pstr - 4,
"tst", 3) == 0)
26 #endif //UARTSLAVE_TST
◆ uartslave_parse_cmd_id()
int uartslave_parse_cmd_id |
( |
uartslave_t * |
pslave, |
|
|
char * |
pstr, |
|
|
uint16_t * |
pcmd_id |
|
) |
| |
39 }
else if ((pstr[3] == 0) || (pstr[3] ==
' ')) {
41 if (strncmp(pstr,
"tst", 3) == 0)
43 #endif //UARTSLAVE_TST
◆ uartslave_do_cmd()
int uartslave_do_cmd |
( |
uartslave_t * |
pslave, |
|
|
uint16_t |
mod_msk, |
|
|
char |
cmd, |
|
|
uint16_t |
cmd_id, |
|
|
char * |
pstr |
|
) |
| |
53 _dbg0(
"uartslave_do_cmd: pstr='%s', cmd='%c', mod_msk=%d, cmd_id = %d", pstr ? pstr :
"null", cmd, mod_msk, cmd_id);
◆ uartslave_init()
62 pslave->
pline = pline;
◆ uartslave_cycle()
83 if ((ch == 0) || (pslave->
count >= pslave->
size))
88 _dbg0(
"ERROR: command overflow\n");
90 }
else if ((pslave->
count > 0) && (ch == 0)) {
114 ret = pslave->
do_cmd(pslave, mod_msk, ch, cmd_id, pstr);
◆ uartslave_printf()
133 int len = vsprintf(text, fmt, va);
uartslave_parse_mod_mask_t * parse_mod_mask
Definition: uartslave.h:38
int count
Definition: uartslave.h:35
int uartslave_printf(uartslave_t *pslave, const char *fmt,...)
Definition: uartslave.c:129
#define UARTSLAVE_ERR_SYN
Definition: uartslave.h:17
Definition: stm32f4xx_hal_def.h:57
#define _dbg0
Definition: dbg.h:31
uint8_t flags
Definition: uartslave.h:34
#define UARTSLAVE_MOD_MSK_0
Definition: uartslave.h:9
int uartslave_do_cmd(uartslave_t *pslave, uint16_t mod_msk, char cmd, uint16_t cmd_id, char *pstr)
Definition: uartslave.c:52
UART_HandleTypeDef * phuart
Definition: uartrxbuff.h:17
#define UARTSLAVE_CMD_ID_UNK
Definition: uartslave.h:12
int size
Definition: uartslave.h:36
int uartrxbuff_getchar(uartrxbuff_t *prxbuff)
Definition: uartrxbuff.c:38
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32f4xx_hal_def.h:55
uartrxbuff_t * prxbuff
Definition: uartslave.h:33
#define UARTSLAVE_FLG_ECHO
Definition: uartslave.h:7
const uint8_t[]
Definition: 404_html.c:3
char * pline
Definition: uartslave.h:37
uartslave_do_cmd_t * do_cmd
Definition: uartslave.h:40
int uartslave_parse_mod_mask(uartslave_t *pslave, char *pstr, uint16_t *pmod_msk)
Definition: uartslave.c:10
#define UARTSLAVE_OK
Definition: uartslave.h:14
int uartslave_parse_cmd_id(uartslave_t *pslave, char *pstr, uint16_t *pcmd_id)
Definition: uartslave.c:34
#define HAL_MAX_DELAY
Definition: stm32f4xx_hal_def.h:76
#define UARTSLAVE_CMD_ID_0
Definition: uartslave.h:11
uartslave_parse_cmd_id_t * parse_cmd_id
Definition: uartslave.h:39
static png_bytep size_t size
Definition: pngwrite.c:2170
HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)