kopia lustrzana https://github.com/RobertGawron/IonizationChamber
Merge pull request #75 from RobertGawron/feature/basic_sw_components_implementation
cleanuppull/78/head
commit
19ad278f78
|
|
@ -8,9 +8,6 @@
|
|||
#ifndef INC_APPLICATIONBUILDER_H_
|
||||
#define INC_APPLICATIONBUILDER_H_
|
||||
|
||||
#include "CommonDataTypes.h"
|
||||
|
||||
|
||||
void ApplicationBuilder_Init();
|
||||
|
||||
void ApplicationBuilder_Run();
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
|
||||
#define PIN_PULSE_COUNTER 3
|
||||
|
||||
#define PORT_UART GPIOD
|
||||
#define PIN_TX GPIO_PIN_5
|
||||
#define PIN_RX GPIO_PIN_6
|
||||
|
||||
#define PORT_GPIO_LED GPIOD
|
||||
#define PIN_GPIO_LED_GREEN GPIO_PIN_2
|
||||
#define PIN_GPIO_LED_RED GPIO_PIN_3
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* GUI.h
|
||||
* UserInterface.h
|
||||
*
|
||||
* Created on: 30.06.2019
|
||||
* Author: robert
|
||||
*/
|
||||
|
||||
#ifndef SRC_GUI_H_
|
||||
#define SRC_GUI_H_
|
||||
#define SRC_USER_INTERFACE_H_
|
||||
|
||||
typedef enum UserInterface_Status { GUI_FAULT_MSG, GUI_INFO_MSG } GUI_Status;
|
||||
typedef enum UserInterface_Status { USER_INTERFACE_COLLECTING_DATA_MSG, USER_INTERFAE_STATE_OK_MSG } UserInterface_Status;
|
||||
|
||||
void UserInterface_Init();
|
||||
|
||||
void UserInterface_ShowMessage(GUI_Status status);
|
||||
void UserInterface_ShowMessage(UserInterface_Status status);
|
||||
|
||||
|
||||
#endif /* SRC_GUI_H_ */
|
||||
|
|
|
|||
|
|
@ -20,23 +20,16 @@ static MCP3425A0TConfig_t adcConfig[]={{PIN_ADC_CHIP_1}, {PIN_ADC_CHIP_2}};
|
|||
|
||||
void ApplicationBuilder_Init()
|
||||
{
|
||||
/*uint8_t amountOfADC = sizeof(adcConfig) / sizeof(adcConfig[0]);
|
||||
ClockConfigurator_Init();
|
||||
TimerConfigurator_Init();
|
||||
|
||||
for(uint8_t i = 0U; i < amountOfADC; i++)
|
||||
{
|
||||
MCP3425A0T_Init(&adcConfig[i]);
|
||||
}*/
|
||||
|
||||
ClockConfigurator_Init();
|
||||
TimerConfigurator_Init();
|
||||
|
||||
Logger_Init();
|
||||
PulseCounter_Init(PIN_PULSE_COUNTER);
|
||||
Logger_Init();
|
||||
PulseCounter_Init(PIN_PULSE_COUNTER);
|
||||
UserInterface_Init();
|
||||
|
||||
enableInterrupts();
|
||||
|
||||
UserInterface_ShowMessage(GUI_FAULT_MSG);
|
||||
UserInterface_ShowMessage(USER_INTERFAE_STATE_OK_MSG);
|
||||
}
|
||||
|
||||
void ApplicationBuilder_Run()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "Logger.h"
|
||||
#include <stdio.h>
|
||||
#include "stm8s_uart1.h"
|
||||
|
||||
#include "PinoutConfiguration.h"
|
||||
|
||||
#ifdef USE_FULL_ASSERT
|
||||
|
||||
|
|
@ -29,11 +29,10 @@ void assert_failed(uint8_t* file, uint32_t line)
|
|||
|
||||
void GPIO_setup(void)
|
||||
{
|
||||
// TODO: magic numbers
|
||||
GPIO_DeInit(GPIOD);
|
||||
GPIO_DeInit(PORT_UART);
|
||||
|
||||
GPIO_Init(GPIOD, GPIO_PIN_5, GPIO_MODE_OUT_PP_HIGH_FAST);
|
||||
GPIO_Init(GPIOD, GPIO_PIN_6, GPIO_MODE_IN_PU_NO_IT);
|
||||
GPIO_Init(PORT_UART, PIN_TX, GPIO_MODE_OUT_PP_HIGH_FAST);
|
||||
GPIO_Init(PORT_UART, PIN_RX, GPIO_MODE_IN_PU_NO_IT);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* GUI.c
|
||||
* UserInterface.c
|
||||
*
|
||||
* Created on: 30.06.2019
|
||||
* Author: robert
|
||||
|
|
@ -9,22 +9,24 @@
|
|||
|
||||
#include "PinoutConfiguration.h"
|
||||
|
||||
#define GPIO_LED_PINS (PIN_GPIO_LED_GREEN | PIN_GPIO_LED_RED)
|
||||
|
||||
void UserInterface_Init()
|
||||
{
|
||||
GPIO_Init(PORT_GPIO_LED, (PIN_GPIO_LED_GREEN | PIN_GPIO_LED_RED), GPIO_MODE_OUT_PP_LOW_SLOW);
|
||||
GPIO_WriteLow(PORT_GPIO_LED, (PIN_GPIO_LED_GREEN | PIN_GPIO_LED_RED));
|
||||
GPIO_Init(PORT_GPIO_LED, GPIO_LED_PINS, GPIO_MODE_OUT_PP_LOW_SLOW);
|
||||
GPIO_WriteLow(PORT_GPIO_LED, GPIO_LED_PINS);
|
||||
}
|
||||
|
||||
void UserInterface_ShowMessage(GUI_Status status)
|
||||
void UserInterface_ShowMessage(UserInterface_Status status)
|
||||
{
|
||||
switch(status)
|
||||
{
|
||||
case GUI_FAULT_MSG:
|
||||
case USER_INTERFACE_COLLECTING_DATA_MSG:
|
||||
{
|
||||
GPIO_WriteHigh(PORT_GPIO_LED, PIN_GPIO_LED_RED);
|
||||
break;
|
||||
}
|
||||
case GUI_INFO_MSG:
|
||||
case USER_INTERFAE_STATE_OK_MSG:
|
||||
{
|
||||
GPIO_WriteHigh(PORT_GPIO_LED, PIN_GPIO_LED_GREEN);
|
||||
break;
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue