Add a bunch of stuff: Add baudrate reconfig command to shell and move the uart to separate C file
This commit is contained in:
@@ -25,9 +25,11 @@
|
||||
#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_DEFAULT_DIV_FRACTION 9U /* Equals 9/16 = 0.5625 */
|
||||
#define SHELL_UART_DEFAULT_DIV_MANTISSA 45U /* Equals 45 */
|
||||
|
||||
#define SHELL_UART_BRR_REG_VALUE ((SHELL_UART_DIV_MANTISSA<<4) | SHELL_UART_DIV_FRACTION);
|
||||
#define SHELL_UART_DEFAULT_BRR_REG_VALUE ((SHELL_UART_DEFAULT_DIV_MANTISSA<<4) | SHELL_UART_DEFAULT_DIV_FRACTION);
|
||||
|
||||
#define SHELL_UART_PERIPHERAL_CLOCK (84000000UL)
|
||||
|
||||
#endif /* __SHELL_UART_CONFIG_H__ */
|
||||
|
@@ -25,7 +25,8 @@
|
||||
* @brief Convert PT1000 resistance to temperature in degrees celsius
|
||||
* @param resistance PT1000 resistance value
|
||||
* @param[out] temp_out Temperature output
|
||||
* @return 0 if ok, -1 if value is below conversion range, 1 if value is above conversion range,-1000 in case of pointer error
|
||||
* @return 0 if ok, -1 if value is below conversion range, 1 if value is above conversion range,
|
||||
* -1000 in case of pointer error
|
||||
*/
|
||||
int temp_converter_convert_resistance_to_temp(float resistance, float *temp_out);
|
||||
|
||||
|
51
stm-firmware/include/reflow-controller/ui/shell-uart.h
Normal file
51
stm-firmware/include/reflow-controller/ui/shell-uart.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2021 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_UART_H__
|
||||
|
||||
#include <shellmatta.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @brief Configure the UART for the shellmatta shell.
|
||||
*
|
||||
* This will configure the UART for use with a DMA ring buffer.
|
||||
* @param uart
|
||||
*/
|
||||
void shell_uart_setup(void);
|
||||
|
||||
shellmatta_retCode_t shell_uart_write_callback(const char *data, uint32_t len);
|
||||
|
||||
int shell_uart_receive_data_with_dma(const char **data, size_t *len);
|
||||
|
||||
/**
|
||||
* @brief Configure a new connection speed.
|
||||
* @param new_baud Baudrate. E.g: 115200
|
||||
* @return Error in permille (1/1000). A return value of 2 means a baudrate error of: 0.002 or 0.2%.
|
||||
* Return value is negative in case of a hard error.
|
||||
*/
|
||||
int32_t shell_uart_reconfig_baud(uint32_t new_baud);
|
||||
|
||||
uint32_t shell_uart_get_current_baudrate(void);
|
||||
|
||||
#define __SHELL_UART_H__
|
||||
|
||||
#endif /* __SHELL_UART_H__ */
|
Reference in New Issue
Block a user