I/o examples toolkit – Echelon Mini FX User Manual

Page 93

Advertising
background image

80 Developing

Device

Applications

// Set the cursor position
static const unsigned lcdRowAddress[4] = {0x00, 0x40, 0x14, 0x54};

SendLcdCommand(LCD_COMMAND_SETCURSOR, lcdRowAddress[row]+column, 2);

// Send the data
(void)io_out(ioIIC, data, I2C_ADDRESS_LCD, (unsigned)strlen(data));

# ifdef _DEBUG
// in a debug build, forward the same data to the serial port:
watchdog_update();
SerialOutput(data);
# endif // _debug
#else

// Use mini gizmo:

// Always send data to serial port (in lieu of a local display)
SerialOutput(data);
#endif // mini gizmo
}

//
// InitializeIO() is called from the when(reset) task and initalizes
// the I/O system and related driver functions.
//
void InitializeIO()
{
#ifdef USE_MINIGIZMO

#else
InitializeLCD();
#ifdef USE_5000EVB
io_change_init(ioSwitch1);
#endif // USE_5000EVB
#endif // USE_MINIGIZMO
} // InitializeIO

I/O Examples Toolkit

The following code is the combined I/O driver toolkit from the I/O examples in this

section. You can copy and paste this code into a file (the suggested filename is “io.nc”),
and use it with the example device applications in the following Creating Example Device

Applications section. Alternatively, you can paste the I/O toolkit code straight into your
application’s main Neuron C source file. Note that you must define either

USE_MINIGIZMO or USE_5000EVB based on your EVB.

//
// io.nc is the I/O toolkit that drives both FT 5000 EVB and PL 3150 EVB
// (actually, almost anything with a Mini Gizmo I/O board)
//
#ifndef __IO_NC__
#define __IO_NC__

#include <string.h>
#include <io_types.h>
#include <control.h>

//
// Make sure one of USE_5000EVB and USE_MINIGIZMO is defined. If both are
// defined, USE_MINIGIZMO has priority (allowing to use the Mini Gizmo I/O
// board with the FT 5000 EVB).
//
#ifndef USE_5000EVB
#ifndef USE_MINIGIZMO
# error "You must define either USE_5000EVK or USE_MINIGIZMO"
#endif // mini gizmo
#endif // 5000 evb

//
// Driver to support two leds. Use SetLeds(a, b) to drive the LEDs with
logical

Advertising