# HG changeset patch # User Ethan Zonca # Date 2015-09-05 23:20:58 # Node ID 30d4d968a3a1ad72f85877550a5b4ab69bf72c38 # Parent b77b97fa501d55212fd357486de207643887927b Cleanup: remove CAN and multisetpoint diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -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 diff --git a/display.c b/display.c --- a/display.c +++ b/display.c @@ -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 diff --git a/flash.c b/flash.c --- a/flash.c +++ b/flash.c @@ -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); diff --git a/stm32f0xx_hal_conf.h b/stm32f0xx_hal_conf.h --- a/stm32f0xx_hal_conf.h +++ b/stm32f0xx_hal_conf.h @@ -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 diff --git a/stm32f0xx_hal_msp.c b/stm32f0xx_hal_msp.c deleted file mode 100644 --- a/stm32f0xx_hal_msp.c +++ /dev/null @@ -1,117 +0,0 @@ -/** - ****************************************************************************** - * File Name : stm32f0xx_hal_msp.c - * Date : 05/12/2014 20:22:27 - * Description : This file provides code for the MSP Initialization - * and de-Initialization codes. - ****************************************************************************** - * - * COPYRIGHT(c) 2014 STMicroelectronics - * - * 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. - * - ****************************************************************************** - */ -/* Includes ------------------------------------------------------------------*/ -#include "stm32f0xx_hal.h" - -/* USER CODE BEGIN 0 */ - -/* USER CODE END 0 */ - -/** - * Initializes the Global MSP. - */ -void HAL_MspInit(void) -{ - /* USER CODE BEGIN MspInit 0 */ - - /* USER CODE END MspInit 0 */ - - /* System interrupt init*/ -/* SysTick_IRQn interrupt configuration */ - HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); - - /* USER CODE BEGIN MspInit 1 */ - - /* USER CODE END MspInit 1 */ -} - -void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan) -{ - - GPIO_InitTypeDef GPIO_InitStruct; - if(hcan->Instance==CAN) - { - /* USER CODE BEGIN CAN_MspInit 0 */ - - /* USER CODE END CAN_MspInit 0 */ - /* Peripheral clock enable */ - __CAN_CLK_ENABLE(); - - /**CAN GPIO Configuration - PB8 ------> CAN_RX - PB9 ------> CAN_TX - */ - GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_LOW; - GPIO_InitStruct.Alternate = GPIO_AF4_CAN; - HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); - - /* USER CODE BEGIN CAN_MspInit 1 */ - - /* USER CODE END CAN_MspInit 1 */ - } - -} - -void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan) -{ - - if(hcan->Instance==CAN) - { - /* USER CODE BEGIN CAN_MspDeInit 0 */ - - /* USER CODE END CAN_MspDeInit 0 */ - /* Peripheral clock disable */ - __CAN_CLK_DISABLE(); - - /**CAN GPIO Configuration - PB8 ------> CAN_RX - PB9 ------> CAN_TX - */ - HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8|GPIO_PIN_9); - - /* USER CODE BEGIN CAN_MspDeInit 1 */ - - /* USER CODE END CAN_MspDeInit 1 */ - } - -} -/* USER CODE BEGIN 1 */ - -/* USER CODE END 1 */ - -/** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/