-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathio_define.h
74 lines (64 loc) · 1.59 KB
/
io_define.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* @file io_define.h
* @author Hamid Salehi ([email protected])
* @brief set mcu hardware
* @date 2023-03-18
*/
#ifndef IO_DEFINE_H_
#define IO_DEFINE_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include "seven_seg_config.h"
#if SEVEN_SEG_HW == SEVEN_SEG_HW_AVR
typedef union{
uint8_t reg;
struct {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
uint8_t bit3 : 1;
uint8_t bit4 : 1;
uint8_t bit5 : 1;
uint8_t bit6 : 1;
uint8_t bit7 : 1;
};
}GPIO_Register;
typedef struct{
// PIN
volatile GPIO_Register InputData;
// DDR
volatile GPIO_Register Direction;
// PORT
volatile GPIO_Register OutputData;
}GPIO_TypeDef;
/**
* @brief GPIO Bit SET and Bit RESET enumeration
*/
typedef enum
{
GPIO_PIN_RESET = 0,
GPIO_PIN_SET
}GPIO_PinState;
#define GPIOA ((GPIO_TypeDef *)&PINA) //(*(Gpio*)0x3A)
#define GPIOB ((GPIO_TypeDef *)&PINB) //(*(Gpio*)0x36)
#define GPIOC ((GPIO_TypeDef *)&PINC) //(*(Gpio*)0x33)
#define GPIOD ((GPIO_TypeDef *)&PIND) //(*(Gpio*)0x30)
#elif SEVEN_SEG_HW == SEVEN_SEG_HW_STM32F0
#include "stm32f0xx.h"
#elif SEVEN_SEG_HW == SEVEN_SEG_HW_STM32F1
#include "stm32f1xx.h"
#elif SEVEN_SEG_HW == SEVEN_SEG_HW_STM32F2
#include "stm32f2xx.h"
#elif SEVEN_SEG_HW == SEVEN_SEG_HW_STM32F3
#include "stm32f3xx.h"
#elif SEVEN_SEG_HW == SEVEN_SEG_HW_STM32F4
#include "stm32f4xx.h"
#else
#error "Please select your hardware"
#endif
#ifdef __cplusplus
};
#endif
#endif /* IO_DEFINE_H_ */