Reflow Controller GUI: Move gui to gui.c file in UI subfolder
This commit is contained in:
		@@ -42,7 +42,7 @@ CFILES += stm-periph/unique-id.c
 | 
				
			|||||||
CFILES += calibration.c
 | 
					CFILES += calibration.c
 | 
				
			||||||
CFILES += temp-converter.c
 | 
					CFILES += temp-converter.c
 | 
				
			||||||
CFILES += rotary-encoder.c button.c
 | 
					CFILES += rotary-encoder.c button.c
 | 
				
			||||||
CFILES += ui/lcd.c ui/menu.c reflow-menu.c
 | 
					CFILES += ui/lcd.c ui/menu.c ui/gui.c
 | 
				
			||||||
CFILES += fatfs/diskio.c fatfs/ff.c fatfs/ffsystem.c fatfs/ffunicode.c fatfs/shimatta_sdio_driver/shimatta_sdio.c
 | 
					CFILES += fatfs/diskio.c fatfs/ff.c fatfs/ffsystem.c fatfs/ffunicode.c fatfs/shimatta_sdio_driver/shimatta_sdio.c
 | 
				
			||||||
CFILES += pid-controller.c oven-driver.c
 | 
					CFILES += pid-controller.c oven-driver.c
 | 
				
			||||||
