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
 
@@ -10,7 +10,7 @@
 

	
 

	
 
# 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
 
@@ -31,9 +31,9 @@ USB_INCLUDES = -Imiddlewares/ST/STM32_US
 
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
display.c
Show inline comments
 
@@ -23,18 +23,6 @@ uint8_t sw_right_last = 0;
 
#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;
 

	
 
@@ -223,45 +211,6 @@ void display_process(therm_settings_t* s
 
 
 
        } 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
flash.c
Show inline comments
 
@@ -5,6 +5,7 @@
 

	
 
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;
 
@@ -29,13 +30,15 @@ void flash_init(therm_settings_t* tosave
 

	
 
    // 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++)
 
@@ -70,18 +73,20 @@ void flash_init(therm_settings_t* tosave
 
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);
stm32f0xx_hal_conf.h
Show inline comments
 
@@ -49,7 +49,7 @@
 
  */
 
#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
stm32f0xx_hal_msp.c
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)