diff --git a/Terminal.c b/Terminal.c new file mode 100644 index 0000000..a3d61a2 --- /dev/null +++ b/Terminal.c @@ -0,0 +1,304 @@ +/* + * Terminal.c + * + * Created on: Jul 13, 2021 + * Author: angoosh + */ +#include "Terminal.h" +#include "main.h" + + +uint8_t pointr = 0; +uint8_t RX[1]; +uint8_t termRxBuffer[TERM_BUFFER_SIZE]; + + +UART_HandleTypeDef huart3; + + +uint8_t msgOk[] = {"\nOK\n"}; +uint8_t msgBlank[] = {"> "}; +uint8_t msgNoGpioPort[] = {"\nNo such GPIO port\n"}; +uint8_t msgUnknownParameter[] = {"\nUnknown parameter\n"}; +uint8_t msgNL = '\n'; + +/** + * @brief Callback for uart byte by byte receive + */ +void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){ + termRxBuffer[pointr] = RX[0]; + pointr++; + HAL_UART_Receive_IT(&huart3, RX, 1); +} + +/** + * @brief Readout whole receive buffer, for debug + */ +void PrintRxBuffer(){ + for(int l = 0; l +#include + +#define LIB_VERSION "0.1" + +#define TERM_BUFFER_SIZE 255 //size of terminal buffer + + +void PrintRxBuffer(); +void ReadBuffer(); +void TerminalInit(); + + +#endif /* INC_TERMINAL_H_ */