Compare commits
No commits in common. "37e2c78b0bff2fd5f1956eaaee00bc7ba3fcb5b5" and "532262f67052227abbff7bb4fb63f08c606d1892" have entirely different histories.
37e2c78b0b
...
532262f670
6
stm-firmware/.gitignore
vendored
6
stm-firmware/.gitignore
vendored
@ -8,9 +8,3 @@ reflow-controller.cxxflags
|
||||
reflow-controller.files
|
||||
reflow-controller.includes
|
||||
*.creator.user
|
||||
*.cflags
|
||||
*.creator
|
||||
*.cxxflags
|
||||
*.includes
|
||||
*.config
|
||||
*.files
|
||||
|
@ -47,9 +47,8 @@ CFILES += temp-converter.c
|
||||
|
||||
CFILES += rotary-encoder.c
|
||||
|
||||
CFILES += stack-check.c
|
||||
|
||||
DEFINES += -DDEBUGBUILD
|
||||
#TODO
|
||||
|
||||
###################################################################################
|
||||
CC=arm-none-eabi-gcc
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -13,7 +13,7 @@ license_header = """/* Reflow Oven Controller
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -14,7 +14,7 @@ license_header = """/* Reflow Oven Controller
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -1,41 +0,0 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 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.
|
||||
*
|
||||
* GDSII-Converter 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 __STACK_CHECK_H__
|
||||
#define __STACK_CHECK_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define STACK_CHECK_MIN_HEAP_GAP 16UL
|
||||
|
||||
int32_t stack_check_get_usage();
|
||||
|
||||
int32_t stack_check_get_free();
|
||||
|
||||
static inline uint32_t read_stack_pointer()
|
||||
{
|
||||
uint32_t stack_pointer;
|
||||
|
||||
__asm__ __volatile__ ("mov %0, sp\n\t" : "=r"(stack_pointer) : : );
|
||||
|
||||
return stack_pointer;
|
||||
}
|
||||
|
||||
#endif /* __STACK_CHECK_H__ */
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
@ -75,7 +75,7 @@ int main()
|
||||
|
||||
shell_handle = shell_init();
|
||||
|
||||
while (1) {
|
||||
while(1) {
|
||||
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
||||
rot = rotary_encoder_get_abs_val();
|
||||
uart_receive_status = uart_receive_data_with_dma(&uart_input, &uart_input_len);
|
||||
@ -84,3 +84,5 @@ int main()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
@ -29,8 +29,6 @@
|
||||
#include <stm-periph/unique-id.h>
|
||||
#include <reflow-controller/calibration.h>
|
||||
#include <reflow-controller/temp-converter.h>
|
||||
|
||||
#include <reflow-controller/stack-check.h>
|
||||
#include <reflow-controller/rotary-encoder.h>
|
||||
|
||||
#ifndef GIT_VER
|
||||
@ -48,8 +46,8 @@ static shellmatta_retCode_t write_shell_callback(const char *data, uint32_t len)
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_ver(const shellmatta_handle_t handle,
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
@ -60,22 +58,22 @@ static shellmatta_retCode_t shell_cmd_ver(const shellmatta_handle_t handle,
|
||||
unique_id_get(&high_id, &mid_id, &low_id);
|
||||
|
||||
shellmatta_printf(handle, "Reflow Oven Controller Firmware " xstr(GIT_VER) "\r\n"
|
||||
"Compiled: " __DATE__ " at " __TIME__ "\r\n"
|
||||
"Serial: %08X-%08X-%08X", high_id, mid_id, low_id);
|
||||
"Compiled: " __DATE__ " at " __TIME__ "\r\n"
|
||||
"Serial: %08X-%08X-%08X", high_id, mid_id, low_id);
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_digio_get(const shellmatta_handle_t handle,
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
|
||||
shellmatta_printf(handle,
|
||||
"DIGIO0 DIGIO1 DIGIO2 DIGIO3 LED0 LED1 LS\r\n"
|
||||
"%d %d %d %d %d %d %d\r\n",
|
||||
"DIGIO0 DIGIO1 DIGIO2 DIGIO3 LED0 LED1 LS\r\n"
|
||||
"%d %d %d %d %d %d %d\r\n",
|
||||
digio_get(0), digio_get(1), digio_get(2), digio_get(3),
|
||||
led_get(0), led_get(1), loudspeaker_get());
|
||||
|
||||
@ -83,8 +81,8 @@ static shellmatta_retCode_t shell_cmd_digio_get(const shellmatta_handle_t hand
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_digio_set(const shellmatta_handle_t handle,
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)length;
|
||||
(void)handle;
|
||||
@ -195,8 +193,8 @@ static shellmatta_retCode_t shell_cmd_uptime(const shellmatta_handle_t handle,
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_cal(const shellmatta_handle_t handle,
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
@ -205,30 +203,12 @@ static shellmatta_retCode_t shell_cmd_cal(const shellmatta_handle_t handle,
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_get_sp(const shellmatta_handle_t handle,
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
|
||||
shellmatta_printf(handle,
|
||||
"Stack pointer: %p\r\n"
|
||||
"Stack usage: 0x%x bytes\r\n"
|
||||
"Lim to heap: 0x%x bytes\r\n",
|
||||
read_stack_pointer(),
|
||||
stack_check_get_usage(),
|
||||
stack_check_get_free());
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_rot(const shellmatta_handle_t handle,
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
|
||||
uint32_t rot_val;
|
||||
int32_t delta;
|
||||
|
||||
@ -238,7 +218,6 @@ static shellmatta_retCode_t shell_cmd_rot(const shellmatta_handle_t handle,
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
//typedef struct shellmatta_cmd
|
||||
//{
|
||||
// char *cmd; /**< command name */
|
||||
@ -249,7 +228,7 @@ static shellmatta_retCode_t shell_cmd_rot(const shellmatta_handle_t handle,
|
||||
// struct shellmatta_cmd *next; /**< pointer to next command or NULL */
|
||||
//} shellmatta_cmd_t;
|
||||
|
||||
static shellmatta_cmd_t cmd[9] = {
|
||||
static shellmatta_cmd_t cmd[8] = {
|
||||
{
|
||||
.cmd = "version",
|
||||
.cmdAlias = "ver",
|
||||
@ -306,14 +285,6 @@ static shellmatta_cmd_t cmd[9] = {
|
||||
.cmdFct = shell_cmd_cal,
|
||||
.next = &cmd[7],
|
||||
},
|
||||
{
|
||||
.cmd = "get-stack-pointer",
|
||||
.cmdAlias = "sp",
|
||||
.helpText = "Get the stack pointer",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_get_sp,
|
||||
.next = &cmd[8],
|
||||
},
|
||||
{
|
||||
.cmd = "rotary-encoder",
|
||||
.cmdAlias = "rot",
|
||||
@ -330,7 +301,7 @@ shellmatta_handle_t shell_init(void)
|
||||
shellmatta_retCode_t ret;
|
||||
|
||||
ret = shellmatta_doInit(&shell, &handle, shell_buffer, sizeof(shell_buffer), history_buffer, sizeof(history_buffer),
|
||||
"\e[1;32mEnter command:\e[m\r\n", cmd, write_shell_callback);
|
||||
"\e[1;32mEnter command:\e[m\r\n", cmd, write_shell_callback);
|
||||
if (ret != SHELLMATTA_OK)
|
||||
handle = NULL;
|
||||
|
||||
@ -340,10 +311,10 @@ shellmatta_handle_t shell_init(void)
|
||||
|
||||
void shell_handle_input(shellmatta_handle_t shell, const char *data, size_t len)
|
||||
{
|
||||
if (!shell)
|
||||
return;
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
shellmatta_processData(shell, (char *)data, (uint32_t)len);
|
||||
shellmatta_processData(shell, (char *)data, (uint32_t)len);
|
||||
}
|
||||
|
||||
void shell_print_string(shellmatta_handle_t shell, const char *string)
|
||||
|
@ -1,47 +0,0 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 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/>.
|
||||
*/
|
||||
|
||||
#include <reflow-controller/stack-check.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern char _estack;
|
||||
extern char heap_top;
|
||||
|
||||
int32_t stack_check_get_usage()
|
||||
{
|
||||
uint32_t stack_top;
|
||||
uint32_t stack_ptr;
|
||||
|
||||
stack_ptr = read_stack_pointer();
|
||||
stack_top = (uint32_t)&_estack;
|
||||
|
||||
return stack_top - stack_ptr;
|
||||
}
|
||||
|
||||
int32_t stack_check_get_free()
|
||||
{
|
||||
uint32_t upper_heap_boundary;
|
||||
uint32_t stack_ptr;
|
||||
|
||||
stack_ptr = read_stack_pointer();
|
||||
upper_heap_boundary = (uint32_t)&heap_top;
|
||||
|
||||
return stack_ptr - upper_heap_boundary;
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
@ -66,9 +66,7 @@ void uart_disable()
|
||||
UART_PERIPH->CR3 = 0;
|
||||
dma_ring_buffer_periph_to_mem_stop(&ring_buff_rx);
|
||||
dma_ring_buffer_mem_to_periph_stop(&ring_buff_tx);
|
||||
#ifdef DEBUGBUILD
|
||||
rcc_manager_disable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(UART_PORT_RCC_MASK));
|
||||
#endif
|
||||
rcc_manager_disable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(UART_PORT_RCC_MASK));
|
||||
rcc_manager_disable_clock(&RCC->APB2ENR, BITMASK_TO_BITNO(UART_RCC_MASK));
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* 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,
|
||||
* GDSII-Converter 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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user