Mini gizmo i/o board – Echelon Mini FX User Manual

Page 86

Advertising
background image

Mini FX User's Guide

73

IO_9 input bit ioSwitch1;

void example()
{
if ((boolean)io_in(ioSwitch1)) {

}
}

The Neuron C language implements a largely event-driven programming model. This
means that instead of constantly polling all I/O for new data, your device application only

needs to respond to changes. The following example initializes this system during reset

processing, and calls an OnButtonPressed() event handler whenever an activated
button is detected. The OnButtonPressed() event handler does nothing in this

example, but it will be modified later to respond to button events:

IO_9 input bit ioSwitch1;

extern void OnButtonPressed(void);

// button event handler


//
// InitializeIO() is called from the when(reset) task and initializes
// the I/O system and related driver functions.
//
void InitializeIO()
{
io_change_init(ioSwitch1);
}
//
// when(reset) executes whenever the device resets. It performs housekeeping
// and initialization tasks as required by the application.
//
when(reset)
{
InitializeIO();
//
// TODO: add other initialization code, if necessary
//

}

//
// when(io_changes…) executes whenever the switch
//
when(io_changes(ioSwitch1) to 0)
{
OnButtonPressed();
}

//
// OnButtonPressed() is called whenever the button becomes active. This
// initial implementation here does nothing.
//
void OnButtonPressed()
{
}

Note: The FT 5000 EVB examples included with the Mini kit contain a
EvalBoardGetSwitch() function that demonstrates how to efficiently handle both push

buttons on the FT 5000 EVB. This function is contained in the ft5000evalboard.h file,
which is located in the L

ON

W

ORKS

\NeuronC\Examples\FT5000 EVB\Common

folder on your computer.

Mini Gizmo I/O Board

The Mini Gizmo I/O board includes eight buttons that are connected to a parallel-in

serial-out shift register. These buttons are sampled using a bitshift input model for data,

Advertising