STM32L476G-Discovery board drivers V1.0.0
Dependents: DiscoLogger DISCO_L476VG_GlassLCD DISCO_L476VG_MicrophoneRecorder DISCO_L476VG_UART ... more
Drivers/BSP/Components/Common/io.h@5:4943b15cce9f, 2019-09-24 (annotated)
- Committer:
- jeromecoutant
- Date:
- Tue Sep 24 18:00:58 2019 +0200
- Revision:
- 5:4943b15cce9f
- Parent:
- 3:4c7d003a8259
Update BSP files with CubeL4 V1.14.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jerome Coutant
1:917af0ca86df
|
1
|
/**
|
|
Jerome Coutant
1:917af0ca86df
|
2
|
******************************************************************************
|
|
Jerome Coutant
1:917af0ca86df
|
3
|
* @file io.h
|
|
Jerome Coutant
1:917af0ca86df
|
4
|
* @author MCD Application Team
|
|
Jerome Coutant
1:917af0ca86df
|
5
|
* @brief This file contains all the functions prototypes for the IO driver.
|
|
Jerome Coutant
1:917af0ca86df
|
6
|
******************************************************************************
|
|
Jerome Coutant
1:917af0ca86df
|
7
|
* @attention
|
|
Jerome Coutant
1:917af0ca86df
|
8
|
*
|
|
jeromecoutant | 5:4943b15cce9f | 9 | * <h2><center>© Copyright (c) 2017 STMicroelectronics. |
jeromecoutant | 5:4943b15cce9f | 10 | * All rights reserved.</center></h2> |
Jerome Coutant
1:917af0ca86df
|
11
|
*
|
|
jeromecoutant | 5:4943b15cce9f | 12 | * This software component is licensed by ST under BSD 3-Clause license, |
jeromecoutant | 5:4943b15cce9f | 13 | * the "License"; You may not use this file except in compliance with the |
jeromecoutant | 5:4943b15cce9f | 14 | * License. You may obtain a copy of the License at: |
jeromecoutant | 5:4943b15cce9f | 15 | * opensource.org/licenses/BSD-3-Clause |
Jerome Coutant
1:917af0ca86df
|
16
|
*
|
|
Jerome Coutant
1:917af0ca86df
|
17
|
******************************************************************************
|
|
Jerome Coutant
1:917af0ca86df
|
18
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
19
|
|
|
Jerome Coutant
1:917af0ca86df
|
20
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
Jerome Coutant
1:917af0ca86df
|
21
|
#ifndef __IO_H
|
|
Jerome Coutant
1:917af0ca86df
|
22
|
#define __IO_H
|
|
Jerome Coutant
1:917af0ca86df
|
23
|
|
|
Jerome Coutant
1:917af0ca86df
|
24
|
#ifdef __cplusplus
|
|
Jerome Coutant
1:917af0ca86df
|
25
|
extern "C" {
|
|
Jerome Coutant
1:917af0ca86df
|
26
|
#endif
|
|
Jerome Coutant
1:917af0ca86df
|
27
|
|
|
Jerome Coutant
1:917af0ca86df
|
28
|
/* Includes ------------------------------------------------------------------*/
|
|
Jerome Coutant
1:917af0ca86df
|
29
|
#include <stdint.h>
|
|
Jerome Coutant
1:917af0ca86df
|
30
|
|
|
Jerome Coutant
1:917af0ca86df
|
31
|
/** @addtogroup BSP
|
|
Jerome Coutant
1:917af0ca86df
|
32
|
* @{
|
|
Jerome Coutant
1:917af0ca86df
|
33
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
34
|
|
|
Jerome Coutant
1:917af0ca86df
|
35
|
/** @addtogroup Components
|
|
Jerome Coutant
1:917af0ca86df
|
36
|
* @{
|
|
Jerome Coutant
1:917af0ca86df
|
37
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
38
|
|
|
Jerome Coutant
1:917af0ca86df
|
39
|
/** @addtogroup IO
|
|
Jerome Coutant
1:917af0ca86df
|
40
|
* @{
|
|
Jerome Coutant
1:917af0ca86df
|
41
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
42
|
|
|
Jerome Coutant
1:917af0ca86df
|
43
|
/** @defgroup IO_Exported_Types
|
|
Jerome Coutant
1:917af0ca86df
|
44
|
* @{
|
|
Jerome Coutant
1:917af0ca86df
|
45
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
46
|
|
|
Jerome Coutant
1:917af0ca86df
|
47
|
/**
|
|
Jerome Coutant
1:917af0ca86df
|
48
|
* @brief IO Bit SET and Bit RESET enumeration
|
|
Jerome Coutant
1:917af0ca86df
|
49
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
50
|
typedef enum
|
|
Jerome Coutant
1:917af0ca86df
|
51
|
{
|
|
Jerome Coutant
1:917af0ca86df
|
52
|
IO_PIN_RESET = 0,
|
|
Jerome Coutant
1:917af0ca86df
|
53
|
IO_PIN_SET
|
|
Jerome Coutant
1:917af0ca86df
|
54
|
}IO_PinState;
|
|
Jerome Coutant
1:917af0ca86df
|
55
|
|
|
Jerome Coutant
1:917af0ca86df
|
56
|
typedef enum
|
|
Jerome Coutant
1:917af0ca86df
|
57
|
{
|
|
Jerome Coutant
1:917af0ca86df
|
58
|
IO_MODE_INPUT = 0, /* input floating */
|
|
Jerome Coutant
1:917af0ca86df
|
59
|
IO_MODE_OUTPUT, /* output Push Pull */
|
|
Jerome Coutant
1:917af0ca86df
|
60
|
IO_MODE_IT_RISING_EDGE, /* float input - irq detect on rising edge */
|
|
Jerome Coutant
1:917af0ca86df
|
61
|
IO_MODE_IT_FALLING_EDGE, /* float input - irq detect on falling edge */
|
|
Jerome Coutant
1:917af0ca86df
|
62
|
IO_MODE_IT_LOW_LEVEL, /* float input - irq detect on low level */
|
|
Jerome Coutant
1:917af0ca86df
|
63
|
IO_MODE_IT_HIGH_LEVEL, /* float input - irq detect on high level */
|
|
Jerome Coutant
1:917af0ca86df
|
64
|
/* following modes only available on MFX*/
|
|
Jerome Coutant
1:917af0ca86df
|
65
|
IO_MODE_ANALOG, /* analog mode */
|
|
Jerome Coutant
1:917af0ca86df
|
66
|
IO_MODE_OFF, /* when pin isn't used*/
|
|
Jerome Coutant
1:917af0ca86df
|
67
|
IO_MODE_INPUT_PU, /* input with internal pull up resistor */
|
|
Jerome Coutant
1:917af0ca86df
|
68
|
IO_MODE_INPUT_PD, /* input with internal pull down resistor */
|
|
Jerome Coutant
1:917af0ca86df
|
69
|
IO_MODE_OUTPUT_OD, /* Open Drain output without internal resistor */
|
|
Jerome Coutant
1:917af0ca86df
|
70
|
IO_MODE_OUTPUT_OD_PU, /* Open Drain output with internal pullup resistor */
|
|
Jerome Coutant
1:917af0ca86df
|
71
|
IO_MODE_OUTPUT_OD_PD, /* Open Drain output with internal pulldown resistor */
|
|
Jerome Coutant
1:917af0ca86df
|
72
|
IO_MODE_OUTPUT_PP, /* PushPull output without internal resistor */
|
|
Jerome Coutant
1:917af0ca86df
|
73
|
IO_MODE_OUTPUT_PP_PU, /* PushPull output with internal pullup resistor */
|
|
Jerome Coutant
1:917af0ca86df
|
74
|
IO_MODE_OUTPUT_PP_PD, /* PushPull output with internal pulldown resistor */
|
|
Jerome Coutant
1:917af0ca86df
|
75
|
IO_MODE_IT_RISING_EDGE_PU, /* push up resistor input - irq on rising edge */
|
|
Jerome Coutant
1:917af0ca86df
|
76
|
IO_MODE_IT_RISING_EDGE_PD, /* push dw resistor input - irq on rising edge */
|
|
Jerome Coutant
1:917af0ca86df
|
77
|
IO_MODE_IT_FALLING_EDGE_PU, /* push up resistor input - irq on falling edge */
|
|
Jerome Coutant
1:917af0ca86df
|
78
|
IO_MODE_IT_FALLING_EDGE_PD, /* push dw resistor input - irq on falling edge */
|
|
Jerome Coutant
1:917af0ca86df
|
79
|
IO_MODE_IT_LOW_LEVEL_PU, /* push up resistor input - irq detect on low level */
|
|
Jerome Coutant
1:917af0ca86df
|
80
|
IO_MODE_IT_LOW_LEVEL_PD, /* push dw resistor input - irq detect on low level */
|
|
Jerome Coutant
1:917af0ca86df
|
81
|
IO_MODE_IT_HIGH_LEVEL_PU, /* push up resistor input - irq detect on high level */
|
|
Jerome Coutant
1:917af0ca86df
|
82
|
IO_MODE_IT_HIGH_LEVEL_PD, /* push dw resistor input - irq detect on high level */
|
|
Jerome Coutant
1:917af0ca86df
|
83
|
|
|
Jerome Coutant
1:917af0ca86df
|
84
|
}IO_ModeTypedef;
|
|
Jerome Coutant
1:917af0ca86df
|
85
|
|
|
Jerome Coutant
1:917af0ca86df
|
86
|
/** @defgroup IO_Driver_structure IO Driver structure
|
|
Jerome Coutant
1:917af0ca86df
|
87
|
* @{
|
|
Jerome Coutant
1:917af0ca86df
|
88
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
89
|
typedef struct
|
|
Jerome Coutant
1:917af0ca86df
|
90
|
{
|
|
Jerome Coutant
1:917af0ca86df
|
91
|
void (*Init)(uint16_t);
|
|
Jerome Coutant
1:917af0ca86df
|
92
|
uint16_t (*ReadID)(uint16_t);
|
|
Jerome Coutant
1:917af0ca86df
|
93
|
void (*Reset)(uint16_t);
|
|
Jerome Coutant
1:917af0ca86df
|
94
|
|
|
Jerome Coutant
1:917af0ca86df
|
95
|
void (*Start)(uint16_t, uint32_t);
|
|
Jerome Coutant
1:917af0ca86df
|
96
|
uint8_t (*Config)(uint16_t, uint32_t, IO_ModeTypedef);
|
|
Jerome Coutant
1:917af0ca86df
|
97
|
void (*WritePin)(uint16_t, uint32_t, uint8_t);
|
|
Jerome Coutant
1:917af0ca86df
|
98
|
uint32_t (*ReadPin)(uint16_t, uint32_t);
|
|
Jerome Coutant
1:917af0ca86df
|
99
|
|
|
Jerome Coutant
1:917af0ca86df
|
100
|
void (*EnableIT)(uint16_t);
|
|
Jerome Coutant
1:917af0ca86df
|
101
|
void (*DisableIT)(uint16_t);
|
|
Jerome Coutant
1:917af0ca86df
|
102
|
uint32_t (*ITStatus)(uint16_t, uint32_t);
|
|
Jerome Coutant
1:917af0ca86df
|
103
|
void (*ClearIT)(uint16_t, uint32_t);
|
|
Jerome Coutant
1:917af0ca86df
|
104
|
|
|
Jerome Coutant
1:917af0ca86df
|
105
|
}IO_DrvTypeDef;
|
|
Jerome Coutant
1:917af0ca86df
|
106
|
/**
|
|
Jerome Coutant
1:917af0ca86df
|
107
|
* @}
|
|
Jerome Coutant
1:917af0ca86df
|
108
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
109
|
|
|
Jerome Coutant
1:917af0ca86df
|
110
|
/**
|
|
Jerome Coutant
1:917af0ca86df
|
111
|
* @}
|
|
Jerome Coutant
1:917af0ca86df
|
112
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
113
|
|
|
Jerome Coutant
1:917af0ca86df
|
114
|
/**
|
|
Jerome Coutant
1:917af0ca86df
|
115
|
* @}
|
|
Jerome Coutant
1:917af0ca86df
|
116
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
117
|
|
|
Jerome Coutant
1:917af0ca86df
|
118
|
/**
|
|
Jerome Coutant
1:917af0ca86df
|
119
|
* @}
|
|
Jerome Coutant
1:917af0ca86df
|
120
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
121
|
|
|
Jerome Coutant
1:917af0ca86df
|
122
|
/**
|
|
Jerome Coutant
1:917af0ca86df
|
123
|
* @}
|
|
Jerome Coutant
1:917af0ca86df
|
124
|
*/
|
|
Jerome Coutant
1:917af0ca86df
|
125
|
|
|
Jerome Coutant
1:917af0ca86df
|
126
|
#ifdef __cplusplus
|
|
Jerome Coutant
1:917af0ca86df
|
127
|
}
|
|
Jerome Coutant
1:917af0ca86df
|
128
|
#endif
|
|
Jerome Coutant
1:917af0ca86df
|
129
|
|
|
Jerome Coutant
1:917af0ca86df
|
130
|
#endif /* __IO_H */
|
|
Jerome Coutant
1:917af0ca86df
|
131
|
|
|
Jerome Coutant
1:917af0ca86df
|
132
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|