Changeset - 30d4d968a3a1
[Not reviewed]
cortex-f0
1 4 0
Ethan Zonca - 9 years ago 2015-09-05 23:20:58
ez@ethanzonca.com
Cleanup: remove CAN and multisetpoint
5 files changed with 18 insertions and 181 deletions:
0 comments (0 inline, 0 general)
Makefile
Show inline comments
 
# STM32F0xx Makefile
 
# #####################################
 
#
 
# Part of the uCtools project
 
# uctools.github.com
 
#
 
#######################################
 
# user configuration:
 
#######################################
 

	
 

	
 
# SOURCES: list of sources in the user application
 
SOURCES = main.c usbd_conf.c usbd_cdc_if.c usb_device.c usbd_desc.c stm32f0xx_hal_msp.c stm32f0xx_it.c system_stm32f0xx.c gpio.c spi.c ssd1306.c stringhelpers.c display.c syslib.c storage.c flash.c max31855.c max31865.c
 
SOURCES = main.c usbd_conf.c usbd_cdc_if.c usb_device.c usbd_desc.c stm32f0xx_it.c system_stm32f0xx.c gpio.c spi.c ssd1306.c stringhelpers.c display.c syslib.c storage.c flash.c max31855.c max31865.c
 

	
 
# TARGET: name of the user application
 
TARGET = main
 

	
 
# BUILD_DIR: directory to place output files in
 
BUILD_DIR = build
 

	
 
# LD_SCRIPT: location of the linker script
 
LD_SCRIPT = stm32f042c6_flash.ld
 

	
 
# USER_DEFS user defined macros
 
USER_DEFS = -D HSI48_VALUE=48000000 -D HSE_VALUE=16000000
 
# USER_INCLUDES: user defined includes
 
USER_INCLUDES =
 

	
 
# USB_INCLUDES: includes for the usb library
 
USB_INCLUDES = -Imiddlewares/ST/STM32_USB_Device_Library/Core/Inc
 
USB_INCLUDES += -Imiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
 

	
 
# USER_CFLAGS: user C flags (enable warnings, enable debug info)
 
USER_CFLAGS = -Wall -g -ffunction-sections -fdata-sections -Os
 
USER_CFLAGS = -Wall -g -ffunction-sections -fno-exceptions -fdata-sections -Os
 
# USER_LDFLAGS:  user LD flags
 
USER_LDFLAGS = -fno-exceptions -ffunction-sections -fdata-sections -Wl,--gc-sections
 
USER_LDFLAGS = -fno-exceptions -ffunction-sections -fno-exceptions -fdata-sections -Wl,--gc-sections
 

	
 
# TARGET_DEVICE: device to compile for
 
TARGET_DEVICE = STM32F042x6
 

	
 
#######################################
 
# end of user configuration
 
#######################################
 
#
 
#######################################
 
# binaries
 
#######################################
 
CC = arm-none-eabi-gcc
 
AR = arm-none-eabi-ar
 
RANLIB = arm-none-eabi-ranlib
 
SIZE = arm-none-eabi-size
 
OBJCOPY = arm-none-eabi-objcopy
 
MKDIR = mkdir -p
 
#######################################
 

	
 
# core and CPU type for Cortex M0
 
# ARM core type (CORE_M0, CORE_M3)
 
CORE = CORE_M0
 
# ARM CPU type (cortex-m0, cortex-m3)
 
CPU = cortex-m0
 

	
 
# where to build STM32Cube
 
CUBELIB_BUILD_DIR = $(BUILD_DIR)/STM32Cube
 

	
 
# various paths within the STmicro library
 
CMSIS_PATH = drivers/CMSIS
 
CMSIS_DEVICE_PATH = $(CMSIS_PATH)/Device/ST/STM32F0xx
 
DRIVER_PATH = drivers/STM32F0xx_HAL_Driver
 

	
 
# includes for gcc
 
INCLUDES = -I$(CMSIS_PATH)/Include
 
INCLUDES += -I$(CMSIS_DEVICE_PATH)/Include
 
INCLUDES += -I$(DRIVER_PATH)/Inc
 
INCLUDES += -I$(CURDIR)
 
INCLUDES += -I$(CURDIR)/usb
 
INCLUDES += $(USB_INCLUDES)
 
INCLUDES += $(USER_INCLUDES)
 

	
 
# macros for gcc
 
DEFS = -D$(CORE) $(USER_DEFS) -D$(TARGET_DEVICE)
 

	
 
# compile gcc flags
 
CFLAGS = $(DEFS) $(INCLUDES)
 
CFLAGS += -mcpu=$(CPU) -mthumb
 
CFLAGS += $(USER_CFLAGS)
 

	
 
# default action: build the user application
 
all: $(BUILD_DIR)/$(TARGET).hex
 

	
 
#######################################
 
# build the st micro peripherial library
 
# (drivers and CMSIS)
 
#######################################
 

	
 
CUBELIB = $(CUBELIB_BUILD_DIR)/libstm32cube.a
 

	
 
# List of stm32 driver objects
 
