Prusa MINI Firmware overview
putslave.h
Go to the documentation of this file.
1 // putslave.h
2 #ifndef _PUTSLAVE_H
3 #define _PUTSLAVE_H
4 
5 #include "uartslave.h"
6 
7 #define PUTSLAVE_CMD_ID_RST 0x01
8 #define PUTSLAVE_CMD_ID_VER 0x02
9 #define PUTSLAVE_CMD_ID_SER 0x03
10 #define PUTSLAVE_CMD_ID_BREV 0x04
11 #define PUTSLAVE_CMD_ID_BTIM 0x05
12 #define PUTSLAVE_CMD_ID_MAC 0x06
13 #define PUTSLAVE_CMD_ID_UID 0x07
14 #define PUTSLAVE_CMD_ID_IP4 0x08
15 #define PUTSLAVE_CMD_ID_LOCK 0x09
16 #define PUTSLAVE_CMD_ID_TST 0x10
17 #define PUTSLAVE_CMD_ID_TONE 0x11
18 #define PUTSLAVE_CMD_ID_START 0x12
19 #define PUTSLAVE_CMD_ID_STOP 0x13
20 #define PUTSLAVE_CMD_ID_TSTE 0x14
21 #define PUTSLAVE_CMD_ID_EECL 0x20
22 #define PUTSLAVE_CMD_ID_ADC 0xc0
23 #define PUTSLAVE_CMD_ID_GPIO 0xc1
24 #define PUTSLAVE_CMD_ID_GCODE 0xc2
25 #define PUTSLAVE_CMD_ID_PWM 0xc3
26 #define PUTSLAVE_CMD_ID_INVAL 0xc4
27 #define PUTSLAVE_CMD_ID_DIAG 0xc5
28 #define PUTSLAVE_CMD_ID_UART 0xc6
29 #define PUTSLAVE_CMD_ID_I2C 0xc7
30 #define PUTSLAVE_CMD_ID_TEN 0xc8
31 #define PUTSLAVE_CMD_ID_MOVE 0xc9
32 #define PUTSLAVE_CMD_ID_TDG 0xd0
33 #define PUTSLAVE_CMD_ID_GPUP 0xd1
34 
35 #define FLASH_START_ADRESS 0x08020200
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif //__cplusplus
40 
41 extern void putslave_init(uartslave_t *pslave);
42 
43 #ifdef __cplusplus
44 }
45 #endif //__cplusplus
46 
47 #endif // _PUTSLAVE_H
PUTSLAVE_CMD_ID_MOVE
#define PUTSLAVE_CMD_ID_MOVE
Definition: putslave.h:31
putslave_do_cmd_a_brev
int putslave_do_cmd_a_brev(uartslave_t *pslave, char *pstr)
Definition: putslave.c:276
putslave_do_cmd_a_tst
int putslave_do_cmd_a_tst(uartslave_t *pslave, char *pstr)
Definition: putslave.c:447
putslave_do_cmd_q_ver
int putslave_do_cmd_q_ver(uartslave_t *pslave)
Definition: putslave.c:98
UARTSLAVE_ERR_OOR
#define UARTSLAVE_ERR_OOR
Definition: uartslave.h:18
OTP_MAC_ADDRESS_ADDR
#define OTP_MAC_ADDRESS_ADDR
Definition: otp.h:18
PUTSLAVE_CMD_ID_GCODE
#define PUTSLAVE_CMD_ID_GCODE
Definition: putslave.h:24
marlin_server.h
putslave_do_cmd_a_gcode
int putslave_do_cmd_a_gcode(uartslave_t *pslave, char *pstr)
Definition: putslave.c:411
putslave_do_cmd_a_rst
int putslave_do_cmd_a_rst(uartslave_t *pslave)
Definition: putslave.c:232
putslave_do_cmd_q_uart
int putslave_do_cmd_q_uart(uartslave_t *pslave)
Definition: putslave.c:212
eeprom_test_PUT
int8_t eeprom_test_PUT(const unsigned int bytes)
Definition: eeprom.c:208
hwio_beeper_set_pwm
void hwio_beeper_set_pwm(uint32_t per, uint32_t pul)
Definition: hwio_a3ides_2209_02.c:491
GPIO_MODE_OUTPUT_PP
#define GPIO_MODE_OUTPUT_PP
Definition: stm32f4xx_hal_gpio.h:136
putslave_do_cmd_q_mac
int putslave_do_cmd_q_mac(uartslave_t *pslave)
Definition: putslave.c:121
PUTSLAVE_CMD_ID_STOP
#define PUTSLAVE_CMD_ID_STOP
Definition: putslave.h:19
variant8_ui8
variant8_t variant8_ui8(uint8_t ui8)
Definition: variant8.c:18
uartslave_printf
int uartslave_printf(uartslave_t *pslave, const char *fmt,...)
Definition: uartslave.c:129
UARTSLAVE_ERR_SYN
#define UARTSLAVE_ERR_SYN
Definition: uartslave.h:17
GPIO_SPEED_FREQ_HIGH
#define GPIO_SPEED_FREQ_HIGH
Definition: stm32f4xx_hal_gpio.h:160
trinamic.h
uart1rx_data
static uint8_t uart1rx_data[200]
Definition: main.c:145
osThreadId
TaskHandle_t osThreadId
Definition: cmsis_os.h:283
PUTSLAVE_CMD_ID_TSTE
#define PUTSLAVE_CMD_ID_TSTE
Definition: putslave.h:20
PUTSLAVE_CMD_ID_MAC
#define PUTSLAVE_CMD_ID_MAC
Definition: putslave.h:12
sys_reset
void sys_reset(void)
Definition: sys.cpp:20
HAL_SPI_MspInit
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
SPI MSP Initialization This function configures the hardware resources used in this example.
Definition: stm32f4xx_hal_msp.c:252
putslave_do_cmd_a_inval
int putslave_do_cmd_a_inval(uartslave_t *pslave)
Definition: putslave.c:463
PUTSLAVE_CMD_ID_ADC
#define PUTSLAVE_CMD_ID_ADC
Definition: putslave.h:22
__SPI_HandleTypeDef
SPI handle Structure definition.
Definition: stm32f4xx_hal_spi.h:120
uartslave.h
PC3
#define PC3
Definition: variant.h:94
g29_auto.gcode
list gcode
Definition: g29_auto.py:44
PUTSLAVE_CMD_ID_INVAL
#define PUTSLAVE_CMD_ID_INVAL
Definition: putslave.h:26
eeprom.h
PUTSLAVE_CMD_ID_RST
#define PUTSLAVE_CMD_ID_RST
Definition: putslave.h:7
PD3
#define PD3
Definition: variant.h:58
_uartslave_t
Definition: uartslave.h:32
hwio_beeper_set_vol
void hwio_beeper_set_vol(float vol)
Definition: hwio_a3ides_2209_02.c:483
tmc_set_move
void tmc_set_move(uint8_t tmc, uint32_t step, uint8_t dir, uint8_t speed)
stepper
Stepper stepper
Definition: stepper.cpp:82
diag.h
sys.h
marlin_server_enqueue_gcode
int marlin_server_enqueue_gcode(const char *gcode)
Definition: marlin_server.cpp:318
_uartslave_t::flags
uint8_t flags
Definition: uartslave.h:34
hwio_pwm_set_val
void hwio_pwm_set_val(int i_pwm, int val)
Definition: hwio_a3ides_2209_02.c:376
PD10
#define PD10
Definition: variant.h:80
osThreadResume
osStatus osThreadResume(osThreadId thread_id)
Resume execution of a suspended thread.
Definition: cmsis_os.c:1494
marlin_server_stop_processing
void marlin_server_stop_processing(void)
Definition: marlin_server.cpp:293
sys_fw_validate
int sys_fw_validate(void)
Definition: sys.cpp:281
_validate_serial
int _validate_serial(const char *str)
Definition: putslave.c:237
EEVAR_RUN_FIRSTLAY
#define EEVAR_RUN_FIRSTLAY
Definition: eeprom.h:16
PUTSLAVE_CMD_ID_TST
#define PUTSLAVE_CMD_ID_TST
Definition: putslave.h:16
hwio_adc_get_val
int hwio_adc_get_val(int i_adc)
Definition: hwio_a3ides_2209_02.c:245
state
static volatile fsensor_t state
Definition: filament_sensor.c:23
tmc_set_mres
void tmc_set_mres()
putslave_do_cmd_q_pwm
int putslave_do_cmd_q_pwm(uartslave_t *pslave, char *pstr)
Definition: putslave.c:170
version_firmware_name
const char version_firmware_name[]
Definition: version.c:24
putslave_do_cmd_q_btim
int putslave_do_cmd_q_btim(uartslave_t *pslave)
Definition: putslave.c:115
eeprom_set_var
void eeprom_set_var(uint8_t id, variant8_t var)
Definition: eeprom.c:88
PUTSLAVE_CMD_ID_GPIO
#define PUTSLAVE_CMD_ID_GPIO
Definition: putslave.h:23
eeprom_clear
void eeprom_clear(void)
Definition: eeprom.c:201
putslave_do_cmd_a_mac
int putslave_do_cmd_a_mac(uartslave_t *pslave, char *pstr)
Definition: putslave.c:304
OTP_SERIAL_NUMBER_ADDR
#define OTP_SERIAL_NUMBER_ADDR
Definition: otp.h:14
diag_fastboot
int diag_fastboot
Definition: diag.c:11
dbg.h
putslave_do_cmd_a_start
int putslave_do_cmd_a_start(uartslave_t *pslave)
Definition: putslave.c:345
PUTSLAVE_CMD_ID_SER
#define PUTSLAVE_CMD_ID_SER
Definition: putslave.h:9
putslave_do_cmd_a_pwm
int putslave_do_cmd_a_pwm(uartslave_t *pslave, char *pstr)
Definition: putslave.c:420
OTP_MAC_ADDRESS_SIZE
#define OTP_MAC_ADDRESS_SIZE
Definition: otp.h:19
putslave_do_cmd_a_ten
int putslave_do_cmd_a_ten(uartslave_t *pslave, char *pstr)
Definition: putslave.c:493
putslave_do_cmd_a_eecl
int putslave_do_cmd_a_eecl(uartslave_t *pslave)
Definition: putslave.c:383
putslave_do_cmd_q_brev
int putslave_do_cmd_q_brev(uartslave_t *pslave)
Definition: putslave.c:109
app_setup
void app_setup(void)
Definition: appmain.cpp:51
_uartrxbuff_t::phuart
UART_HandleTypeDef * phuart
Definition: uartrxbuff.h:17
putslave_do_cmd_a_gpio
int putslave_do_cmd_a_gpio(uartslave_t *pslave, char *pstr)
Definition: putslave.c:388
UARTSLAVE_CMD_ID_UNK
#define UARTSLAVE_CMD_ID_UNK
Definition: uartslave.h:12
diag_test
void diag_test(void)
Definition: diag.c:49
GPIO_PULLUP
#define GPIO_PULLUP
Definition: stm32f4xx_hal_gpio.h:171
HAL_SPI_MspDeInit
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi)
SPI MSP De-Initialization This function freeze the hardware resources used in this example.
Definition: stm32f4xx_hal_msp.c:337
idleTaskHandle
osThreadId idleTaskHandle
Definition: main.c:99
gpio_get
static int gpio_get(uint8_t pin8)
Definition: gpio.h:94
UARTSLAVE_FLG_ECHO
#define UARTSLAVE_FLG_ECHO
Definition: uartslave.h:7
putslave_do_cmd_q_ip4
int putslave_do_cmd_q_ip4(uartslave_t *pslave)
Definition: putslave.c:134
_PWM_HEATER_0
#define _PWM_HEATER_0
Definition: hwio_a3ides.h:41
sys_flash_write
int sys_flash_write(void *dst, void *src, int size)
Definition: sys.cpp:293
UARTSLAVE_ERR_ONP
#define UARTSLAVE_ERR_ONP
Definition: uartslave.h:19
putslave_do_cmd_q_ser
int putslave_do_cmd_q_ser(uartslave_t *pslave)
Definition: putslave.c:103
PUTSLAVE_CMD_ID_TDG
#define PUTSLAVE_CMD_ID_TDG
Definition: putslave.h:32
putslave_do_cmd_q_lock
int putslave_do_cmd_q_lock(uartslave_t *pslave)
Definition: putslave.c:144
EEVAR_RUN_XYZCALIB
#define EEVAR_RUN_XYZCALIB
Definition: eeprom.h:15
hwio_beeper_tone
void hwio_beeper_tone(float frq, uint32_t del)
Definition: hwio_a3ides_2209_02.c:514
UARTSLAVE_ERR_CNF
#define UARTSLAVE_ERR_CNF
Definition: uartslave.h:21
EEVAR_RUN_SELFTEST
#define EEVAR_RUN_SELFTEST
Definition: eeprom.h:14
gpio_init
static void gpio_init(uint8_t pin8, uint32_t mode, uint32_t pull, uint32_t speed)
Definition: gpio.h:102
putslave_do_cmd_a_i2c
int putslave_do_cmd_a_i2c(uartslave_t *pslave)
Definition: putslave.c:484
PUTSLAVE_CMD_ID_TEN
#define PUTSLAVE_CMD_ID_TEN
Definition: putslave.h:30
sys_fw_is_valid
int sys_fw_is_valid(void)
Definition: sys.cpp:266
PUTSLAVE_CMD_ID_START
#define PUTSLAVE_CMD_ID_START
Definition: putslave.h:18
putslave_do_cmd_a_stop
int putslave_do_cmd_a_stop(uartslave_t *pslave)
Definition: putslave.c:362
OTP_BOARD_TIME_STAMP_SIZE
#define OTP_BOARD_TIME_STAMP_SIZE
Definition: otp.h:11
hwio_pwm_get_max
int hwio_pwm_get_max(int i_pwm)
Definition: hwio_a3ides_2209_02.c:276
putslave_do_cmd_q_gpup
int putslave_do_cmd_q_gpup(uartslave_t *pslave, char *pstr)
Definition: putslave.c:201
putslave_do_cmd_q_uid
int putslave_do_cmd_q_uid(uartslave_t *pslave)
Definition: putslave.c:128
PUTSLAVE_CMD_ID_EECL
#define PUTSLAVE_CMD_ID_EECL
Definition: putslave.h:21
putslave_do_cmd_a_btim
int putslave_do_cmd_a_btim(uartslave_t *pslave, char *pstr)
Definition: putslave.c:290
GPIO_NOPULL
#define GPIO_NOPULL
Definition: stm32f4xx_hal_gpio.h:170
lwip.h
osThreadSuspend
osStatus osThreadSuspend(osThreadId thread_id)
Suspend execution of a thread.
Definition: cmsis_os.c:1478
netif_default
struct netif * netif_default
Definition: netif.c:105
sim_motion.h
GPIO_SPEED_FREQ_VERY_HIGH
#define GPIO_SPEED_FREQ_VERY_HIGH
Definition: stm32f4xx_hal_gpio.h:161
_PWM_HEATER_BED
#define _PWM_HEATER_BED
Definition: hwio_a3ides.h:40
PUTSLAVE_CMD_ID_BTIM
#define PUTSLAVE_CMD_ID_BTIM
Definition: putslave.h:11
gpio.h
uart1rxbuff
uartrxbuff_t uart1rxbuff
Definition: main.c:144
putslave_do_cmd_q_adc
int putslave_do_cmd_q_adc(uartslave_t *pslave, char *pstr)
Definition: putslave.c:150
OTP_LOCK_BLOCK_ADDR
#define OTP_LOCK_BLOCK_ADDR
Definition: otp.h:22
sys_flash_is_empty
int sys_flash_is_empty(void *ptr, int size)
Definition: sys.cpp:285
uint8_t
const uint8_t[]
Definition: 404_html.c:3
sys_fw_invalidate
int sys_fw_invalidate(void)
Definition: sys.cpp:271
putslave_do_cmd_q_diag
int putslave_do_cmd_q_diag(uartslave_t *pslave, char *pstr)
Definition: putslave.c:194
hspi2
SPI_HandleTypeDef hspi2
Definition: main.c:81
HAL_I2C_Master_Transmit
HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout)
putslave_do_cmd_a_ser
int putslave_do_cmd_a_ser(uartslave_t *pslave, char *pstr)
Definition: putslave.c:258
tmc_get_diag
uint8_t tmc_get_diag()
PUTSLAVE_CMD_ID_UART
#define PUTSLAVE_CMD_ID_UART
Definition: putslave.h:28
putslave_do_cmd_a_lock
int putslave_do_cmd_a_lock(uartslave_t *pslave)
Definition: putslave.c:437
putslave_do_cmd_q_gpio
int putslave_do_cmd_q_gpio(uartslave_t *pslave, char *pstr)
Definition: putslave.c:160
hi2c1
I2C_HandleTypeDef hi2c1
Definition: main.c:77
PUTSLAVE_CMD_ID_PWM
#define PUTSLAVE_CMD_ID_PWM
Definition: putslave.h:25
putslave_init
void putslave_init(uartslave_t *pslave)
Definition: putslave.c:619
OTP_BOARD_REVISION_SIZE
#define OTP_BOARD_REVISION_SIZE
Definition: otp.h:7
otp.h
OTP_STM32_UUID_ADDR
#define OTP_STM32_UUID_ADDR
Definition: otp.h:26
main.h
: Header for main.c file. This file contains the common defines of the application.
PUTSLAVE_CMD_ID_BREV
#define PUTSLAVE_CMD_ID_BREV
Definition: putslave.h:10
OTP_BOARD_TIME_STAMP_ADDR
#define OTP_BOARD_TIME_STAMP_ADDR
Definition: otp.h:10
PA0
#define PA0
Definition: variant.h:95
_uartslave_t::do_cmd
uartslave_do_cmd_t * do_cmd
Definition: uartslave.h:40
PB10
#define PB10
Definition: variant.h:116
UARTSLAVE_ERR_UNK
#define UARTSLAVE_ERR_UNK
Definition: uartslave.h:15
putslave_do_cmd
int putslave_do_cmd(uartslave_t *pslave, uint16_t mod_msk, char cmd, uint16_t cmd_id, char *pstr)
Definition: putslave.c:538
putslave_init
void putslave_init(uartslave_t *pslave)
Definition: putslave.c:619
UARTSLAVE_OK
#define UARTSLAVE_OK
Definition: uartslave.h:14
app.h
gpio_set
static void gpio_set(uint8_t pin8, int state)
Definition: gpio.h:98
put_setup_done
int put_setup_done
Definition: putslave.c:343
version.h
putslave.h
PUTSLAVE_CMD_ID_GPUP
#define PUTSLAVE_CMD_ID_GPUP
Definition: putslave.h:33
putslave_do_cmd_q_tste
int putslave_do_cmd_q_tste(uartslave_t *pslave, char *pstr)
Definition: putslave.c:179
PD14
#define PD14
Definition: variant.h:76
marlin_server_start_processing
void marlin_server_start_processing(void)
Definition: marlin_server.cpp:288
version_version
const char version_version[]
semantic version (https://semver.org) is Prusa3D standard
Definition: version.c:31
putslave_do_cmd_a_move
int putslave_do_cmd_a_move(uartslave_t *pslave, char *pstr)
Definition: putslave.c:507
diag_error
int diag_error
Definition: diag.c:13
PC2
#define PC2
Definition: variant.h:93
OTP_BOARD_REVISION_ADDR
#define OTP_BOARD_REVISION_ADDR
Definition: otp.h:6
hwio_pindef.h
HAL_MAX_DELAY
#define HAL_MAX_DELAY
Definition: stm32f4xx_hal_def.h:76
PUTSLAVE_CMD_ID_UID
#define PUTSLAVE_CMD_ID_UID
Definition: putslave.h:13
hwio_a3ides.h
GPIO_MODE_INPUT
#define GPIO_MODE_INPUT
Definition: stm32f4xx_hal_gpio.h:135
PD2
#define PD2
Definition: variant.h:59
UARTSLAVE_CMD_ID_0
#define UARTSLAVE_CMD_ID_0
Definition: uartslave.h:11
OTP_SERIAL_NUMBER_SIZE
#define OTP_SERIAL_NUMBER_SIZE
Definition: otp.h:15
webServerTaskHandle
osThreadId webServerTaskHandle
Definition: main.c:100
PUTSLAVE_CMD_ID_I2C
#define PUTSLAVE_CMD_ID_I2C
Definition: putslave.h:29
PUTSLAVE_CMD_ID_LOCK
#define PUTSLAVE_CMD_ID_LOCK
Definition: putslave.h:15
putslave_do_cmd_q_tdg
int putslave_do_cmd_q_tdg(uartslave_t *pslave)
Definition: putslave.c:222
tmc_set_sgthrs
void tmc_set_sgthrs(uint8_t SGT)
displayTaskHandle
osThreadId displayTaskHandle
Definition: main.c:98
defaultTaskHandle
osThreadId defaultTaskHandle
Definition: main.c:97
_uartslave_t::parse_cmd_id
uartslave_parse_cmd_id_t * parse_cmd_id
Definition: uartslave.h:39
cmsis_os.h
Header of cmsis_os.c A new set of APIs are added in addition to existing ones, these APIs are specifi...
PUTSLAVE_CMD_ID_VER
#define PUTSLAVE_CMD_ID_VER
Definition: putslave.h:8
putslave_do_cmd_a_tone
int putslave_do_cmd_a_tone(uartslave_t *pslave, char *pstr)
Definition: putslave.c:323
PUTSLAVE_CMD_ID_TONE
#define PUTSLAVE_CMD_ID_TONE
Definition: putslave.h:17
PUTSLAVE_CMD_ID_IP4
#define PUTSLAVE_CMD_ID_IP4
Definition: putslave.h:14
putslave_parse_cmd_id
int putslave_parse_cmd_id(uartslave_t *pslave, char *pstr, uint16_t *pcmd_id)
Definition: putslave.c:24
PUTSLAVE_CMD_ID_DIAG
#define PUTSLAVE_CMD_ID_DIAG
Definition: putslave.h:27
I2C_HandleTypeDef
I2C handle Structure definition.
Definition: stm32f4xx_hal_i2c.h:164
PE15
#define PE15
Definition: variant.h:115
HAL_UART_Transmit
HAL_StatusTypeDef HAL_UART_Transmit(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size, uint32_t Timeout)
marlin_server_processing
int marlin_server_processing(void)
Definition: marlin_server.cpp:284