draft of communication via LEDs

pull/60/head
RobertGawron 2019-06-30 16:42:34 +01:00
rodzic e8faf5bd9e
commit 7c40f354b8
5 zmienionych plików z 44 dodań i 14 usunięć

Wyświetl plik

@ -8,6 +8,11 @@
#ifndef SRC_GUI_H_
#define SRC_GUI_H_
typedef enum GUI_Status { GUI_FAULT_MSG, GUI_INFO_MSG } GUI_Status;
void GUI_Init();
void GUI_ShowMessage(GUI_Status status);
#endif /* SRC_GUI_H_ */

Wyświetl plik

@ -4,12 +4,18 @@
* Created on: 15 cze 2019
* Author: robert
*/
#include "stm8s_it.h"
#ifndef INC_PINOUTCONFIGURATION_H_
#define INC_PINOUTCONFIGURATION_H_
#define ADC_CHIP_1_PIN 1
#define ADC_CHIP_2_PIN 2
#define PEAK_DETECTOR_PIN 3
#define LED_GPIO_PORT (GPIOD)
#define LED_GREEN_GPIO_PIN (GPIO_PIN_2)
#define LED_RED_GPIO_PIN (GPIO_PIN_3)
#endif /* INC_PINOUTCONFIGURATION_H_ */

Wyświetl plik

@ -17,16 +17,19 @@ static MCP3425A0TConfig_t adcConfig[]={{ADC_CHIP_1_PIN}, {ADC_CHIP_2_PIN}};
bool ApplicationBuilder_Init()
{
/* uint8_t amountOfADC = sizeof(adcConfig) / sizeof(adcConfig[0]);
uint8_t amountOfADC = sizeof(adcConfig) / sizeof(adcConfig[0]);
for(uint8_t i = 0U; i < amountOfADC; i++)
/*for(uint8_t i = 0U; i < amountOfADC; i++)
{
MCP3425A0T_Init(&adcConfig[i]);
}
}*/
PeakDetector_Init(PEAK_DETECTOR_PIN);
GUI_Init();
GUI_ShowMessage(GUI_INFO_MSG);
GUI_ShowMessage(GUI_FAULT_MSG);
*/
return TRUE;
}

Wyświetl plik

@ -6,3 +6,27 @@
*/
#include "GUI.h"
#include "PinoutConfiguration.h"
void GUI_Init()
{
GPIO_Init(LED_GPIO_PORT, (LED_GREEN_GPIO_PIN | LED_RED_GPIO_PIN), GPIO_MODE_OUT_PP_LOW_SLOW);
GPIO_WriteLow(LED_GPIO_PORT, (LED_GREEN_GPIO_PIN | LED_RED_GPIO_PIN));
}
void GUI_ShowMessage(GUI_Status status)
{
switch(status)
{
case GUI_FAULT_MSG:
{
GPIO_WriteHigh(LED_GPIO_PORT, LED_RED_GPIO_PIN);
break;
}
case GUI_INFO_MSG:
{
GPIO_WriteHigh(LED_GPIO_PORT, LED_GREEN_GPIO_PIN);
break;
}
}
}

Wyświetl plik

@ -6,19 +6,11 @@
*/
#include "stm8s.h"
#include "stm8s_it.h"
#include "ApplicationBuilder.h"
#define LED_GPIO_PORT (GPIOD)
#define LED_GPIO_PINS GPIO_PIN_3 | GPIO_PIN_2
int main( void )
{
// just to test if the firmware is alive
GPIO_Init(LED_GPIO_PORT, LED_GPIO_PINS, GPIO_MODE_OUT_PP_LOW_SLOW);
GPIO_WriteHigh(LED_GPIO_PORT, LED_GPIO_PINS);
GUI_Init();
ApplicationBuilder_Init();
@ -38,7 +30,7 @@ void assert_failed(uint8_t* file, uint32_t line)
while (TRUE)
{
// empty
GPIO_WriteHigh(LED_GPIO_PORT, LED_GPIO_PINS);
}
}