gr55xx_hal_msio.h
Go to the documentation of this file.
1 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_MSIO_H__
53 #define __GR55xx_HAL_MSIO_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_msio.h"
61 #include "gr55xx_hal_def.h"
62 
63 /* Exported types ------------------------------------------------------------*/
71 typedef enum
72 {
76 
86 typedef struct _msio_init
87 {
88  uint32_t pin;
91  uint32_t direction;
94  uint32_t mode;
97  uint32_t pull;
100  uint32_t mux;
103 
111 /* Exported constants --------------------------------------------------------*/
119 #define MSIO_PIN_0 ((uint16_t)0x0001U)
120 #define MSIO_PIN_1 ((uint16_t)0x0002U)
121 #define MSIO_PIN_2 ((uint16_t)0x0004U)
122 #define MSIO_PIN_3 ((uint16_t)0x0008U)
123 #define MSIO_PIN_4 ((uint16_t)0x0010U)
125 #define MSIO_PIN_ALL ((uint16_t)0x001FU)
127 #define MSIO_PIN_MASK (0x0000001FU)
133 #define MSIO_DIRECTION_NONE LL_MSIO_DIRECTION_NONE
134 #define MSIO_DIRECTION_INPUT LL_MSIO_DIRECTION_INPUT
135 #define MSIO_DIRECTION_OUTPUT LL_MSIO_DIRECTION_OUTPUT
136 #define MSIO_DIRECTION_INOUT LL_MSIO_DIRECTION_INOUT
143 #define MSIO_MODE_ANALOG LL_MSIO_MODE_ANALOG
144 #define MSIO_MODE_DIGITAL LL_MSIO_MODE_DIGITAL
151 #define MSIO_NOPULL LL_MSIO_PULL_NO
152 #define MSIO_PULLUP LL_MSIO_PULL_UP
153 #define MSIO_PULLDOWN LL_MSIO_PULL_DOWN
159 #define MSIO_DEFAULT_CONFIG \
160 { \
161  .pin = MSIO_PIN_ALL, \
162  .direction = MSIO_DIRECTION_INPUT, \
163  .mode = MSIO_MODE_DIGITAL, \
164  .pull = MSIO_PULLDOWN, \
165  .mux = GPIO_MUX_7, \
166 }
167 
169 /* Exported macro ------------------------------------------------------------*/
176 /* Private macros ------------------------------------------------------------*/
186 #define IS_MSIO_PIN_ACTION(__ACTION__) (((__ACTION__) == MSIO_PIN_RESET) || ((__ACTION__) == MSIO_PIN_SET))
187 
193 #define IS_MSIO_PIN(__PIN__) ((((__PIN__) & MSIO_PIN_MASK) != 0x00U) && \
194  (((__PIN__) & ~MSIO_PIN_MASK) == 0x00U))
195 
201 #define IS_MSIO_DIRECTION(__DIR__) (((__DIR__) == MSIO_DIRECTION_NONE) || \
202  ((__DIR__) == MSIO_DIRECTION_INPUT) || \
203  ((__DIR__) == MSIO_DIRECTION_OUTPUT) || \
204  ((__DIR__) == MSIO_DIRECTION_INOUT))
205 
211 #define IS_MSIO_MODE(__MODE__) (((__MODE__) == MSIO_MODE_ANALOG) || \
212  ((__MODE__) == MSIO_MODE_DIGITAL))
213 
219 #define IS_MSIO_PULL(__PULL__) (((__PULL__) == MSIO_NOPULL) || \
220  ((__PULL__) == MSIO_PULLUP) || \
221  ((__PULL__) == MSIO_PULLDOWN))
222 
227 /* Include MSIO HAL Extended module */
228 #include "gr55xx_hal_msio_ex.h"
229 
230 /* Exported functions --------------------------------------------------------*/
247 void hal_msio_init(msio_init_t *p_msio_init);
248 
262 void hal_msio_deinit(uint32_t msio_pin);
263 
286 
304 void hal_msio_write_pin(uint16_t msio_pin, msio_pin_state_t pin_state);
305 
319 void hal_msio_toggle_pin(uint16_t msio_pin);
320 
326 #ifdef __cplusplus
327 }
328 #endif
329 
330 #endif /* __GR55xx_HAL_MSIO_H__ */
331 
_msio_init::direction
uint32_t direction
Definition: gr55xx_hal_msio.h:91
hal_msio_deinit
void hal_msio_deinit(uint32_t msio_pin)
De-initialize the MSIOx peripheral registers to their default reset values.
hal_msio_init
void hal_msio_init(msio_init_t *p_msio_init)
Initialize the MSIOx peripheral according to the specified parameters in the msio_init_t.
MSIO_PIN_RESET
@ MSIO_PIN_RESET
Definition: gr55xx_hal_msio.h:73
_msio_init
MSIO init structure definition.
Definition: gr55xx_hal_msio.h:87
gr55xx_ll_msio.h
Header file containing functions prototypes of MSIO LL library.
msio_init_t
struct _msio_init msio_init_t
MSIO init structure definition.
_msio_init::mode
uint32_t mode
Definition: gr55xx_hal_msio.h:94
hal_msio_write_pin
void hal_msio_write_pin(uint16_t msio_pin, msio_pin_state_t pin_state)
Set or clear the selected data port bit.
hal_msio_toggle_pin
void hal_msio_toggle_pin(uint16_t msio_pin)
Toggle the specified MSIO pin.
_msio_init::mux
uint32_t mux
Definition: gr55xx_hal_msio.h:100
hal_msio_read_pin
msio_pin_state_t hal_msio_read_pin(uint16_t msio_pin)
Read the specified input port pin.
msio_pin_state_t
msio_pin_state_t
MSIO Bit SET and Bit RESET enumerations.
Definition: gr55xx_hal_msio.h:72
MSIO_PIN_SET
@ MSIO_PIN_SET
Definition: gr55xx_hal_msio.h:74
_msio_init::pull
uint32_t pull
Definition: gr55xx_hal_msio.h:97
_msio_init::pin
uint32_t pin
Definition: gr55xx_hal_msio.h:88
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
gr55xx_hal_msio_ex.h
Header file containing extended macro of MSIO HAL library.