| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -29,7 +29,9 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#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
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#define GIT_VER "VERSION NOT SET"
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -46,8 +48,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;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -58,22 +60,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());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -81,8 +83,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;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -193,8 +195,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;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -204,19 +206,36 @@ static shellmatta_retCode_t shell_cmd_cal(const shellmatta_handle_t   handle,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				static shellmatta_retCode_t shell_get_sp(const shellmatta_handle_t   handle,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										  const char                  *arguments,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										  uint32_t length)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									 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());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							  "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)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					(void)arguments;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					(void)length;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					uint32_t rot_val;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					int32_t delta;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					rot_val = rotary_encoder_get_abs_val();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					delta = rotary_encoder_get_change_val();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					shellmatta_printf(handle, "Rotary encoder value: %u, delta: %d\r\n", rot_val, delta);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					return SHELLMATTA_OK;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -230,7 +249,7 @@ static shellmatta_retCode_t shell_get_sp(const shellmatta_handle_t   handle,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				//    struct shellmatta_cmd   *next;      /**< pointer to next command or NULL        */
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				//} shellmatta_cmd_t;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				static shellmatta_cmd_t cmd[8] = {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				static shellmatta_cmd_t cmd[9] = {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.cmd = "version",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.cmdAlias = "ver",
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -293,6 +312,14 @@ static shellmatta_cmd_t cmd[8] = {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.helpText = "Get the stack pointer",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.usageText = "",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.cmdFct = shell_get_sp,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.next = &cmd[8],
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					},
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					{
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.cmd = "rotary-encoder",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.cmdAlias = "rot",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.helpText = "Get current rotary encoder value",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.usageText = "",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.cmdFct = shell_cmd_rot,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						.next = NULL,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				};
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -303,7 +330,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;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -313,10 +340,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)
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				 
 |