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);
Содержание OMNii HDK XT10
Страница 4: ......
Страница 10: ......
Страница 12: ......
Страница 18: ......
Страница 20: ......
Страница 24: ......
Страница 26: ......
Страница 32: ......
Страница 72: ......
Страница 90: ......
Страница 92: ......
Страница 116: ......
Страница 124: ......
Страница 126: ......
Страница 130: ......
Страница 132: ......
Страница 154: ......
Страница 168: ......
Страница 170: ......
Страница 182: ......
Страница 184: ......
Страница 188: ......