code beautifying
This commit is contained in:
parent
6a7b54dcc1
commit
c0e370c802
@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <hmi.h>
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "display.h"
|
||||
#include "alarm.h"
|
||||
#include <PontCoopScheduler.h>
|
||||
|
||||
#include "oled.h"
|
||||
|
||||
|
||||
|
||||
@ -50,6 +50,11 @@ void updateDisplay(void *handle) {
|
||||
LED_P8x16Str(0, 6, buf);
|
||||
}
|
||||
|
||||
|
||||
void hmiInit() {
|
||||
schAdd(updateDisplay, &display, 0, 250);
|
||||
}
|
||||
|
||||
void clearSetMode(void *handle) {
|
||||
tDisplay *lDisplay = (tDisplay*) handle;
|
||||
lDisplay->setModeTemperature = 0;
|
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* display.h
|
||||
* hmi.h
|
||||
*
|
||||
* Created on: May 31, 2017
|
||||
* Author: wn
|
||||
*/
|
||||
|
||||
#ifndef DISPLAY_H_
|
||||
#define DISPLAY_H_
|
||||
#ifndef HMI_H_
|
||||
#define HMI_H_
|
||||
|
||||
|
||||
#include "timer.h"
|
||||
@ -26,10 +26,11 @@ typedef struct {
|
||||
uint32_t overrunTime;
|
||||
} tDisplay;
|
||||
|
||||
void hmiInit(void);
|
||||
void updateDisplay(void *handle);
|
||||
void displayToggleSetMode();
|
||||
void displayDecValue();
|
||||
void displayIncValue();
|
||||
|
||||
|
||||
#endif /* DISPLAY_H_ */
|
||||
#endif /* HMI_H_ */
|
@ -16,21 +16,18 @@
|
||||
|
||||
|
||||
|
||||
#include <hmi.h>
|
||||
#include <stdlib.h>
|
||||
#include <PontCoopScheduler.h>
|
||||
#include "stm32f1xx_hal.h"
|
||||
|
||||
#include "oled.h"
|
||||
#include "timer.h"
|
||||
#include "display.h"
|
||||
|
||||
extern tDisplay display;
|
||||
|
||||
|
||||
void my_setup_1() {
|
||||
schInit();
|
||||
schAdd(updateDisplay, &display, 0, 250);
|
||||
schAdd(secondTick, &display, 0, 1000);
|
||||
}
|
||||
|
||||
void my_loop() {
|
||||
@ -47,7 +44,9 @@ void my_errorHandler() {
|
||||
}
|
||||
|
||||
void my_setup_2() {
|
||||
LED_Init();
|
||||
hmiInit();
|
||||
timerInit();
|
||||
oledInit();
|
||||
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ void Set_NOP(void)
|
||||
LED_WrCmd(0xE3); // Command for No Operation
|
||||
}
|
||||
|
||||
void LED_Init(void)
|
||||
void oledInit(void)
|
||||
{
|
||||
// LEDPIN_Init();
|
||||
// LED_PORT=0X0F;
|
||||
|
@ -15,7 +15,7 @@
|
||||
* Adapted from Arduino to STM32 HAL by wollud1969
|
||||
*/
|
||||
|
||||
void LED_Init(void);
|
||||
void oledInit(void);
|
||||
|
||||
void LED_CLS(void);
|
||||
void LED_Set_Pos(unsigned char x,unsigned char y);//Set the coordinate
|
||||
|
@ -6,13 +6,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <hmi.h>
|
||||
#include "stm32f1xx_hal.h"
|
||||
#include "switches.h"
|
||||
#include "display.h"
|
||||
|
||||
|
||||
|
||||
extern tDisplay display;
|
||||
volatile uint32_t lastEvent = 0;
|
||||
|
||||
|
||||
@ -20,17 +19,17 @@ void switch_interrupt() {
|
||||
static uint8_t state = 0;
|
||||
uint32_t currentEvent = HAL_GetTick();
|
||||
|
||||
uint16_t line = HAL_GPIO_ReadPin(SWITCH_GPIO_Port, SWITCH_Pin);
|
||||
GPIO_PinState line = HAL_GPIO_ReadPin(SWITCH_GPIO_Port, SWITCH_Pin);
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
if (line == RESET) {
|
||||
if (line == GPIO_PIN_RESET) {
|
||||
lastEvent = currentEvent;
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (line != RESET) {
|
||||
if (line != GPIO_PIN_RESET) {
|
||||
if (lastEvent + LONG_BUTTON_TIME + DEBOUNCING_DEAD_TIME < currentEvent) {
|
||||
lastEvent = currentEvent;
|
||||
buttonLong();
|
||||
@ -50,7 +49,7 @@ void switch_interrupt() {
|
||||
int myDigitalRead(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) {
|
||||
int16_t r = 0;
|
||||
for (uint32_t i = 0; i < DEBOUNCING_REPEAT; i++) {
|
||||
if (HAL_GPIO_ReadPin(GPIOx, GPIO_Pin) != RESET) {
|
||||
if (HAL_GPIO_ReadPin(GPIOx, GPIO_Pin) != GPIO_PIN_RESET) {
|
||||
r++;
|
||||
} else {
|
||||
r--;
|
||||
|
@ -5,8 +5,8 @@
|
||||
* Author: wn
|
||||
*/
|
||||
|
||||
#include <hmi.h>
|
||||
#include "timer.h"
|
||||
#include "display.h"
|
||||
#include "alarm.h"
|
||||
|
||||
|
||||
@ -46,3 +46,7 @@ void secondTick(void *handle) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void timerInit() {
|
||||
schAdd(secondTick, &display, 0, 1000);
|
||||
}
|
||||
|
@ -15,6 +15,8 @@ typedef enum {
|
||||
OVERRUN = 3
|
||||
} tTimerState;
|
||||
|
||||
|
||||
void timerInit();
|
||||
void secondTick(void *handle);
|
||||
void startTimer();
|
||||
void stopTimer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user