SAM4SD32 (SAM4S-EK2)
Loading...
Searching...
No Matches
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
41extern "C" {
42#endif
43
44#include <parts.h>
45#include <compiler.h>
46
63
74
80
86
87#if MEGA_RF
89enum ioport_sense {
90 IOPORT_SENSE_LEVEL,
94};
95#elif SAM && !SAM4L
104#elif XMEGA
105enum ioport_sense {
110};
111#else
112enum ioport_sense {
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 | WLR089)
133# include "sam0/ioport.h"
134# else
135# include "sam/ioport_pio.h"
136# endif
137#endif
138
145static inline void ioport_init(void)
146{
148}
149
156static inline void ioport_enable_pin(ioport_pin_t pin)
157{
159}
160
167static inline void ioport_enable_port(ioport_port_t port,
169{
170 arch_ioport_enable_port(port, mask);
171}
172
179static inline void ioport_disable_pin(ioport_pin_t pin)
180{
182}
183
190static inline void ioport_disable_port(ioport_port_t port,
192{
193 arch_ioport_disable_port(port, mask);
194}
195
205static inline void ioport_set_port_mode(ioport_port_t port,
207{
208 arch_ioport_set_port_mode(port, mask, mode);
209}
210
217static 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
228static inline void ioport_reset_port_mode(ioport_port_t port,
230{
231 arch_ioport_set_port_mode(port, mask, 0);
232}
233
239static inline void ioport_reset_pin_mode(ioport_pin_t pin)
240{
242}
243
251static inline void ioport_set_port_dir(ioport_port_t port,
253{
254 arch_ioport_set_port_dir(port, mask, dir);
255}
256
263static 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
275static inline void ioport_set_pin_level(ioport_pin_t pin, bool level)
276{
277 arch_ioport_set_pin_level(pin, level);
278}
279
288static 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
301static inline bool ioport_get_pin_level(ioport_pin_t pin)
302{
303 return arch_ioport_get_pin_level(pin);
304}
305
317{
318 return arch_ioport_get_port_level(port, mask);
319}
320
328{
330}
331
340{
342}
343
351 enum ioport_sense pin_sense)
352{
353 arch_ioport_set_pin_sense_mode(pin, pin_sense);
354}
355
365 enum ioport_sense pin_sense)
366{
367 arch_ioport_set_port_sense_mode(port, mask, pin_sense);
368}
369
380
388{
389 return arch_ioport_pin_to_mask(pin);
390}
391
393
472
533
534#ifdef __cplusplus
535}
536#endif
537
538#endif /* IOPORT_H */
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_pin_mode(ioport_pin_t pin, ioport_mode_t mode)
Set pin mode for one single IOPORT pin.
Definition ioport.h:217
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 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_disable_port(ioport_port_t port, ioport_port_mask_t mask)
Disable multiple pins in a single IOPORT port.
Definition ioport.h:190
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 void ioport_init(void)
Initializes the IOPORT service, ready for use.
Definition ioport.h:145
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.
Definition ioport.h:205
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
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
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
ioport_sense
IOPORT edge sense modes.
Definition ioport.h:97
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
ioport_direction
IOPORT pin directions.
Definition ioport.h:76
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 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 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 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_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_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 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_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
ioport_value
IOPORT levels.
Definition ioport.h:82
static void ioport_reset_pin_mode(ioport_pin_t pin)
Reset pin mode configuration for a single IOPORT pin.
Definition ioport.h:239
@ IOPORT_SENSE_LEVEL_HIGH
Definition ioport.h:102
@ IOPORT_SENSE_BOTHEDGES
Definition ioport.h:98
@ IOPORT_SENSE_RISING
Definition ioport.h:100
@ IOPORT_SENSE_LEVEL_LOW
Definition ioport.h:101
@ IOPORT_SENSE_FALLING
Definition ioport.h:99
@ IOPORT_DIR_OUTPUT
Definition ioport.h:78
@ IOPORT_DIR_INPUT
Definition ioport.h:77
@ IOPORT_PIN_LEVEL_LOW
Definition ioport.h:83
@ IOPORT_PIN_LEVEL_HIGH
Definition ioport.h:84
SAM architecture specific IOPORT service implementation header file.
static __always_inline void arch_ioport_set_pin_level(ioport_pin_t pin, bool level)
Definition ioport_pio.h:278
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 ioport_port_t arch_ioport_pin_to_port_id(ioport_pin_t pin)
Definition ioport_pio.h:97
uint32_t ioport_mode_t
Definition ioport_pio.h:92
uint32_t ioport_port_mask_t
Definition ioport_pio.h:95
uint32_t ioport_pin_t
Definition ioport_pio.h:93
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_init(void)
Definition ioport_pio.h:131
static __always_inline void arch_ioport_toggle_pin_level(ioport_pin_t pin)
Definition ioport_pio.h:313
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_level(ioport_port_t port, ioport_port_mask_t mask, enum ioport_value level)
Definition ioport_pio.h:290
static __always_inline void arch_ioport_set_pin_dir(ioport_pin_t pin, enum ioport_direction dir)
Definition ioport_pio.h:264
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 __always_inline ioport_port_mask_t arch_ioport_pin_to_mask(ioport_pin_t pin)
Definition ioport_pio.h:126
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 __always_inline void arch_ioport_disable_pin(ioport_pin_t pin)
Definition ioport_pio.h:171
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_enable_port(ioport_port_t port, ioport_port_mask_t mask)
Definition ioport_pio.h:153
static __always_inline void arch_ioport_set_pin_mode(ioport_pin_t pin, ioport_mode_t mode)
Definition ioport_pio.h:243
static __always_inline bool arch_ioport_get_pin_level(ioport_pin_t pin)
Definition ioport_pio.h:302
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
uint32_t ioport_port_t
Definition ioport_pio.h:94