CUBELIB_DRIVER_OBJS = $(addprefix $(CUBELIB_BUILD_DIR)/, $(patsubst %.c, %.o, $(notdir $(wildcard $(DRIVER_PATH)/Src/*.c))))
 

	
 
# shortcut for building core library (make cubelib)
 
cubelib: $(CUBELIB)
 

	
 
$(CUBELIB): $(CUBELIB_DRIVER_OBJS)
 
	$(AR) rv $@ $(CUBELIB_DRIVER_OBJS)
 
	$(RANLIB) $@
 

	
 
$(CUBELIB_BUILD_DIR)/%.o: $(DRIVER_PATH)/Src/%.c | $(CUBELIB_BUILD_DIR)
 
	$(CC) -c $(CFLAGS) -o $@ $^
 

	
 
$(CUBELIB_BUILD_DIR):
 
	$(MKDIR) $@
 

	
 
#######################################
 
# build the USB library
 
#######################################
 
USB_MIDDLEWARE_PATH = ./middlewares/ST/STM32_USB_Device_Library/
 
USB_BUILD_DIR = $(BUILD_DIR)/usb
 
USB_SOURCES += usbd_ctlreq.c usbd_ioreq.c usbd_core.c usbd_cdc.c
 
# list of usb library objects
 
USB_OBJECTS += $(addprefix $(USB_BUILD_DIR)/,$(notdir $(USB_SOURCES:.c=.o)))
 

	
 
usb: $(USB_OBJECTS)
 

	
 
$(USB_BUILD_DIR)/%.o: $(USB_MIDDLEWARE_PATH)/Core/Src/%.c | $(USB_BUILD_DIR)
 
	$(CC) -Os $(CFLAGS) -c -o $@ $^
 

	
 
$(USB_BUILD_DIR)/%.o: $(USB_MIDDLEWARE_PATH)/Class/CDC/Src/%.c | $(USB_BUILD_DIR)
 
	$(CC) -Os $(CFLAGS) -c -o $@ $^
 

	
 
$(USB_BUILD_DIR):
 
	@echo $(USB_BUILD_DIR)
 
	$(MKDIR) $@
 

	
 
#######################################
 
# build the user application
 
#######################################
 

	
 
# list of user program objects
 
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(SOURCES:.c=.o)))
 
# add an object for the startup code
 
OBJECTS += $(BUILD_DIR)/startup_stm32f042x6.o
 

	
 
# use the periphlib core library, plus generic ones (libc, libm, libnosys)
 
LIBS = -lstm32cube -lc -lm -lnosys
 
LDFLAGS = -T $(LD_SCRIPT) -L $(CUBELIB_BUILD_DIR) $(LIBS) $(USER_LDFLAGS)
 

	
 
$(BUILD_DIR)/$(TARGET).hex: $(BUILD_DIR)/$(TARGET).elf
 
	$(OBJCOPY) -O ihex $(BUILD_DIR)/$(TARGET).elf $@
 
	$(OBJCOPY) -O binary $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).bin
 

	
 
$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) $(USB_OBJECTS) $(CUBELIB)
 
	$(CC) -o $@ $(CFLAGS) $(USER_LDFLAGS) $(OBJECTS) $(USB_OBJECTS) \
 
		-L$(CUBELIB_BUILD_DIR) -static $(LIBS) -Xlinker \
 
		-Map=$(BUILD_DIR)/$(TARGET).map \
 
		-T $(LD_SCRIPT)
 
	$(SIZE) $@
 

	
 
$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)
 
	$(CC) $(CFLAGS) -Os -c -o $@ $^
 

	
 
$(BUILD_DIR)/%.o: %.s | $(BUILD_DIR)
 
	$(CC) $(CFLAGS) -c -o $@ $^
 

	
 
$(BUILD_DIR):
 
	$(MKDIR) $@
 

	
 
# delete all user application files, keep the libraries
 
clean:
 
		-rm $(BUILD_DIR)/*.o
 
		-rm $(BUILD_DIR)/*.elf
 
		-rm $(BUILD_DIR)/*.bin
 
		-rm $(BUILD_DIR)/*.map
 

	
 
.PHONY: clean all cubelib
display.c
Show inline comments
 
#include "stm32f0xx_hal.h"
 
#include "ssd1306.h"
 
#include "stringhelpers.h"
 
#include "display.h"
 
#include "config.h"
 
#include "states.h"
 
#include "syslib.h"
 
#include "flash.h"
 
#include "gpio.h"
 

	
 
uint8_t goto_mode = 2;
 

	
 
// State machine
 
uint8_t sw_btn_last = 0;
 
uint8_t sw_up_last = 0;
 
uint8_t sw_down_last = 0;
 
uint8_t sw_left_last = 0;
 
uint8_t sw_right_last = 0;
 

	
 
#define SW_BTN_PRESSED (sw_btn_last == 0 && sw_btn == 1) // rising edge on buttonpress
 
#define SW_UP_PRESSED (sw_up_last == 0 && sw_up == 1)
 
#define SW_DOWN_PRESSED (sw_down_last == 0 && sw_down == 1)
 
#define SW_LEFT_PRESSED (sw_left_last == 0 && sw_left == 1)
 
#define SW_RIGHT_PRESSED (sw_right_last == 0 && sw_right == 1)
 

	
 
///////////////////////////////////////////////////////////////////////////////////////
 
/// freaking multiple setpoint support ///
 
uint8_t step_duration[10] = {0,0,0,0,0,0,0,0,0,0};
 
int16_t step_setpoint[10] = {0,0,0,0,0,0,0,0,0,0};
 
uint8_t final_setpoint = 0;
 

	
 
// Multiple screens to set setpoint and duration on each screen
 
// press center to go to the next one, and press left or right or something to confirm
 

	
 
// When executing, complete on time AND(?) temperature. Maybe allow switching to OR via settings
 

	
 
////////////////////////////////////////////////////////////////////////////////////////////////
 

	
 
uint8_t trigger_drawsetpoint = 1;
 

	
 
int16_t last_temp = 21245;
 

	
 
void display_process(therm_settings_t* set, therm_status_t* status)
 
{
 
    uint8_t last_state = status->state;
 
    
 
    uint8_t temp_changed = status->temp != last_temp;
 
    last_temp = status->temp;
 

	
 
    uint8_t sw_btn = !HAL_GPIO_ReadPin(SW_BTN);
 
    uint8_t sw_up = !HAL_GPIO_ReadPin(SW_UP);
 
    uint8_t sw_down = !HAL_GPIO_ReadPin(SW_DOWN);
 
    uint8_t sw_left = !HAL_GPIO_ReadPin(SW_LEFT);
 
    uint8_t sw_right = !HAL_GPIO_ReadPin(SW_RIGHT);
 

	
 
    switch(status->state)
 
    {
 
        // Idle state
 
        case STATE_IDLE:
 
        {
 
            // Write text to OLED
 
            // [ therm :: idle ]
 
            ssd1306_DrawString("therm :: idle ", 0, 40);
 
            status->pid_enabled = 0;
 

	
 
            if(temp_changed) {
 
                char tempstr[6];
 
                itoa_fp(status->temp, status->temp_frac, tempstr);
 
                ssd1306_DrawString("Temp: ", 3, 40);
 
                ssd1306_DrawString("    ", 3, 72);
 
                ssd1306_DrawString(tempstr, 3, 72);
 
            }
 

	
 
            ssd1306_drawlogo();
 

	
 
            switch(goto_mode) {
 
                case 3:
 
                {
 
                    ssd1306_DrawString("-> loader   ", 1, 40);
 
                } break;
 

	
 
                case 2:
 
                {
 
                    ssd1306_DrawString("-> heat     ", 1, 40);
 
                } break;
 

	
 
                case 1:
 
                {
 
                    ssd1306_DrawString("-> setup    ", 1, 40);
 
                } break;
 

	
 
                case 0:
 
                {
 
                    ssd1306_DrawString("-> reset    ", 1, 40);
 
                }
 
            }
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                switch(goto_mode) {
 
                    case 3:
 
                    {
 
                        ssd1306_clearscreen();
 
                        ssd1306_DrawString("Bootloader Entered", 0, 0);
 
                        ssd1306_DrawString("Device won't boot", 2, 0);
 
                        ssd1306_DrawString("until reflashed!", 3, 0);
 
                        bootloader_enter(); // Resets into bootloader
 
                        status->state = STATE_IDLE; // Just in case
 
                    } break;
 
                    case 2:
 
                        status->state = STATE_PREHEAT_BREW;
 
                        break;
 
                    case 1:
 
                        status->state = STATE_SETP;
 
                        break;
 
                    case 0:
 
                        status->state = STATE_IDLE;
 
                        flash_erase(set);
 
                        NVIC_SystemReset(); 
 
                        break;
 

	
 
                    default:
 
                        status->state = STATE_PREHEAT_BREW;
 
                }
 
            }
 
            else if(SW_UP_PRESSED && goto_mode < 3) {
 
                goto_mode++;
 
            }
 
            else if(SW_DOWN_PRESSED && goto_mode > 0) {
 
                goto_mode--;
 
            }
 

	
 

	
 
            // Event Handler
 
            // N/A
 

	
 
        } break;
 

	
 
        case STATE_SETP:
 
        {
 
            // Write text to OLED
 
            // [ therm :: set p ]
 
            // [ p = 12         ]
 
            ssd1306_DrawString("Proportional", 0, 40);
 
            ssd1306_drawlogo();
 

	
 
            char tempstr[6];
 
            itoa(set->k_p, tempstr, 10);
 
            ssd1306_DrawString("P=", 1, 45);
 
            ssd1306_DrawString("    ", 1, 57);
 
            ssd1306_DrawString(tempstr, 1, 57);
 

	
 
            ssd1306_DrawString("Press to accept", 3, 40);
 
            
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETI;
 
            }
 
            else {
 
                user_input(&set->k_p);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 
        case STATE_SETI:
 
        {
 
            // Write text to OLED
 
            // [ therm :: set i ]
 
            // [ i = 12         ]
 
            ssd1306_DrawString("Integral", 0, 40);
 
            ssd1306_drawlogo();
 

	
 
            char tempstr[6];
 
            itoa(set->k_i, tempstr, 10);
 
            ssd1306_DrawString("I=", 1, 45);
 
            ssd1306_DrawString("    ", 1, 57);
 
            ssd1306_DrawString(tempstr, 1, 57);
 

	
 
            ssd1306_DrawString("Press to accept", 3, 40);
 
            
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETD;
 
            }
 
            else {
 
                user_input(&set->k_i);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 
        case STATE_SETD:
 
        {
 
            // Write text to OLED
 
            // [ therm :: set d ]
 
            // [ d = 12         ]
 
            ssd1306_DrawString("Derivative", 0, 40);
 
            ssd1306_drawlogo();
 

	
 
            char tempstr[6];
 
            itoa(set->k_d, tempstr, 10);
 
            ssd1306_DrawString("D=", 1, 45);
 
            ssd1306_DrawString("    ", 1, 57);
 
            ssd1306_DrawString(tempstr, 1, 57);
 

	
 
            ssd1306_DrawString("Press to accept", 3, 40);
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETWINDUP;
 
            }
 
            else {
 
                user_input(&set->k_d);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 
        case STATE_SETSTEPS:
 
        {
 
            // Write text to OLED
 
            // [ step #1:: Duration: ### ]
 
            // [           Setpoint: ### ]
 
            char tempstr[6];
 

	
 
            itoa(final_setpoint, tempstr, 10);
 
            ssd1306_DrawString("Step #", 0, 0);
 
            ssd1306_DrawString(tempstr, 0, 40);
 

	
 
            ssd1306_DrawString("Duration: ", 0, 5);
 
            itoa(step_duration[final_setpoint], tempstr, 10);
 
            ssd1306_DrawString(tempstr, 0, 70);
 

	
 
            ssd1306_DrawString("Setpoint: ", 0, 0);
 
            itoa(step_setpoint[final_setpoint], tempstr, 10);
 
            ssd1306_DrawString(tempstr, 0, 70);
 

	
 
            ssd1306_DrawString("Press to accept", 3, 40);
 
            
 
            // Button handler - TODO: increment max_step if pressed
 
            // return and go to next state otherwise
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETSTEPS;
 
                final_setpoint++;
 
            }
 
        //    else if(SW_LEFT_PRESSED) {
 
        //        state++; // go to next state or something
 
        //    }
 
            else {
 
                user_input(&set->k_p);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 

	
 
        } break;
 

	
 
        case STATE_SETWINDUP:
 
        {
 
            // Write text to OLED
 
            // [ therm :: set windup ]
 
            // [ g = 12         ]
 
            ssd1306_DrawString("Windup Guard", 0, 40);
 
            ssd1306_drawlogo();
 

	
 
            char tempstr[6];
 
            itoa(set->windup_guard, tempstr, 10);
 
            ssd1306_DrawString("G=", 1, 45);
 
            ssd1306_DrawString("    ", 1, 57);
 
            ssd1306_DrawString(tempstr, 1, 57);
 

	
 
            ssd1306_DrawString("Press to accept", 3, 40);
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETBOOTTOBREW;
 
            }
 
            else {
 
                user_input(&set->windup_guard);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 
        case STATE_SETBOOTTOBREW:
 
        {
 
            // Write text to OLED
 
            // [ therm :: set windup ]
 
            // [ g = 12         ]
 
            ssd1306_DrawString("Start on Boot", 0, 40);
 
            ssd1306_drawlogo();
 

	
 
            ssd1306_DrawString("sob=", 1, 45);
 
            
 
            if(set->boottobrew)
 
                ssd1306_DrawString("Enabled ", 1, 70);
 
            else
 
                ssd1306_DrawString("Disabled", 1, 70);
 

	
 
            ssd1306_DrawString("Press to accept", 3, 40);
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETUNITS;
 
            }
 
            else if(!HAL_GPIO_ReadPin(SW_UP)) {
 
                set->boottobrew = 1;
 
            }
 
            else if(!HAL_GPIO_ReadPin(SW_DOWN)) {
 
                set->boottobrew = 0;
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 
        case STATE_SETUNITS:
 
        {
 
            // Write text to OLED
 
            // [ therm :: set windup ]
 
            // [ g = 12         ]
 
            ssd1306_DrawString("Units: ", 0, 40);
 
            ssd1306_drawlogo();
 

	
 
            if(set->temp_units == TEMP_UNITS_FAHRENHEIT)
 
                ssd1306_DrawString("Fahrenheit", 1, 60);
 
            else
 
                ssd1306_DrawString("Celsius   ", 1, 60);
 

	
 
            ssd1306_DrawString("Press to accept", 3, 40);
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETTEMPOFFSET;
 
            }
 
            else if(!HAL_GPIO_ReadPin(SW_UP)) {
 
                set->temp_units = TEMP_UNITS_FAHRENHEIT;
 
            }
 
            else if(!HAL_GPIO_ReadPin(SW_DOWN)) {
 
                set->temp_units = TEMP_UNITS_CELSIUS;
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 

	
 
        case STATE_SETTEMPOFFSET:
 
        {
 
            // Write text to OLED
 
            // [ therm :: set temp offset ]
 
            // [ g = 12         ]
 
            ssd1306_DrawString("Temp Cal Offset", 0, 40);
 
            ssd1306_drawlogo();
 

	
 
            char tempstr[6];
 
            itoa(set->temp_offset, tempstr, 10);
 
            ssd1306_DrawString("O=", 1, 45);
 
            ssd1306_DrawString("    ", 1, 57);
 
            ssd1306_DrawString(tempstr, 1, 57);
 

	
 
            ssd1306_DrawString("Press to accept", 3, 40);
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                flash_save(&set);
 
                status->state = STATE_IDLE;
 
            }
 
            else {
 
                user_input_signed(&set->temp_offset);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 

	
 
        case STATE_PREHEAT_BREW:
 
        {
 
            // Write text to OLED
 
            // [ therm : preheating brew ]
 
            // [ 30 => 120 C             ]
 
            ssd1306_DrawString("Preheating...", 0, 0);
 
            //ssd1306_drawlogo();
 
            draw_setpoint(status);
 

	
 
            status->pid_enabled = 1;
 
	    status->setpoint = set->setpoint_brew;
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
		save_setpoints(&set); // TODO: Check for mod
 
                status->state = STATE_IDLE;
 
            }
 
            else {
 
                user_input(&set->setpoint_brew);
 
            }
 

	
 
            // Event Handler
 
            if(status->temp >= status->setpoint) {
 
                status->state = STATE_MAINTAIN_BREW;
 
            }
 
 
 
        } break;
 

	
 
        case STATE_MAINTAIN_BREW:
 
        {
 
            // Write text to OLED
 
            // [ therm : ready to brew ]
 
            // [ 30 => 120 C           ]
 
            ssd1306_DrawString("Preheated!", 0, 0);
 
            //ssd1306_drawlogo();
 
            draw_setpoint(status);
 
            status->pid_enabled = 1;
 
	    status->setpoint = set->setpoint_brew;
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
		save_setpoints(&set); // TODO: Check for mod
 
                status->state = STATE_IDLE;
 
            }
 
            else {
 
                user_input(&set->setpoint_brew);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 
        case STATE_PREHEAT_STEAM:
 
        {
 
            // Write text to OLED
 
            // [ therm : preheating steam ]
 
            // [ 30 => 120 C           ]
 
            ssd1306_DrawString("Preheating...", 0, 0);
 
            //ssd1306_drawlogo();
 
            draw_setpoint(status);
 
            status->pid_enabled = 1;
 
	    status->setpoint = set->setpoint_steam;
 
	    
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_IDLE;
 
		save_setpoints(&set); // TODO: Check for mod
 
            }
 
            else {
 
                user_input(&set->setpoint_steam);
 
            }
 

	
 
            // Event Handler
 
            if(status->temp >= status->setpoint) {
 
                status->state = STATE_MAINTAIN_STEAM;
 
            }
 
 
 
        } break;
 

	
 
        case STATE_MAINTAIN_STEAM:
 
        {
 
            // Write text to OLED
 
            // [ therm : ready to steam ]
 
            // [ 30 => 120 C            ]
 
            ssd1306_DrawString("Ready to Steam!", 0, 0);
 
            //ssd1306_drawlogo();
 
            draw_setpoint(status);
 
            status->pid_enabled = 1;
 
	    status->setpoint = set->setpoint_steam;
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_IDLE;
 
		save_setpoints(&set); // TODO: Check for mod
 
            }
 
            else {
 
                user_input(&set->setpoint_steam);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 

	
 
        case STATE_TC_ERROR:
 
        {
 
            // Write text to OLED
 
            // [ therm : ready to steam ]
 
            // [ 30 => 120 C            ]
 
            ssd1306_DrawString("Error:              ", 0, 0);
 

	
 
            char tempstr[6];
 
            itoa(status->tc_errno, tempstr, 10);
 
            ssd1306_DrawString(tempstr, 0, 57);
 

	
 
            if(status->tc_errno == 1)
 
                ssd1306_DrawString("    TC Open Circuit", 1, 0);
 
            else if(status->tc_errno == 4)
 
                ssd1306_DrawString("    TC Short to GND", 1, 0);
 
            else if(status->tc_errno == 8)
 
                ssd1306_DrawString("    TC Short to VCC", 1, 0);
 
            else
 
                ssd1306_DrawString("#?, Unknown Error", 1, 0);
 
            ssd1306_DrawString("                    ", 2, 0);
 

	
 
            ssd1306_DrawString("-> to ignore all or", 2, 0);
 
            ssd1306_DrawString("press to continue", 3, 0);
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_IDLE;
 
            }
 
            else if(SW_RIGHT_PRESSED) {
 
                set->ignore_tc_error = 1;
 
                status->state = STATE_IDLE;
 
            }
 
            // Event Handler
 
            // Maybe handle if TC is plugged in
 
            // N/A
 
 
 
        } break;
 

	
 
        // Something is terribly wrong
 
        default:
 
        {
 
            status->state = STATE_IDLE;
 
            status->pid_enabled = 0;
 

	
 
        } break;
 
            
 
    }
 

	
 
    if(last_state != status->state) {
 
        // Clear screen on state change
 
        goto_mode = 2;
 
        trigger_drawsetpoint = 1;
 
        ssd1306_clearscreen();
 
    }
 

	
 
    // Last buttonpress
 
    sw_btn_last = sw_btn;
 
    sw_up_last = sw_up;
 
    sw_down_last = sw_down;
 
    sw_left_last = sw_left;
 
    sw_right_last = sw_right;
 
}
 

	
 

	
 
int32_t temp_last = 43002;
 
int32_t setpoint_last = 10023;
 
void draw_setpoint(therm_status_t* status) {
 
    // FIXME: need to do this when switching modes too
 
    if(status->temp != temp_last || trigger_drawsetpoint) { 
 
        char tempstr[3];
 
        itoa_fp(status->temp, status->temp_frac, tempstr);
 
        ssd1306_DrawStringBig("      ", 3, 0);
 
        ssd1306_DrawStringBig(tempstr, 3, 0);
 
    }
 

	
 
    if(trigger_drawsetpoint) 
 
        ssd1306_DrawStringBig(">", 3, 74);
 

	
 
    if(status->setpoint != setpoint_last || trigger_drawsetpoint) {
 
        char tempstr[3];
 
        itoa(status->setpoint, tempstr, 10);
 
        ssd1306_DrawStringBig("   ", 3, 90);
 
        ssd1306_DrawStringBig(tempstr, 3, 90);
 
    }
 

	
 
    trigger_drawsetpoint = 0;
 
    setpoint_last = status->setpoint;
 
    temp_last = status->temp;
 
}
 

	
 
// vim:softtabstop=4 shiftwidth=4 expandtab 
flash.c
Show inline comments
 
#include "stm32f0xx_hal.h"
 
#include "ssd1306.h"
 
#include "stm32f0xx_hal_flash.h"
 
#include "flash.h"
 

	
 
void flash_init(therm_settings_t* tosave)
 
{
 
    ssd1306_clearscreen();
 
    uint16_t size = sizeof(therm_settings_t)-1;
 
    uint32_t flash_adr = END_ADDR - size;
 
    flash_adr -= 2;
 
    uint8_t* flash_ptr = (uint8_t *)flash_adr;
 

	
 
    // Check if flash is blank
 
    uint16_t i = 0;
 
    uint16_t count = 0;
 

	
 
    char tempstr[10];
 
    itoa(flash_adr, tempstr, 10);
 
    ssd1306_DrawString(tempstr, 1, 0);
 

	
 
    uint16_t test;
 
    for(i=0;i<size;i++)
 
    {
 
        test = *flash_ptr;
 
        if(test==0xFF) count++;
 
    }
 

	
 
    ssd1306_DrawString("END LOOP ", 0, 0);
 

	
 
    // If blank, do nothing and just use values from RAM
 

	
 
    count = size + 1;
 
    // If not blank, check the checksums
 
    if(count != size) 
 
    {
 
        ssd1306_DrawString("FLASH NOT BLANK", 1, 0);
 
        // Calculate Checksums
 
    uint8_t cksum0=0,cksum1=0;
 
    uint8_t rdSum0=0,rdSum1=0;
 
        uint8_t cksum0=0,cksum1=0;
 
        uint8_t rdSum0=0,rdSum1=0;
 

	
 
        flash_adr = END_ADDR - size;
 
        flash_ptr = (uint8_t *)flash_adr;
 
        for(i=1; i < size; i++)
 
        {
 
            cksum0 += *flash_ptr++;
 
            cksum1 += cksum0;
 
        }
 

	
 
        // Read flash checksums
 
        flash_adr -= 2;
 
        flash_ptr = (uint8_t *)flash_adr;
 
        rdSum0 = *flash_ptr++;
 
        rdSum1 = *flash_ptr;
 

	
 
        // Compare Checksums values
 
        if((rdSum1==cksum1)&&(rdSum0==cksum0)) {
 
	    ssd1306_DrawString("CHECKSUM OK", 2, 0);
 
	    flash_read(tosave);
 
	}
 
        else {
 
	    ssd1306_DrawString("CHECKSUM BAD", 2, 0);
 
	    return; // If the checksum is bad, just use vals from RAM
 
	}
 

	
 
    }
 
    else {
 
        ssd1306_DrawString("FLASH BLANK", 1, 0);
 
    }
 
}
 

	
 

	
 
void flash_save(therm_settings_t* tosave)
 
{
 

	
 
	    ssd1306_DrawString("BEGIN SAVE", 2, 0);
 
            HAL_Delay(1500);
 
        flash_erase(tosave);
 
        flash_write(tosave);
 
        flash_checksum(tosave);
 
	    ssd1306_DrawString("END SAVE", 2, 0);
 
            HAL_Delay(1500);
 
    ssd1306_clearscreen();
 
    ssd1306_DrawString("BEGIN SAVE", 0, 0);
 
    HAL_Delay(1500);
 
    flash_erase(tosave);
 
    flash_write(tosave);
 
    flash_checksum(tosave);
 
    ssd1306_DrawString("END SAVE", 2, 0);
 
    HAL_Delay(1500);
 
}
 

	
 

	
 
void flash_read(therm_settings_t *tosave)
 
{
 
    ssd1306_clearscreen();
 
    ssd1306_DrawString("READING SAVE", 1, 0);
 
    char tempstr[10];
 
    itoa(sizeof(therm_settings_t), tempstr, 10);
 
    ssd1306_DrawString(tempstr, 2, 0);
 

	
 
    uint16_t size = sizeof(therm_settings_t)-1; // in Bytes
 
    uint32_t flash_adr = END_ADDR - size;
 
    uint8_t *flash_ptr = (uint8_t *)flash_adr;
 
    uint8_t *struct_ptr = (uint8_t*)tosave;
 

	
 
    uint16_t i;
 
    for(i=0;i<size;i++)
 
        *struct_ptr++ = *flash_ptr++;
 
    ssd1306_DrawString("READ COMPLETE", 3, 0);
 

	
 
}
 

	
 

	
 
void flash_write(therm_settings_t* tosave)
 
{
 

	
 
    HAL_FLASH_Unlock();
 

	
 
    uint16_t size = sizeof(therm_settings_t)-1; // in Bytes
 
    uint32_t start_address = END_ADDR-size; // write to end of page
 
    uint32_t struct_ptr = (uint32_t*) tosave;
 

	
 
    uint16_t  length;
 
    if(size%2==0)
 
        length = size/2;
 
    else
 
        length = size/2+1;
 

	
 
    uint16_t i;
 
    for(i=0;i<length;i++)
 
    {
 
        HAL_FLASH_Program(TYPEPROGRAM_HALFWORD, start_address, struct_ptr);
 
        struct_ptr++;
 
        start_address +=2;
 
    }
 

	
 
    HAL_FLASH_Lock();
 
}
 

	
 

	
 
void flash_checksum(therm_settings_t* tosave)
 
{
 
    uint8_t cksum0=0,cksum1=0;
 
    uint16_t  i,size,checksum;
 
    uint32_t flash_adr;
 
    uint8_t  *flash_ptr;
 

	
 
    HAL_FLASH_Unlock();
 

	
 
    size = sizeof(*tosave)-1; // in Bytes
 
    flash_adr = END_ADDR-size;
 
    flash_ptr = (uint8_t *)flash_adr;
 

	
 
    for(i=1; i < size; i++)
 
    {
 
        cksum0 += *flash_ptr++;
 
        cksum1 += cksum0;
 
    }
 
    checksum = (cksum1<<8) | cksum0;
 
    flash_adr -= 2;
 
    HAL_FLASH_Program(TYPEPROGRAM_HALFWORD, flash_adr, checksum);
 

	
 
    HAL_FLASH_Lock();
 
}
 

	
 

	
 
void flash_erase(therm_settings_t* tosave)
 
{
 
    uint8_t FLASHStatus = 1; // FLASH_COMPLETE=1
 
    uint32_t end_addr = END_ADDR;
 
    uint32_t NbrOfPage = abs( (sizeof(*tosave)-1)/0x400 )+1;   // Number of pages to be erased, most definitely 1 but hey, we might as well try to calculate it.
 
    uint32_t StartAddr = (end_addr+1) - (0x400*NbrOfPage);   // Starting address to be erased
 

	
 
    HAL_FLASH_Unlock();
 

	
 
    // Clear All pending flags
 
    //FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPERR);
 

	
 
    // Erase the FLASH pages
 
    FLASH_EraseInitTypeDef erase;
 
    erase.TypeErase = TYPEERASE_PAGES; 
 
    erase.PageAddress = StartAddr;
 
    erase.NbPages = NbrOfPage;
 
    uint32_t SectorError = 0;
 
    FLASHStatus = HAL_FLASHEx_Erase(&erase, &SectorError);
 

	
 
    HAL_FLASH_Lock();
 
}
 

	
 
// vim:softtabstop=4 shiftwidth=4 expandtab 
stm32f0xx_hal_conf.h
Show inline comments
 
/**
 
  ******************************************************************************
 
  * @file    stm32f0xx_hal_conf.h
 
  * @brief   HAL configuration template file.
 
  ******************************************************************************
 
  * @attention
 
  *
 
  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
 
  *
 
  * Redistribution and use in source and binary forms, with or without modification,
 
  * are permitted provided that the following conditions are met:
 
  *   1. Redistributions of source code must retain the above copyright notice,
 
  *      this list of conditions and the following disclaimer.
 
  *   2. Redistributions in binary form must reproduce the above copyright notice,
 
  *      this list of conditions and the following disclaimer in the documentation
 
  *      and/or other materials provided with the distribution.
 
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
 
  *      may be used to endorse or promote products derived from this software
 
  *      without specific prior written permission.
 
  *
 
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
  *
 
  ******************************************************************************
 
  */
 
 
/* Define to prevent recursive inclusion -------------------------------------*/
 
#ifndef __STM32F0xx_HAL_CONF_H
 
#define __STM32F0xx_HAL_CONF_H
 
 
#ifdef __cplusplus
 
 extern "C" {
 
#endif
 
 
/* Exported types ------------------------------------------------------------*/
 
/* Exported constants --------------------------------------------------------*/
 
 
/* ########################## Module Selection ############################## */
 
/**
 
  * @brief This is the list of modules to be used in the HAL driver
 
  */
 
#define HAL_MODULE_ENABLED
 
//#define HAL_ADC_MODULE_ENABLED
 
#define HAL_CAN_MODULE_ENABLED
 
//#define HAL_CAN_MODULE_ENABLED
 
//#define HAL_CEC_MODULE_ENABLED
 
//#define HAL_COMP_MODULE_ENABLED
 
//#define HAL_CRC_MODULE_ENABLED
 
//#define HAL_CRYP_MODULE_ENABLED
 
//#define HAL_TSC_MODULE_ENABLED
 
//#define HAL_DAC_MODULE_ENABLED
 
//#define HAL_I2C_MODULE_ENABLED
 
//#define HAL_I2S_MODULE_ENABLED
 
//#define HAL_IWDG_MODULE_ENABLED
 
//#define HAL_LCD_MODULE_ENABLED
 
//#define HAL_LPTIM_MODULE_ENABLED
 
//#define HAL_RNG_MODULE_ENABLED
 
//#define HAL_RTC_MODULE_ENABLED
 
#define HAL_SPI_MODULE_ENABLED
 
#define HAL_TIM_MODULE_ENABLED
 
//#define HAL_UART_MODULE_ENABLED
 
//#define HAL_USART_MODULE_ENABLED
 
//#define HAL_IRDA_MODULE_ENABLED
 
//#define HAL_SMARTCARD_MODULE_ENABLED
 
//#define HAL_SMBUS_MODULE_ENABLED
 
//#define HAL_WWDG_MODULE_ENABLED
 
#define HAL_PCD_MODULE_ENABLED
 
#define HAL_CORTEX_MODULE_ENABLED
 
#define HAL_DMA_MODULE_ENABLED
 
#define HAL_FLASH_MODULE_ENABLED
 
#define HAL_GPIO_MODULE_ENABLED
 
#define HAL_PWR_MODULE_ENABLED
 
#define HAL_RCC_MODULE_ENABLED
 
 
/* ########################## HSE/HSI Values adaptation ##################### */
 
/**
 
  * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
 
  *        This value is used by the RCC HAL module to compute the system frequency
 
  *        (when HSE is used as system clock source, directly or through the PLL).
 
  */
 
#if !defined  (HSE_VALUE)
 
  #define HSE_VALUE    ((uint32_t)16000000) /*!< Value of the External oscillator in Hz */
 
#endif /* HSE_VALUE */
 
 
/**
 
  * @brief In the following line adjust the External High Speed oscillator (HSE) Startup
 
  *        Timeout value
 
  */
 
#if !defined  (HSE_STARTUP_TIMEOUT)
 
  #define HSE_STARTUP_TIMEOUT    ((uint32_t)5000)   /*!< Time out for HSE start up, in ms */
 
#endif /* HSE_STARTUP_TIMEOUT */
 
 
/**
 
  * @brief Internal High Speed oscillator (HSI) value.
 
  *        This value is used by the RCC HAL module to compute the system frequency
 
  *        (when HSI is used as system clock source, directly or through the PLL).
 
  */
 
#if !defined  (HSI_VALUE)
 
  #define HSI_VALUE    ((uint32_t)8000000) /*!< Value of the Internal oscillator in Hz*/
 
#endif /* HSI_VALUE */
 
 
/**
 
  * @brief In the following line adjust the Internal High Speed oscillator (HSI) Startup
 
  *        Timeout value
 
  */
 
#if !defined  (HSI_STARTUP_TIMEOUT)
 
 #define HSI_STARTUP_TIMEOUT   ((uint32_t)5000) /*!< Time out for HSI start up */
 
#endif /* HSI_STARTUP_TIMEOUT */
 
 
/**
 
  * @brief Internal High Speed oscillator for ADC (HSI14) value.
 
  */
 
#if !defined  (HSI14_VALUE)
 
#define HSI14_VALUE ((uint32_t)14000000) /*!< Value of the Internal High Speed oscillator for ADC in Hz.
 
					     The real value may vary depending on the variations
 
					     in voltage and temperature.  */
 
#endif /* HSI14_VALUE */
 
 
/**
 
  * @brief Internal High Speed oscillator for USB (HSI48) value.
 
  */
 
#if !defined  (HSI48_VALUE)
 
#define HSI48_VALUE ((uint32_t)48000000) /*!< Value of the Internal High Speed oscillator for USB in Hz.
 
					     The real value may vary depending on the variations
 
					     in voltage and temperature.  */
 
#endif /* HSI48_VALUE */
 
 
/**
 
  * @brief Internal Low Speed oscillator (LSI) value.
 
  */
 
#if !defined  (LSI_VALUE)
 
 #define LSI_VALUE  ((uint32_t)40000)
 
#endif /* LSI_VALUE */                      /*!< Value of the Internal Low Speed oscillator in Hz
 
					     The real value may vary depending on the variations
 
					     in voltage and temperature.  */
 
/**
 
  * @brief External Low Speed oscillator (LSI) value.
 
  */
 
#if !defined  (LSE_VALUE)
 
 #define LSE_VALUE  ((uint32_t)32768)    /*!< Value of the External Low Speed oscillator in Hz */
 
#endif /* LSE_VALUE */
 
 
/* Tip: To avoid modifying this file each time you need to use different HSE,
 
   ===  you can define the HSE value in your toolchain compiler preprocessor. */
 
 
/* ########################### System Configuration ######################### */
 
/**
 
  * @brief This is the HAL system configuration section
 
  */
 
#define  VDD_VALUE                    ((uint32_t)3300) /*!< Value of VDD in mv */
 
#define  TICK_INT_PRIORITY            ((uint32_t)0)    /*!< tick interrupt priority (lowest by default)  */
 
									      /*  Warning: Must be set to higher priority for HAL_Delay()  */
 
									      /*  and HAL_GetTick() usage under interrupt context          */
 
#define  USE_RTOS                     0
 
#define  PREFETCH_ENABLE              0
 
#define  INSTRUCTION_CACHE_ENABLE     0
 
#define  DATA_CACHE_ENABLE            0
 
/* ########################## Assert Selection ############################## */
 
/**
 
  * @brief Uncomment the line below to expanse the "assert_param" macro in the
 
  *        HAL drivers code
 
  */
 
/* #define USE_FULL_ASSERT   1 */
 
 
/* Includes ------------------------------------------------------------------*/
 
/**
 
  * @brief Include module's header file
 
  */
 
 
#ifdef HAL_RCC_MODULE_ENABLED
 
 #include "stm32f0xx_hal_rcc.h"
 
#endif /* HAL_RCC_MODULE_ENABLED */
 
 
#ifdef HAL_GPIO_MODULE_ENABLED
 
 #include "stm32f0xx_hal_gpio.h"
 
#endif /* HAL_GPIO_MODULE_ENABLED */
 
 
#ifdef HAL_DMA_MODULE_ENABLED
 
  #include "stm32f0xx_hal_dma.h"
 
#endif /* HAL_DMA_MODULE_ENABLED */
 
 
#ifdef HAL_CORTEX_MODULE_ENABLED
 
 #include "stm32f0xx_hal_cortex.h"
 
#endif /* HAL_CORTEX_MODULE_ENABLED */
 
 
#ifdef HAL_ADC_MODULE_ENABLED
 
 #include "stm32f0xx_hal_adc.h"
 
#endif /* HAL_ADC_MODULE_ENABLED */
 
 
#ifdef HAL_CAN_MODULE_ENABLED
 
 #include "stm32f0xx_hal_can.h"
 
#endif /* HAL_CAN_MODULE_ENABLED */
 
 
#ifdef HAL_CEC_MODULE_ENABLED
 
 #include "stm32f0xx_hal_cec.h"
 
#endif /* HAL_CEC_MODULE_ENABLED */
 
 
#ifdef HAL_COMP_MODULE_ENABLED
 
 #include "stm32f0xx_hal_comp.h"
 
#endif /* HAL_COMP_MODULE_ENABLED */
 
 
#ifdef HAL_CRC_MODULE_ENABLED
 
 #include "stm32f0xx_hal_crc.h"
 
#endif /* HAL_CRC_MODULE_ENABLED */
 
 
#ifdef HAL_DAC_MODULE_ENABLED
 
 #include "stm32f0xx_hal_dac.h"
 
#endif /* HAL_DAC_MODULE_ENABLED */
 
 
#ifdef HAL_FLASH_MODULE_ENABLED
 
 #include "stm32f0xx_hal_flash.h"
 
#endif /* HAL_FLASH_MODULE_ENABLED */
 
 
#ifdef HAL_I2C_MODULE_ENABLED
 
 #include "stm32f0xx_hal_i2c.h"
 
#endif /* HAL_I2C_MODULE_ENABLED */
 
 
#ifdef HAL_I2S_MODULE_ENABLED
 
 #include "stm32f0xx_hal_i2s.h"
 
#endif /* HAL_I2S_MODULE_ENABLED */
 
 
#ifdef HAL_IRDA_MODULE_ENABLED
 
 #include "stm32f0xx_hal_irda.h"
 
#endif /* HAL_IRDA_MODULE_ENABLED */
 
 
#ifdef HAL_IWDG_MODULE_ENABLED
 
 #include "stm32f0xx_hal_iwdg.h"
 
#endif /* HAL_IWDG_MODULE_ENABLED */
 
 
#ifdef HAL_PCD_MODULE_ENABLED
 
 #include "stm32f0xx_hal_pcd.h"
 
#endif /* HAL_PCD_MODULE_ENABLED */
 
 
#ifdef HAL_PWR_MODULE_ENABLED
 
 #include "stm32f0xx_hal_pwr.h"
 
#endif /* HAL_PWR_MODULE_ENABLED */
 
 
#ifdef HAL_RTC_MODULE_ENABLED
 
 #include "stm32f0xx_hal_rtc.h"
 
#endif /* HAL_RTC_MODULE_ENABLED */
 
 
#ifdef HAL_SMARTCARD_MODULE_ENABLED
 
 #include "stm32f0xx_hal_smartcard.h"
 
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
 
 
#ifdef HAL_SMBUS_MODULE_ENABLED
 
 #include "stm32f0xx_hal_smbus.h"
 
#endif /* HAL_SMBUS_MODULE_ENABLED */
 
 
#ifdef HAL_SPI_MODULE_ENABLED
 
 #include "stm32f0xx_hal_spi.h"
 
#endif /* HAL_SPI_MODULE_ENABLED */
 
 
#ifdef HAL_TIM_MODULE_ENABLED
 
 #include "stm32f0xx_hal_tim.h"
 
#endif /* HAL_TIM_MODULE_ENABLED */
 
 
#ifdef HAL_TSC_MODULE_ENABLED
 
 #include "stm32f0xx_hal_tsc.h"
 
#endif /* HAL_TSC_MODULE_ENABLED */
 
 
#ifdef HAL_UART_MODULE_ENABLED
 
 #include "stm32f0xx_hal_uart.h"
 
#endif /* HAL_UART_MODULE_ENABLED */
 
 
#ifdef HAL_USART_MODULE_ENABLED
 
 #include "stm32f0xx_hal_usart.h"
 
#endif /* HAL_USART_MODULE_ENABLED */
 
 
#ifdef HAL_WWDG_MODULE_ENABLED
 
 #include "stm32f0xx_hal_wwdg.h"
 
#endif /* HAL_WWDG_MODULE_ENABLED */
 
 
/* Exported macro ------------------------------------------------------------*/
 
#ifdef  USE_FULL_ASSERT
 
/**
 
  * @brief  The assert_param macro is used for function's parameters check.
 
  * @param  expr: If expr is false, it calls assert_failed function
 
  *         which reports the name of the source file and the source
 
  *         line number of the call that failed.
 
  *         If expr is true, it returns no value.
 
  * @retval None
 
  */
 
  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
 
/* Exported functions ------------------------------------------------------- */
 
  void assert_failed(uint8_t* file, uint32_t line);
 
#else
 
  #define assert_param(expr) ((void)0)
 
#endif /* USE_FULL_ASSERT */
 
 
#ifdef __cplusplus
 
}
 
#endif
 
 
#endif /* __STM32F0xx_HAL_CONF_H */
 
 
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32f0xx_hal_msp.c
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)