led.h
1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* led.h
*
* Created on: Oct 28, 2019
* Author: Yasin
*/
#ifndef INC_HARDWARE_LED_H_
#define INC_HARDWARE_LED_H_
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f0xx_hal_gpio.h"
/**
* @brief Led mode enumeration
*/
typedef enum
{
LED000 = 0U,
LED001,
LED010,
LED011,
LED100,
LED101,
LED110,
LED111
}LED_State;
#define LED_TOTAL_STATE_NUM 8
/* LED control defines --------------------------------------------------------*/
#define LED1G_Close() HAL_GPIO_WritePin(LED1B_GPIO_Port, LED1B_Pin, GPIO_PIN_RESET)
#define LED1G_Open() HAL_GPIO_WritePin(LED1B_GPIO_Port, LED1B_Pin, GPIO_PIN_SET)
#define LED1R_Close() HAL_GPIO_WritePin(LED1R_GPIO_Port, LED1R_Pin, GPIO_PIN_RESET)
#define LED1R_Open() HAL_GPIO_WritePin(LED1R_GPIO_Port, LED1R_Pin, GPIO_PIN_SET)
#define LED2G_Close() HAL_GPIO_WritePin(LED2B_GPIO_Port, LED2B_Pin, GPIO_PIN_RESET)
#define LED2G_Open() HAL_GPIO_WritePin(LED2B_GPIO_Port, LED2B_Pin, GPIO_PIN_SET)
#define LED2R_Close() HAL_GPIO_WritePin(LED2R_GPIO_Port, LED2R_Pin, GPIO_PIN_RESET)
#define LED2R_Open() HAL_GPIO_WritePin(LED2R_GPIO_Port, LED2R_Pin, GPIO_PIN_SET)
#define LED3G_Close() HAL_GPIO_WritePin(LED3B_GPIO_Port, LED3B_Pin, GPIO_PIN_RESET)
#define LED3G_Open() HAL_GPIO_WritePin(LED3B_GPIO_Port, LED3B_Pin, GPIO_PIN_SET)
#define LED3R_Close() HAL_GPIO_WritePin(LED3R_GPIO_Port, LED3R_Pin, GPIO_PIN_RESET)
#define LED3R_Open() HAL_GPIO_WritePin(LED3R_GPIO_Port, LED3R_Pin, GPIO_PIN_SET)
extern LED_State ledState;
/* Exported functions --------------------------------------------------------*/
extern void LED_StateControl(LED_State ledMode);
extern void LED_StateControl2(LED_State ledMode);
#endif /* INC_HARDWARE_LED_H_ */