Chapter 4: Software
Omnii HDK API Functions
Psion Teklogix Omnii HDK User Manual
41
Sample Code
4.7.4.8 Hdk7545_ExpansionSetPinDirection
Syntax
DWORD Hdk7545_ExpansionSetPinDirection( HANDLE hdk, DWORD pin,
Hdk7545_PinDirection direction );
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.
•
direction – [in] the new pin direction (input/output).
Description
Sets the specified pin on the expansion connector to be either an input or an output.
Expansion connector 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 (see
page 46). The pin direction does not need to be set if the alternate (non-GPIO) function for the pin
is enabled.
Drivers and/or applications must set the pin direction to output before calling the
Hdk7545_ExpansionSetPinState function.
DWORD GetPowerMode()
{
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_PowerMode mode = Hdk7545_PowerMode_Manual;
result = Hdk7545_GetPowerMode(hdkHandle, &mode);
if( result != ERROR_SUCCESS ) {
Hdk7545_Close(&hdkHandle);
return ERROR_GEN_FAILURE;
}
if( mode != Hdk7545_PowerMode_Manual )
{
result = Hdk7545_SetPowerMode(hdkHandle, Hdk7545_PowerMode_Manual);
if( result != ERROR_SUCCESS ) {
Hdk7545_Close(&hdkHandle);
return ERROR_GEN_FAILURE;
}
}
Hdk7545_Close(&hdkHandle);
return ERROR_SUCCESS;
}
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: ......