updated wait_ms(ms) to thread_sleep_for(ms) for Mbed OS 6
Drivers/BSP/Components/Common/io.h@2:123b894b49dd, 2017-05-16 (annotated)
- Committer:
- Jerome Coutant
- Date:
- Tue May 16 10:50:26 2017 +0200
- Revision:
- 2:123b894b49dd
STM32Cube_FW_BSP_DISCO_F469NI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jerome Coutant
2:123b894b49dd
|
1
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
2
|
******************************************************************************
|
|
Jerome Coutant
2:123b894b49dd
|
3
|
* @file io.h
|
|
Jerome Coutant
2:123b894b49dd
|
4
|
* @author MCD Application Team
|
|
Jerome Coutant
2:123b894b49dd
|
5
|
* @version V4.0.1
|
|
Jerome Coutant
2:123b894b49dd
|
6
|
* @date 21-July-2015
|
|
Jerome Coutant
2:123b894b49dd
|
7
|
* @brief This file contains all the functions prototypes for the IO driver.
|
|
Jerome Coutant
2:123b894b49dd
|
8
|
******************************************************************************
|
|
Jerome Coutant
2:123b894b49dd
|
9
|
* @attention
|
|
Jerome Coutant
2:123b894b49dd
|
10
|
*
|
|
Jerome Coutant
2:123b894b49dd
|
11
|
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
|
|
Jerome Coutant
2:123b894b49dd
|
12
|
*
|
|
Jerome Coutant
2:123b894b49dd
|
13
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
Jerome Coutant
2:123b894b49dd
|
14
|
* are permitted provided that the following conditions are met:
|
|
Jerome Coutant
2:123b894b49dd
|
15
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
Jerome Coutant
2:123b894b49dd
|
16
|
* this list of conditions and the following disclaimer.
|
|
Jerome Coutant
2:123b894b49dd
|
17
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
Jerome Coutant
2:123b894b49dd
|
18
|
* this list of conditions and the following disclaimer in the documentation
|
|
Jerome Coutant
2:123b894b49dd
|
19
|
* and/or other materials provided with the distribution.
|
|
Jerome Coutant
2:123b894b49dd
|
20
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
|
Jerome Coutant
2:123b894b49dd
|
21
|
* may be used to endorse or promote products derived from this software
|
|
Jerome Coutant
2:123b894b49dd
|
22
|
* without specific prior written permission.
|
|
Jerome Coutant
2:123b894b49dd
|
23
|
*
|
|
Jerome Coutant
2:123b894b49dd
|
24
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Jerome Coutant
2:123b894b49dd
|
25
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Jerome Coutant
2:123b894b49dd
|
26
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Jerome Coutant
2:123b894b49dd
|
27
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
Jerome Coutant
2:123b894b49dd
|
28
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Jerome Coutant
2:123b894b49dd
|
29
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Jerome Coutant
2:123b894b49dd
|
30
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Jerome Coutant
2:123b894b49dd
|
31
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Jerome Coutant
2:123b894b49dd
|
32
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Jerome Coutant
2:123b894b49dd
|
33
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Jerome Coutant
2:123b894b49dd
|
34
|
*
|
|
Jerome Coutant
2:123b894b49dd
|
35
|
******************************************************************************
|
|
Jerome Coutant
2:123b894b49dd
|
36
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
37
|
|
|
Jerome Coutant
2:123b894b49dd
|
38
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
Jerome Coutant
2:123b894b49dd
|
39
|
#ifndef __IO_H
|
|
Jerome Coutant
2:123b894b49dd
|
40
|
#define __IO_H
|
|
Jerome Coutant
2:123b894b49dd
|
41
|
|
|
Jerome Coutant
2:123b894b49dd
|
42
|
#ifdef __cplusplus
|
|
Jerome Coutant
2:123b894b49dd
|
43
|
extern "C" {
|
|
Jerome Coutant
2:123b894b49dd
|
44
|
#endif
|
|
Jerome Coutant
2:123b894b49dd
|
45
|
|
|
Jerome Coutant
2:123b894b49dd
|
46
|
/* Includes ------------------------------------------------------------------*/
|
|
Jerome Coutant
2:123b894b49dd
|
47
|
#include <stdint.h>
|
|
Jerome Coutant
2:123b894b49dd
|
48
|
|
|
Jerome Coutant
2:123b894b49dd
|
49
|
/** @addtogroup BSP
|
|
Jerome Coutant
2:123b894b49dd
|
50
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
51
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
52
|
|
|
Jerome Coutant
2:123b894b49dd
|
53
|
/** @addtogroup Components
|
|
Jerome Coutant
2:123b894b49dd
|
54
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
55
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
56
|
|
|
Jerome Coutant
2:123b894b49dd
|
57
|
/** @addtogroup IO
|
|
Jerome Coutant
2:123b894b49dd
|
58
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
59
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
60
|
|
|
Jerome Coutant
2:123b894b49dd
|
61
|
/** @defgroup IO_Exported_Types
|
|
Jerome Coutant
2:123b894b49dd
|
62
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
63
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
64
|
|
|
Jerome Coutant
2:123b894b49dd
|
65
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
66
|
* @brief IO Bit SET and Bit RESET enumeration
|
|
Jerome Coutant
2:123b894b49dd
|
67
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
68
|
typedef enum
|
|
Jerome Coutant
2:123b894b49dd
|
69
|
{
|
|
Jerome Coutant
2:123b894b49dd
|
70
|
IO_PIN_RESET = 0,
|
|
Jerome Coutant
2:123b894b49dd
|
71
|
IO_PIN_SET
|
|
Jerome Coutant
2:123b894b49dd
|
72
|
}IO_PinState;
|
|
Jerome Coutant
2:123b894b49dd
|
73
|
|
|
Jerome Coutant
2:123b894b49dd
|
74
|
typedef enum
|
|
Jerome Coutant
2:123b894b49dd
|
75
|
{
|
|
Jerome Coutant
2:123b894b49dd
|
76
|
IO_MODE_INPUT = 0, /* input floating */
|
|
Jerome Coutant
2:123b894b49dd
|
77
|
IO_MODE_OUTPUT, /* output Push Pull */
|
|
Jerome Coutant
2:123b894b49dd
|
78
|
IO_MODE_IT_RISING_EDGE, /* float input - irq detect on rising edge */
|
|
Jerome Coutant
2:123b894b49dd
|
79
|
IO_MODE_IT_FALLING_EDGE, /* float input - irq detect on falling edge */
|
|
Jerome Coutant
2:123b894b49dd
|
80
|
IO_MODE_IT_LOW_LEVEL, /* float input - irq detect on low level */
|
|
Jerome Coutant
2:123b894b49dd
|
81
|
IO_MODE_IT_HIGH_LEVEL, /* float input - irq detect on high level */
|
|
Jerome Coutant
2:123b894b49dd
|
82
|
/* following modes only available on MFX*/
|
|
Jerome Coutant
2:123b894b49dd
|
83
|
IO_MODE_ANALOG, /* analog mode */
|
|
Jerome Coutant
2:123b894b49dd
|
84
|
IO_MODE_OFF, /* when pin isn't used*/
|
|
Jerome Coutant
2:123b894b49dd
|
85
|
IO_MODE_INPUT_PU, /* input with internal pull up resistor */
|
|
Jerome Coutant
2:123b894b49dd
|
86
|
IO_MODE_INPUT_PD, /* input with internal pull down resistor */
|
|
Jerome Coutant
2:123b894b49dd
|
87
|
IO_MODE_OUTPUT_OD, /* Open Drain output without internal resistor */
|
|
Jerome Coutant
2:123b894b49dd
|
88
|
IO_MODE_OUTPUT_OD_PU, /* Open Drain output with internal pullup resistor */
|
|
Jerome Coutant
2:123b894b49dd
|
89
|
IO_MODE_OUTPUT_OD_PD, /* Open Drain output with internal pulldown resistor */
|
|
Jerome Coutant
2:123b894b49dd
|
90
|
IO_MODE_OUTPUT_PP, /* PushPull output without internal resistor */
|
|
Jerome Coutant
2:123b894b49dd
|
91
|
IO_MODE_OUTPUT_PP_PU, /* PushPull output with internal pullup resistor */
|
|
Jerome Coutant
2:123b894b49dd
|
92
|
IO_MODE_OUTPUT_PP_PD, /* PushPull output with internal pulldown resistor */
|
|
Jerome Coutant
2:123b894b49dd
|
93
|
IO_MODE_IT_RISING_EDGE_PU, /* push up resistor input - irq on rising edge */
|
|
Jerome Coutant
2:123b894b49dd
|
94
|
IO_MODE_IT_RISING_EDGE_PD, /* push dw resistor input - irq on rising edge */
|
|
Jerome Coutant
2:123b894b49dd
|
95
|
IO_MODE_IT_FALLING_EDGE_PU, /* push up resistor input - irq on falling edge */
|
|
Jerome Coutant
2:123b894b49dd
|
96
|
IO_MODE_IT_FALLING_EDGE_PD, /* push dw resistor input - irq on falling edge */
|
|
Jerome Coutant
2:123b894b49dd
|
97
|
IO_MODE_IT_LOW_LEVEL_PU, /* push up resistor input - irq detect on low level */
|
|
Jerome Coutant
2:123b894b49dd
|
98
|
IO_MODE_IT_LOW_LEVEL_PD, /* push dw resistor input - irq detect on low level */
|
|
Jerome Coutant
2:123b894b49dd
|
99
|
IO_MODE_IT_HIGH_LEVEL_PU, /* push up resistor input - irq detect on high level */
|
|
Jerome Coutant
2:123b894b49dd
|
100
|
IO_MODE_IT_HIGH_LEVEL_PD, /* push dw resistor input - irq detect on high level */
|
|
Jerome Coutant
2:123b894b49dd
|
101
|
|
|
Jerome Coutant
2:123b894b49dd
|
102
|
}IO_ModeTypedef;
|
|
Jerome Coutant
2:123b894b49dd
|
103
|
|
|
Jerome Coutant
2:123b894b49dd
|
104
|
/** @defgroup IO_Driver_structure IO Driver structure
|
|
Jerome Coutant
2:123b894b49dd
|
105
|
* @{
|
|
Jerome Coutant
2:123b894b49dd
|
106
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
107
|
typedef struct
|
|
Jerome Coutant
2:123b894b49dd
|
108
|
{
|
|
Jerome Coutant
2:123b894b49dd
|
109
|
void (*Init)(uint16_t);
|
|
Jerome Coutant
2:123b894b49dd
|
110
|
uint16_t (*ReadID)(uint16_t);
|
|
Jerome Coutant
2:123b894b49dd
|
111
|
void (*Reset)(uint16_t);
|
|
Jerome Coutant
2:123b894b49dd
|
112
|
|
|
Jerome Coutant
2:123b894b49dd
|
113
|
void (*Start)(uint16_t, uint32_t);
|
|
Jerome Coutant
2:123b894b49dd
|
114
|
uint8_t (*Config)(uint16_t, uint32_t, IO_ModeTypedef);
|
|
Jerome Coutant
2:123b894b49dd
|
115
|
void (*WritePin)(uint16_t, uint32_t, uint8_t);
|
|
Jerome Coutant
2:123b894b49dd
|
116
|
uint32_t (*ReadPin)(uint16_t, uint32_t);
|
|
Jerome Coutant
2:123b894b49dd
|
117
|
|
|
Jerome Coutant
2:123b894b49dd
|
118
|
void (*EnableIT)(uint16_t);
|
|
Jerome Coutant
2:123b894b49dd
|
119
|
void (*DisableIT)(uint16_t);
|
|
Jerome Coutant
2:123b894b49dd
|
120
|
uint32_t (*ITStatus)(uint16_t, uint32_t);
|
|
Jerome Coutant
2:123b894b49dd
|
121
|
void (*ClearIT)(uint16_t, uint32_t);
|
|
Jerome Coutant
2:123b894b49dd
|
122
|
|
|
Jerome Coutant
2:123b894b49dd
|
123
|
}IO_DrvTypeDef;
|
|
Jerome Coutant
2:123b894b49dd
|
124
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
125
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
126
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
127
|
|
|
Jerome Coutant
2:123b894b49dd
|
128
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
129
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
130
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
131
|
|
|
Jerome Coutant
2:123b894b49dd
|
132
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
133
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
134
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
135
|
|
|
Jerome Coutant
2:123b894b49dd
|
136
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
137
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
138
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
139
|
|
|
Jerome Coutant
2:123b894b49dd
|
140
|
/**
|
|
Jerome Coutant
2:123b894b49dd
|
141
|
* @}
|
|
Jerome Coutant
2:123b894b49dd
|
142
|
*/
|
|
Jerome Coutant
2:123b894b49dd
|
143
|
|
|
Jerome Coutant
2:123b894b49dd
|
144
|
#ifdef __cplusplus
|
|
Jerome Coutant
2:123b894b49dd
|
145
|
}
|
|
Jerome Coutant
2:123b894b49dd
|
146
|
#endif
|
|
Jerome Coutant
2:123b894b49dd
|
147
|
|
|
Jerome Coutant
2:123b894b49dd
|
148
|
#endif /* __IO_H */
|
|
Jerome Coutant
2:123b894b49dd
|
149
|
|
|
Jerome Coutant
2:123b894b49dd
|
150
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|