diff --git a/stm-firmware/include/reflow-controller/shell-uart-config.h b/stm-firmware/include/reflow-controller/shell-uart-config.h new file mode 100644 index 0000000..b9141c4 --- /dev/null +++ b/stm-firmware/include/reflow-controller/shell-uart-config.h @@ -0,0 +1,33 @@ +#ifndef __SHELL_UART_CONFIG_H__ +#define __SHELL_UART_CONFIG_H__ + +#define SHELL_UART_RECEIVE_DMA_STREAM DMA2_Stream5 + +#define SHELL_UART_SEND_DMA_STREAM DMA2_Stream7 + +#define SHELL_UART_PERIPH USART1 +#define SHELL_UART_RCC_REG RCC->APB2ENR +#define SHELL_UART_RCC_MASK RCC_APB2ENR_USART1EN + +#define SHELL_UART_RX_DMA_TRIGGER 4U +#define SHELL_UART_TX_DMA_TRIGGER 4U + +#ifdef DEBUGBUILD + +#define SHELL_UART_PORT GPIOA +#define SHELL_UART_PORT_RCC_MASK RCC_AHB1ENR_GPIOAEN +#define SHELL_UART_RX_PIN 10 +#define SHELL_UART_TX_PIN 9 +#define SHELL_UART_RX_PIN_ALTFUNC 7 +#define SHELL_UART_TX_PIN_ALTFUNC 7 +#else + +#endif + +/* UART_DIV is 45.5625 => 115200 @ 84 MHz */ +#define SHELL_UART_DIV_FRACTION 9U /* Equals 9/16 = 0.5625 */ +#define SHELL_UART_DIV_MANTISSA 45U /* Equals 45 */ + +#define SHELL_UART_BRR_REG_VALUE ((SHELL_UART_DIV_MANTISSA<<4) | SHELL_UART_DIV_FRACTION); + +#endif /* __SHELL_UART_CONFIG_H__ */ diff --git a/stm-firmware/include/reflow-controller/shell.h b/stm-firmware/include/reflow-controller/shell.h index a93c9aa..72a94d2 100644 --- a/stm-firmware/include/reflow-controller/shell.h +++ b/stm-firmware/include/reflow-controller/shell.h @@ -24,7 +24,7 @@ #include #include -shellmatta_handle_t shell_init(void); +shellmatta_handle_t shell_init(shellmatta_write_t write_func); void shell_handle_input(shellmatta_handle_t shell, const char *data, size_t len);