CFILES += settings/settings.c settings/settings-sd-card.c
 | 
					CFILES += settings/settings.c settings/settings-sd-card.c
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										31
									
								
								stm-firmware/include/reflow-controller/hw-version-detect.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								stm-firmware/include/reflow-controller/hw-version-detect.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					#ifndef _HW_VERSION_DETECT_H_
 | 
				
			||||||
 | 
					#define _HW_VERSION_DETECT_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdint.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum hw_revision {
 | 
				
			||||||
 | 
						HW_REV_NOT_DETECTED = 0,
 | 
				
			||||||
 | 
						HW_REV_ERROR = 1,
 | 
				
			||||||
 | 
						HW_REV_V1_2 = 120,
 | 
				
			||||||
 | 
						HW_REV_V1_3 = 130,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @brief This function returns the hardware version of the PCB.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This is used to
 | 
				
			||||||
 | 
					 * determine the feature set of the hardware. So this firmware can be used on all hardwares.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The first hardware revision supported, is: v1.2
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * The function returns the HW revision as an enum hw_revision.
 | 
				
			||||||
 | 
					 * For v1.2 the return value is 120 (HW_REV_V1_2).
 | 
				
			||||||
 | 
					 * For v1.3 the return value is 130 (HW_REV_V1_3).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Other return values are not defined yet.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @return Harware revision
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					enum hw_revision get_pcb_hardware_version(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* _HW_VERSION_DETECT_H_ */
 | 
				
			||||||
@@ -18,15 +18,15 @@
 | 
				
			|||||||
* If not, see <http://www.gnu.org/licenses/>.
 | 
					* If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __REFLOW_MENU_H__
 | 
					#ifndef _GUI_H_
 | 
				
			||||||
#define __REFLOW_MENU_H__
 | 
					#define _GUI_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @brief Handle the reflow controller's LCD Menu
 | 
					 * @brief Handle the reflow controller's LCD Menu
 | 
				
			||||||
 * @return 0 if no delay is requested, 1 if delay is requested
 | 
					 * @return 0 if no delay is requested, 1 if delay is requested
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int reflow_menu_handle(void);
 | 
					int gui_handle(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void reflow_menu_init(void);
 | 
					void gui_init(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* __REFLOW_MENU_H__ */
 | 
					#endif /* _GUI_H_ */
 | 
				
			||||||
@@ -18,7 +18,7 @@
 | 
				
			|||||||
* If not, see <http://www.gnu.org/licenses/>.
 | 
					* If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <reflow-controller/reflow-menu.h>
 | 
					#include <reflow-controller/ui/gui.h>
 | 
				
			||||||
#include <reflow-controller/ui/menu.h>
 | 
					#include <reflow-controller/ui/menu.h>
 | 
				
			||||||
#include <reflow-controller/ui/lcd.h>
 | 
					#include <reflow-controller/ui/lcd.h>
 | 
				
			||||||
#include <reflow-controller/rotary-encoder.h>
 | 
					#include <reflow-controller/rotary-encoder.h>
 | 
				
			||||||
@@ -54,7 +54,7 @@ static void update_display_buffer(uint8_t row, const char *data)
 | 
				
			|||||||
	display_buffer[row][i] = 0;
 | 
						display_buffer[row][i] = 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void reflow_menu_monitor(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
 | 
					static void gui_menu_monitor(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static void *my_parent;
 | 
						static void *my_parent;
 | 
				
			||||||
	static uint64_t my_timestamp = 0;
 | 
						static uint64_t my_timestamp = 0;
 | 
				
			||||||
@@ -104,7 +104,7 @@ static void reflow_menu_monitor(struct lcd_menu *menu, enum menu_entry_func_entr
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void reflow_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
 | 
					static void gui_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static void *my_parent;
 | 
						static void *my_parent;
 | 
				
			||||||
	static int page = 0;
 | 
						static int page = 0;
 | 
				
			||||||
@@ -217,7 +217,7 @@ static void reflow_menu_about(struct lcd_menu *menu, enum menu_entry_func_entry
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void reflow_menu_err_flags(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
 | 
					static void gui_menu_err_flags(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static void *my_parent = NULL;
 | 
						static void *my_parent = NULL;
 | 
				
			||||||
	static uint8_t offset;
 | 
						static uint8_t offset;
 | 
				
			||||||
@@ -297,7 +297,7 @@ static void reflow_menu_err_flags(struct lcd_menu *menu, enum menu_entry_func_en
 | 
				
			|||||||
	timestamp = systick_get_global_tick();
 | 
						timestamp = systick_get_global_tick();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void reflow_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
 | 
					static void gui_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_entry entry_type, void *parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	(void)parent;
 | 
						(void)parent;
 | 
				
			||||||
	static struct menu_list list;
 | 
						static struct menu_list list;
 | 
				
			||||||
@@ -309,9 +309,9 @@ static void reflow_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_e
 | 
				
			|||||||
		NULL
 | 
							NULL
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	static const menu_func_t root_entry_funcs[] = {
 | 
						static const menu_func_t root_entry_funcs[] = {
 | 
				
			||||||
		reflow_menu_about,
 | 
							gui_menu_about,
 | 
				
			||||||
		reflow_menu_monitor,
 | 
							gui_menu_monitor,
 | 
				
			||||||
		reflow_menu_err_flags,
 | 
							gui_menu_err_flags,
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	enum button_state push_button;
 | 
						enum button_state push_button;
 | 
				
			||||||
	int16_t rot_delta;
 | 
						int16_t rot_delta;
 | 
				
			||||||
@@ -352,7 +352,7 @@ static void reflow_menu_root_entry(struct lcd_menu *menu, enum menu_entry_func_e
 | 
				
			|||||||
		menu_list_display(&list, 1, 3);
 | 
							menu_list_display(&list, 1, 3);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int reflow_menu_handle()
 | 
					int gui_handle()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int32_t rot_delta;
 | 
						int32_t rot_delta;
 | 
				
			||||||
	enum button_state button;
 | 
						enum button_state button;
 | 
				
			||||||
@@ -374,11 +374,11 @@ int reflow_menu_handle()
 | 
				
			|||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void reflow_menu_init()
 | 
					void gui_init()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	rotary_encoder_setup();
 | 
						rotary_encoder_setup();
 | 
				
			||||||
	button_init();
 | 
						button_init();
 | 
				
			||||||
	lcd_init();
 | 
						lcd_init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	menu_init(reflow_menu_ptr, reflow_menu_root_entry, update_display_buffer);
 | 
						menu_init(reflow_menu_ptr, gui_menu_root_entry, update_display_buffer);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user