LatticeMico8 Microcontroller Software Support
26
LatticeMico GPIO
Figure 19: Macros for Accessing Each Byte of the Data Register (Cont.)
Software Usage Examples
This section provides code example that demonstrate how to locate a GPIO
device that is instantiated in the platform and how to directly access the data
register using the macros provided in MicoGPIO.h header file.
#define MICO_GPIO_WRITE_IRQ_MASK_BYTE2(X, Y) \
(__builtin_export((char)(Y),
(size_t)(X+GPIO_IRQ_MASK2)))
#define MICO_GPIO_WRITE_IRQ_MASK_BYTE3(X, Y) \
(__builtin_export((char)(Y),
(size_t)(X+GPIO_IRQ_MASK3)))
/* Macros for accessing each byte of the Edge Capture
Register */
#define MICO_GPIO_READ_EDGE_CAPTURE_BYTE0(X, Y) \
(Y) =
(__builtin_import((size_t)(X+GPIO_EDGE_CAPTURE0)))
#define MICO_GPIO_READ_EDGE_CAPTURE_BYTE1(X, Y) \
(Y) =
(__builtin_import((size_t)(X+GPIO_EDGE_CAPTURE1)))
#define MICO_GPIO_READ_EDGE_CAPTURE_BYTE2(X, Y) \
(Y) =
(__builtin_import((size_t)(X+GPIO_EDGE_CAPTURE2)))
#define MICO_GPIO_READ_EDGE_CAPTURE_BYTE3(X, Y) \
(Y) =
(__builtin_import((size_t)(X+GPIO_EDGE_CAPTURE3)))
/* Macros for writing each byte of the Edge Capture Register
*/
#define MICO_GPIO_WRITE_EDGE_CAPTURE_BYTE0(X, Y) \
(__builtin_export((char)(Y),
(size_t)(X+GPIO_EDGE_CAPTURE0)))
#define MICO_GPIO_WRITE_EDGE_CAPTURE_BYTE1(X, Y) \
(__builtin_export((char)(Y),
(size_t)(X+GPIO_EDGE_CAPTURE1)))
#define MICO_GPIO_WRITE_EDGE_CAPTURE_BYTE2(X, Y) \
(__builtin_export((char)(Y),
(size_t)(X+GPIO_EDGE_CAPTURE2)))
#define MICO_GPIO_WRITE_EDGE_CAPTURE_BYTE3(X, Y) \
(__builtin_export((char)(Y),
(size_t)(X+GPIO_EDGE_CAPTURE3)))