Changeset - d4552b17855a
[Not reviewed]
cortex-f0
0 7 0
matthewreed - 9 years ago 2015-12-23 16:09:55

Resolved all compiler warnings
7 files changed with 35 insertions and 29 deletions:
0 comments (0 inline, 0 general)
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"
 
#ifdef MAX31865_RTD_SENSOR
 
#include "max31865.h"
 
#endif
 

	
 

	
 
// Private function prototypes
 
static void draw_setpoint(therm_status_t* status);
 

	
 

	
 
// Button transition variables
 
@@ -156,13 +146,13 @@ void display_process(therm_settings_t* s
 
            
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETI;
 
            }
 
            else {
 
                user_input(&set->val.k_p);
 
                user_input((uint16_t*)&set->val.k_p);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 
@@ -185,13 +175,13 @@ void display_process(therm_settings_t* s
 
            
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_SETD;
 
            }
 
            else {
 
                user_input(&set->val.k_i);
 
                user_input((uint16_t*)&set->val.k_i);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 
@@ -214,13 +204,13 @@ void display_process(therm_settings_t* s
 

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

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 
@@ -243,13 +233,13 @@ void display_process(therm_settings_t* s
 

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

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 
@@ -338,13 +328,13 @@ void display_process(therm_settings_t* s
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                flash_save(set);
 
                status->state = STATE_IDLE;
 
            }
 
            else {
 
                user_input_signed(&set->val.temp_offset);
 
                user_input_signed((int16_t*)(&set->val.temp_offset));
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
 
@@ -364,13 +354,13 @@ void display_process(therm_settings_t* s
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_IDLE;
 
            }
 
            else {
 
                user_input(&set->val.setpoint_brew);
 
                user_input((uint16_t*)&set->val.setpoint_brew);
 
            }
 

	
 
            // Event Handler
 
            if(status->temp >= status->setpoint) {
 
                status->state = STATE_MAINTAIN;
 
            }
 
@@ -390,13 +380,13 @@ void display_process(therm_settings_t* s
 

	
 
            // Button handler
 
            if(SW_BTN_PRESSED) {
 
                status->state = STATE_IDLE;
 
            }
 
            else {
 
                user_input(&set->val.setpoint_brew);
 
                user_input((uint16_t*)&set->val.setpoint_brew);
 
            }
 

	
 
            // Event Handler
 
            // N/A
 
 
 
        } break;
display.h
Show inline comments
 
#ifndef DISPLAY_H
 
#define DISPLAY_H
 

	
 
#include <stdlib.h>
 
#include "stm32f0xx_hal.h"
 
#include "states.h"
 
#include "ssd1306.h"
 
#include "stringhelpers.h"
 
#include "config.h"
 
#include "states.h"
 
#include "syslib.h"
 
#include "flash.h"
 
#include "gpio.h"
 
#ifdef MAX31865_RTD_SENSOR
 
#include "max31865.h"
 
#endif
 

	
 
void display_process(therm_settings_t* set, therm_status_t* status);
 

	
 
#endif
gpio.c
Show inline comments
 
#include "gpio.h"
 
#include "config.h"
 
#include "stm32f0xx_hal_conf.h"
 
#include <inttypes.h>
 

	
 
// Increase on each press, and increase at a fast rate after duration elapsed of continuously holding down... somehow...
 
static uint32_t change_time_reset = 0;
 

	
 

	
 
// Increment/decrement unsigned variable with up/down buttons
gpio.h
Show inline comments
 
#ifndef GPIO_H
 
#define GPIO_H
 

	
 
#include <inttypes.h>
 
#include "stm32f0xx_hal.h"
 
#include "stm32f0xx_hal_conf.h"
 
#include "config.h"
 

	
 
#define CHANGE_PERIOD_MS 100
 
#define CHANGE_ELAPSED (HAL_GetTick() - change_time_reset) > CHANGE_PERIOD_MS
 
#define CHANGE_RESET change_time_reset = HAL_GetTick()
 

	
 

	
main.c
Show inline comments
 
@@ -2,14 +2,18 @@
 
 
#include "config.h"
 
#include "syslib.h"
 
#include "pid.h"
 
#include "states.h"
 
#include "ssd1306.h"
 
#ifdef MAX31855_TC_SENSOR
 
#include "max31855.h"
 
#endif
 
#ifdef MAX31865_RTD_SENSOR
 
#include "max31865.h"
 
#endif
 
#include "gpio.h"
 
#include "spi.h"
 
#include "flash.h"
 
#include "stringhelpers.h"
 
#include "display.h"
 
ssd1306.c
Show inline comments
 
@@ -247,50 +247,48 @@ void ssd1306_drawlogo()
 
        WriteData(row[2][i]);
 
    }
 
    WriteData(0x00);
 
 
    setStartPage(0);
 
    setStartColumn(0);
 
    for(i = 0; i<32; i++)
 
    for(i = 0; i < 32; i++)
 
    {
 
        WriteData(row[3][i]);
 
    }
 
    WriteData(0x00);
 
}
 
 
/* Print a single character from font.cpp */
 
void ssd1306_drawchar(char ascii, unsigned char row, unsigned char xPos)
 
{
 
    char *srcPointer = -1;
 
    unsigned char i;
 
    const char *srcPointer = (char*)-1;
 
 
    srcPointer = &fontData[(ascii-32)][0];
 
 
    setStartPage(row);
 
    setStartColumn(xPos);
 
 
    for(i=0;i<5;i++)
 
    for(uint8_t i = 0; i < 5; i++)
 
    {
 
        WriteData(*srcPointer);
 
        srcPointer++;
 
    }
 
    WriteData(0x00);
 
}
 
 
void ssd1306_drawcharbig(char ascii, unsigned char row, unsigned char xPos)
 
{
 
    char *srcPointer = -1;
 
    unsigned char i;
 
    const char *srcPointer = (char*)-1;
 
 
    srcPointer = &fontData[(ascii-32)][0];
 
 
    setStartPage(row-1);
 
    setStartColumn(xPos);
 
 
    // Write first row
 
    for(i=0;i<5;i++)
 
    for(uint8_t i = 0; i < 5; i++)
 
    {
 
        uint8_t data = 0;
 
        data |= ((*srcPointer) & 0b1000) << 4; // get top 4 bits
 
        data |= ((*srcPointer) & 0b1000) << 3; // get top 4 bits
 
 
        data |= ((*srcPointer) & 0b0100) << 3; // get top 4 bits
 
@@ -312,13 +310,13 @@ void ssd1306_drawcharbig(char ascii, uns
 
    srcPointer -= 5;
 
 
    setStartPage(row);
 
    setStartColumn(xPos);
 
 
    // Write second row
 
    for(i=0;i<5;i++)
 
    for(uint8_t i = 0; i < 5; i++)
 
    {
 
        uint8_t data = 0;
 
        data |=  (*srcPointer) & 0b10000000; // get top 4 bits
 
        data |= ((*srcPointer) & 0b10000000) >> 1; // get top 4 bits
 
 
        data |= ((*srcPointer) & 0b01000000) >> 1; // get top 4 bits
ssd1306.h
Show inline comments
 
@@ -9,12 +9,14 @@
 
#define   SSD_Reset_High()  HAL_GPIO_WritePin(SSD_RESET, 1)
 
#define   SSD_A0_Low()      HAL_GPIO_WritePin(SSD_A0, 0)
 
#define   SSD_A0_High()     HAL_GPIO_WritePin(SSD_A0, 1)
 
#define   SSD_CS_Low()      HAL_GPIO_WritePin(SSD_CS, 0)
 
#define   SSD_CS_High()     HAL_GPIO_WritePin(SSD_CS, 1)
 
 
#include "spi.h"
 
 
// EMZ FIXME this won't really work
 
#define   SPI_SendByte(data)  HAL_SPI_Transmit(spi_get(), &data, 1, 100) 
 
//#define SPI_SendByte(data) 
 
#define SPI_Wait() 
 
 
//#define   SPI_SendByte(data)  SPI_I2S_SendData(SPI1,data) 
0 comments (0 inline, 0 general)