LatticeMico8 Microcontroller Software Support
LatticeMico GPIO
27
.
Figure 20: Locating a GPIO and Accessing Its Data Register
include "DDStructs.h"
#include "MicoGPIO.h"
int main (void)
{
/* Fetch GPIO instance named 'LED' */
MicoGPIOCtx_t *leds = &gpio_LED;
if (leds == 0) {
/* failed to find a component named "LED" */
return (-1);
}
/* Write 0x1 to programmable I/O pins via the data register
*/
MICO_GPIO_WRITE_DATA_BYTE0 (leds->base, 0x1);
/* Read back the value in the data register */
unsigned char iValue;
MICO_GPIO_READ_DATA_BYTE0 (leds->base, iValue);
return 0;
}
Revision History
Component Version
Description
1.0
Initial release.
3.0 (7.0 SP2)
Cleaned up code. No function change.
3.1
Updated the Edge Capture Register clean method.
Made IRQ Mask register readable.
3.2 (8.1 SP1)
WISHBONE data bus size is configurable to 8 or 32 bits.
Register map is updated to accommodate 8/32-bit
WISHBONE data bus.
3.3
Added LatticeMico8 software support.
3.4
Fixed issues with synthesis when component is configured
for both input and output ports and the widths of each are
different.
3.4
Updated document with new corporate logo.
3.5
Improved modules naming system to support component
scanning function.