ioport.h
Go to the documentation of this file.
1 
34 /*
35  * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
36  */
37 #ifndef IOPORT_H
38 #define IOPORT_H
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #include <parts.h>
45 #include <compiler.h>
46 
79 };
80 
85 };
86 
87 #if MEGA_RF
88 
89 enum ioport_sense {
90  IOPORT_SENSE_LEVEL,
94 };
95 #elif SAM && !SAM4L
96 
97 enum ioport_sense {
101  IOPORT_SENSE_LEVEL_LOW,
102  IOPORT_SENSE_LEVEL_HIGH,
103 };
104 #elif XMEGA
105 enum ioport_sense {
109  IOPORT_SENSE_LEVEL_LOW,
110 };
111 #else
116 };
117 #endif
118 
119 
120 #if XMEGA
121 # include "xmega/ioport.h"
122 # if defined(IOPORT_XMEGA_COMPAT)
123 # include "xmega/ioport_compat.h"
124 # endif
125 #elif MEGA
126 # include "mega/ioport.h"
127 #elif UC3
128 # include "uc3/ioport.h"
129 #elif SAM
130 # if SAM4L
131 # include "sam/ioport_gpio.h"
132 # elif (SAMD20 | SAMD21 | SAML21| SAMR34 |SAMR35)
133 # include "sam0/ioport.h"
134 # else
135 # include "sam/ioport_pio.h"
136 # endif
137 #endif
138 
145 static inline void ioport_init(void)
146 {
148 }
149 
156 static inline void ioport_enable_pin(ioport_pin_t pin)
157 {
159 }
160 
167 static inline void ioport_enable_port(ioport_port_t port,
168  ioport_port_mask_t mask)
169 {
170  arch_ioport_enable_port(port, mask);
171 }
172 
179 static inline void ioport_disable_pin(ioport_pin_t pin)
180 {
182 }
183 
190 static inline void ioport_disable_port(ioport_port_t port,
191  ioport_port_mask_t mask)
192 {
193  arch_ioport_disable_port(port, mask);
194 }
195 
205 static inline void ioport_set_port_mode(ioport_port_t port,
207 {
208  arch_ioport_set_port_mode(port, mask, mode);
209 }
210 
217 static inline void ioport_set_pin_mode(ioport_pin_t pin, ioport_mode_t mode)
218 {
219  arch_ioport_set_pin_mode(pin, mode);
220 }
221 
228 static inline void ioport_reset_port_mode(ioport_port_t port,
229  ioport_port_mask_t mask)
230 {
231  arch_ioport_set_port_mode(port, mask, 0);
232 }
233 
239 static inline void ioport_reset_pin_mode(ioport_pin_t pin)
240 {
241  arch_ioport_set_pin_mode(pin, 0);
242 }
243 
251 static inline void ioport_set_port_dir(ioport_port_t port,
252  ioport_port_mask_t mask, enum ioport_direction dir)
253 {
254  arch_ioport_set_port_dir(port, mask, dir);
255 }
256 
263 static inline void ioport_set_pin_dir(ioport_pin_t pin,
264  enum ioport_direction dir)
265 {
266  arch_ioport_set_pin_dir(pin, dir);
267 }
268 
275 static inline void ioport_set_pin_level(ioport_pin_t pin, bool level)
276 {
277  arch_ioport_set_pin_level(pin, level);
278 }
279 
288 static inline void ioport_set_port_level(ioport_port_t port,
289  ioport_port_mask_t mask, enum ioport_value level)
290 {
291  arch_ioport_set_port_level(port, mask, level);
292 }
293 
301 static inline bool ioport_get_pin_level(ioport_pin_t pin)
302 {
303  return arch_ioport_get_pin_level(pin);
304 }
305 
316  ioport_port_mask_t mask)
317 {
318  return arch_ioport_get_port_level(port, mask);
319 }
320 
327 static inline void ioport_toggle_pin_level(ioport_pin_t pin)
328 {
330 }
331 
338 static inline void ioport_toggle_port_level(ioport_port_t port,
339  ioport_port_mask_t mask)
340 {
341  arch_ioport_toggle_port_level(port, mask);
342 }
343 
351  enum ioport_sense pin_sense)
352 {
353  arch_ioport_set_pin_sense_mode(pin, pin_sense);
354 }
355 
364  ioport_port_mask_t mask,
365  enum ioport_sense pin_sense)
366 {
367  arch_ioport_set_port_sense_mode(port, mask, pin_sense);
368 }
369 
377 {
378  return arch_ioport_pin_to_port_id(pin);
379 }
380 
388 {
389  return arch_ioport_pin_to_mask(pin);
390 }
391 
534 #ifdef __cplusplus
535 }
536 #endif
537 
538 #endif /* IOPORT_H */
uint32_t ioport_mode_t
Definition: ioport_pio.h:92
static void ioport_set_port_dir(ioport_port_t port, ioport_port_mask_t mask, enum ioport_direction dir)
Set I/O direction for a group of pins in a single IOPORT.
Definition: ioport.h:251
static void ioport_set_pin_mode(ioport_pin_t pin, ioport_mode_t mode)
Set pin mode for one single IOPORT pin.
Definition: ioport.h:217
static void ioport_set_pin_level(ioport_pin_t pin, bool level)
Set an IOPORT pin to a specified logical value.
Definition: ioport.h:275
static __always_inline void arch_ioport_toggle_pin_level(ioport_pin_t pin)
Definition: ioport_pio.h:313
static __always_inline ioport_port_mask_t arch_ioport_pin_to_mask(ioport_pin_t pin)
Definition: ioport_pio.h:126
static void ioport_reset_port_mode(ioport_port_t port, ioport_port_mask_t mask)
Reset multiple pin modes in a specified IOPORT port to defaults.
Definition: ioport.h:228
static __always_inline void arch_ioport_set_port_dir(ioport_port_t port, ioport_port_mask_t mask, enum ioport_direction group_direction)
Definition: ioport_pio.h:250
static __always_inline void arch_ioport_disable_pin(ioport_pin_t pin)
Definition: ioport_pio.h:171
ioport_direction
IOPORT pin directions.
Definition: ioport.h:76
static __always_inline void arch_ioport_set_pin_level(ioport_pin_t pin, bool level)
Definition: ioport_pio.h:278
static ioport_port_mask_t ioport_pin_to_mask(ioport_pin_t pin)
Convert a pin ID into a bitmask mask for the given pin on its port.
Definition: ioport.h:387
static void ioport_reset_pin_mode(ioport_pin_t pin)
Reset pin mode configuration for a single IOPORT pin.
Definition: ioport.h:239
static void ioport_enable_port(ioport_port_t port, ioport_port_mask_t mask)
Enable multiple pins in a single IOPORT port.
Definition: ioport.h:167
static __always_inline ioport_port_t arch_ioport_pin_to_port_id(ioport_pin_t pin)
Definition: ioport_pio.h:97
static __always_inline void arch_ioport_set_pin_dir(ioport_pin_t pin, enum ioport_direction dir)
Definition: ioport_pio.h:264
uint32_t ioport_port_mask_t
Definition: ioport_pio.h:95
static __always_inline void arch_ioport_enable_port(ioport_port_t port, ioport_port_mask_t mask)
Definition: ioport_pio.h:153
static __always_inline bool arch_ioport_get_pin_level(ioport_pin_t pin)
Definition: ioport_pio.h:302
static bool ioport_get_pin_level(ioport_pin_t pin)
Get current value of an IOPORT pin, which has been configured as an input.
Definition: ioport.h:301
static __always_inline void arch_ioport_set_pin_sense_mode(ioport_pin_t pin, enum ioport_sense pin_sense)
Definition: ioport_pio.h:366
static __always_inline void arch_ioport_set_port_level(ioport_port_t port, ioport_port_mask_t mask, enum ioport_value level)
Definition: ioport_pio.h:290
Commonly used includes, types and macros.
SAM architecture specific IOPORT service implementation header file.
static void ioport_init(void)
Initializes the IOPORT service, ready for use.
Definition: ioport.h:145
Atmel part identification macros.
uint32_t ioport_pin_t
Definition: ioport_pio.h:93
static void ioport_toggle_pin_level(ioport_pin_t pin)
Toggle the value of an IOPORT pin, which has previously configured as an output.
Definition: ioport.h:327
ioport_value
IOPORT levels.
Definition: ioport.h:82
ioport_sense
Definition: ioport.h:112
static __always_inline ioport_port_mask_t arch_ioport_get_port_level(ioport_port_t port, ioport_port_mask_t mask)
Definition: ioport_pio.h:307
static void ioport_set_port_level(ioport_port_t port, ioport_port_mask_t mask, enum ioport_value level)
Set a group of IOPORT pins in a single port to a specified logical value.
Definition: ioport.h:288
static __always_inline void arch_ioport_enable_pin(ioport_pin_t pin)
Definition: ioport_pio.h:165
static __always_inline void arch_ioport_set_port_sense_mode(ioport_port_t port, ioport_port_mask_t mask, enum ioport_sense pin_sense)
Definition: ioport_pio.h:331
static __always_inline void arch_ioport_init(void)
Definition: ioport_pio.h:131
static void ioport_disable_port(ioport_port_t port, ioport_port_mask_t mask)
Disable multiple pins in a single IOPORT port.
Definition: ioport.h:190
static __always_inline void arch_ioport_set_port_mode(ioport_port_t port, ioport_port_mask_t mask, ioport_mode_t mode)
Definition: ioport_pio.h:177
static ioport_port_t ioport_pin_to_port_id(ioport_pin_t pin)
Convert a pin ID into a its port ID.
Definition: ioport.h:376
static void ioport_set_pin_dir(ioport_pin_t pin, enum ioport_direction dir)
Set direction for a single IOPORT pin.
Definition: ioport.h:263
static void ioport_enable_pin(ioport_pin_t pin)
Enable an IOPORT pin, based on a pin created with IOPORT_CREATE_PIN().
Definition: ioport.h:156
static void ioport_set_port_mode(ioport_port_t port, ioport_port_mask_t mask, ioport_mode_t mode)
Set multiple pin modes in a single IOPORT port, such as pull-up, pull-down, etc. configuration.
Definition: ioport.h:205
static __always_inline void arch_ioport_toggle_port_level(ioport_port_t port, ioport_port_mask_t mask)
Definition: ioport_pio.h:325
static __always_inline void arch_ioport_disable_port(ioport_port_t port, ioport_port_mask_t mask)
Definition: ioport_pio.h:159
static __always_inline void arch_ioport_set_pin_mode(ioport_pin_t pin, ioport_mode_t mode)
Definition: ioport_pio.h:243
static ioport_port_mask_t ioport_get_port_level(ioport_pin_t port, ioport_port_mask_t mask)
Get current value of several IOPORT pins in a single port, which have been configured as an inputs...
Definition: ioport.h:315
static void ioport_disable_pin(ioport_pin_t pin)
Disable IOPORT pin, based on a pin created with IOPORT_CREATE_PIN().
Definition: ioport.h:179
uint32_t ioport_port_t
Definition: ioport_pio.h:94
static void ioport_toggle_port_level(ioport_port_t port, ioport_port_mask_t mask)
Toggle the values of several IOPORT pins located in a single port.
Definition: ioport.h:338
static void ioport_set_port_sense_mode(ioport_port_t port, ioport_port_mask_t mask, enum ioport_sense pin_sense)
Set the pin sense mode of a multiple IOPORT pins on a single port.
Definition: ioport.h:363
static void ioport_set_pin_sense_mode(ioport_pin_t pin, enum ioport_sense pin_sense)
Set the pin sense mode of a single IOPORT pin.
Definition: ioport.h:350


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57