Chapter 4: Software
Omnii HDK API Functions
46
Psion Teklogix Omnii HDK User Manual
4.7.4.12 Hdk7545_ExpansionSetPinFunction
Syntax
DWORD Hdk7545_ExpansionSetPinFunction( HANDLE hdk, DWORD pin,
Hdk7545_PinFunction function );
Parameters
•
hdk – [in] an open HDK handle.
•
pin – [in] the ID of the expansion connector pin. The pin parameter must be set to one of the
HDK7545_GPIO_PIN_EXPANSION_xxx values.
•
function – [in] the pin function (GPIO or alternate).
Description
Each of the three expansion ports on Omnii has eight configurable pins. These pins can be
configured for use as a GPIO interface, or they can be reassigned to an alternate function (serial or
SPI) using the Hdk7545_ExpansionSetPinFunction function. This function allows drivers and
applications to switch between the two functional modes. If a driver or application is going to use
one or more of the eight pins as GPIOs, it must first call this function for each of the pins used.
If a device driver loaded by the peripherals driver requires the UART functionality of the pin, it
should set the appropriate bit in the “LoadFlags” registry value (see Section 4.4.1.1: “Device
Information Registry Keys”).
Returns
•
ERROR_SUCCESS – if successful.
•
ERROR_INVALID_HANDLE – the specified handle is invalid.
•
ERROR_INVALID_PARAMETER – the specified pin is not valid.
•
ERROR_INVALID_DATA - an exception was generated.
•
Other errors are possible.
Sample Code
// set the first four pins to UART functionality
// make the other four pins GPIOs
DWORD SetFunction()
{
Hdk7545_Connector expansionSlot = Hdk7545_Connector_Expansion1;
HANDLE hdkHandle = INVALID_HANDLE_VALUE;
DWORD result = Hdk7545_Open(&hdkHandle, expansionSlot);
if( result != ERROR_SUCCESS ) {
return ERROR_NOT_SUPPORTED;
}
Hdk7545_ExpansionSetPinFunction(hdkHandle,
HDK7545_GPIO_PIN_EXPANSION_GPIO1_RXD,Hdk7545_PinFunction_Alternate);
Hdk7545_ExpansionSetPinFunction(hdkHandle,
HDK7545_GPIO_PIN_EXPANSION_GPIO0_TXD,Hdk7545_PinFunction_Alternate);
Hdk7545_ExpansionSetPinFunction(hdkHandle,
HDK7545_GPIO_PIN_EXPANSION_GPIO2_CTSN,Hdk7545_PinFunction_Alternate);
Hdk7545_ExpansionSetPinFunction(hdkHandle,
HDK7545_GPIO_PIN_EXPANSION_GPIO3_RTSN,Hdk7545_PinFunction_Alternate);
Hdk7545_ExpansionSetPinFunction(hdkHandle,
HDK7545_GPIO_PIN_EXPANSION_GPIO4_MOSI,Hdk7545_PinFunction_Alternate);
Hdk7545_ExpansionSetPinFunction(hdkHandle,
HDK7545_GPIO_PIN_EXPANSION_GPIO5_MISO,Hdk7545_PinFunction_Alternate);
Hdk7545_ExpansionSetPinFunction(hdkHandle,
HDK7545_GPIO_PIN_EXPANSION_GPIO6_SCLK,Hdk7545_PinFunction_Alternate);
Summary of Contents for OMNii HDK XT10
Page 4: ......
Page 10: ......
Page 12: ......
Page 18: ......
Page 20: ......
Page 24: ......
Page 26: ......
Page 32: ......
Page 72: ......
Page 90: ......
Page 92: ......
Page 116: ......
Page 124: ......
Page 126: ......
Page 130: ......
Page 132: ......
Page 154: ......
Page 168: ......
Page 170: ......
Page 182: ......
Page 184: ......
Page 188: ......