AIROC™ BTSDK v4.9 - Documentation | ||||
Data Structures | |
struct | GpioRegistration |
Typedefs | |
typedef struct GpioRegistration | GpioRegistration |
Enumerations | |
enum | { GPIO_NUM_PORTS = GPIO_NUMBER_OF_PORTS, GPIO_MAX_NUM_PINS_PER_PORT = GPIO_MAX_PINS_PER_PORT, GPIO_NUM_PINS = GPIO_NUMBER_OF_PINS } |
Defines a GPIO driver class. More... | |
enum | { GPIO_PIN_P0 = 0, GPIO_PIN_P1, GPIO_PIN_P2, GPIO_PIN_P3, GPIO_PIN_P4, GPIO_PIN_P5, GPIO_PIN_P6, GPIO_PIN_P7, GPIO_PIN_P8, GPIO_PIN_P9, GPIO_PIN_P10, GPIO_PIN_P11, GPIO_PIN_P12, GPIO_PIN_P13, GPIO_PIN_P14, GPIO_PIN_P15, GPIO_PIN_P16, GPIO_PIN_P17, GPIO_PIN_P18, GPIO_PIN_P19, GPIO_PIN_P20, GPIO_PIN_P21, GPIO_PIN_P22, GPIO_PIN_P23, GPIO_PIN_P24, GPIO_PIN_P25, GPIO_PIN_P26, GPIO_PIN_P27, GPIO_PIN_P28, GPIO_PIN_P29, GPIO_PIN_P30, GPIO_PIN_P31, GPIO_PIN_P32, GPIO_PIN_P33, GPIO_PIN_P34, GPIO_PIN_P35, GPIO_PIN_P36, GPIO_PIN_P37, GPIO_PIN_P38, GPIO_PIN_P39 } |
GPIO Logical pin numbers. | |
enum | { GPIO_EDGE_TRIGGER_MASK = 0x0001, GPIO_EDGE_TRIGGER = 0x0001, GPIO_LEVEL_TRIGGER = 0x0000, GPIO_TRIGGER_POLARITY_MASK = 0x0002, GPIO_TRIGGER_NEG = 0x0002, GPIO_DUAL_EDGE_TRIGGER_MASK = 0x0004, GPIO_EDGE_TRIGGER_BOTH = 0x0004, GPIO_EDGE_TRIGGER_SINGLE = 0x0000, GPIO_INTERRUPT_ENABLE_MASK = 0x0008, GPIO_INTERRUPT_ENABLE = 0x0008, GPIO_INTERRUPT_DISABLE = 0x0000, GPIO_EN_INT_MASK = GPIO_EDGE_TRIGGER_MASK | GPIO_TRIGGER_POLARITY_MASK | GPIO_DUAL_EDGE_TRIGGER_MASK | GPIO_INTERRUPT_ENABLE_MASK, GPIO_EN_INT_LEVEL_HIGH = GPIO_INTERRUPT_ENABLE | GPIO_LEVEL_TRIGGER, GPIO_EN_INT_LEVEL_LOW = GPIO_INTERRUPT_ENABLE | GPIO_LEVEL_TRIGGER | GPIO_TRIGGER_NEG, GPIO_EN_INT_RISING_EDGE = GPIO_INTERRUPT_ENABLE | GPIO_EDGE_TRIGGER, GPIO_EN_INT_FALLING_EDGE = GPIO_INTERRUPT_ENABLE | GPIO_EDGE_TRIGGER | GPIO_TRIGGER_NEG, GPIO_EN_INT_BOTH_EDGE = GPIO_INTERRUPT_ENABLE | GPIO_EDGE_TRIGGER | GPIO_EDGE_TRIGGER_BOTH, GPIO_INPUT_ENABLE = 0x0000, GPIO_OUTPUT_DISABLE = 0x0000, GPIO_OUTPUT_ENABLE = 0x4000, GPIO_KS_OUTPUT_ENABLE = 0x0010, GPIO_OUTPUT_FN_SEL_MASK = 0x0030, GPIO_OUTPUT_FN_SEL_SHIFT = 4, GPIO_GLOBAL_INPUT_ENABLE = 0x0000, GPIO_GLOBAL_INPUT_DISABLE = 0x0040, GPIO_PULL_UP_DOWN_NONE = 0x0000, GPIO_PULL_UP = 0x0400, GPIO_PULL_DOWN = 0x0200, GPIO_INPUT_DISABLE = 0x0600, GPIO_DRIVE_SEL_MASK = 0x0800, GPIO_DRIVE_SEL_LOWEST = 0x0000, GPIO_DRIVE_SEL_MIDDLE_0 = 0x0000, GPIO_DRIVE_SEL_MIDDLE_1 = 0x0800, GPIO_DRIVE_SEL_HIGHEST = 0x0800, GPIO_HYSTERESIS_MASK = 0x2000, GPIO_HYSTERESIS_ON = 0x2000, GPIO_HYSTERESIS_OFF = 0x0000 } |
The following enum defines the constant values for the GPIO driver. More... | |
enum | tGPIO_PIN_OUTPUT_CONFIG { GPIO_PIN_OUTPUT_LOW, GPIO_PIN_OUTPUT_HIGH } |
Pin output config. | |
enum | tGPIO_PIN_INPUT_VALUE { GPIO_PIN_INPUT_LOW, GPIO_PIN_INPUT_HIGH } |
Pin input values. | |
Functions | |
void | gpio_init (void) |
void | gpio_configurePin (BYTE port, BYTE pin, UINT16 config, BYTE outputVal) |
ConfigurePin maps a GPIO pin to a config value. | |
void | gpio_configurePinWithSingleBytePortPinNum (BYTE gpio, UINT16 config, BYTE outputVal) |
void | gpio_configureAll (void) |
Configures all GPIO pins according to the values from the configuration record. | |
UINT16 | gpio_getPinConfig (BYTE port, BYTE pin) |
Retrieve the configuration of the specified pin. | |
void | gpio_setPinOutput (BYTE port, BYTE pin, BYTE val) |
Set pin output for a specific pin. | |
void | gpio_lhlInterrupt (void) |
void | gpio_registerForInterrupt (UINT16 masks[], void(*userfn)(void *, UINT8), void *userdata) |
BOOL32 | gpio_validatePortPin (BYTE port, BYTE pin) |
BYTE | gpio_getPinOutput (BYTE port, BYTE pin) |
Get the programmed output value of a pin. More... | |
BYTE | gpio_getPinInput (BYTE port, BYTE pin) |
Read the current value at a pin. More... | |
BYTE | gpio_getPinInterruptStatus (BYTE port, BYTE pin) |
Get the interrupt status of a pin. | |
void | gpio_clearPinInterruptStatus (BYTE port, BYTE pin) |
Clear the interrupt status of a pin. | |
UINT16 | gpio_getPortOutput (BYTE port) |
Get the programmed output value of a port. More... | |
void | gpio_setPortOutput (BYTE port, UINT16 val) |
Set the output value of a port. More... | |
UINT16 | gpio_getPortInput (BYTE port) |
Read the current value at a port. More... | |
UINT16 | gpio_getPortInterruptStatus (BYTE port) |
Get the interrupt status of a port. More... | |
void | gpio_clearPortInterruptStatus (BYTE port, UINT16 mask) |
Clear the interrupt status of multiple bits in a port. More... | |
void | gpio_configurePortPins (BYTE port, BYTE startPin, BYTE endPin, UINT16 Config, BYTE outputVal) |
void | gpio_inputDisableAll (void) |
anonymous enum |
Defines a GPIO driver class.
Applications use this driver to obtain the status from and control the behavior of the GPIO driver.GPIO port and pin number constraints expressed in values.
anonymous enum |
The following enum defines the constant values for the GPIO driver.
The first twelve entries are the configuration masks for GPIO. A combination of them might be used together; for example a value INPUT_DISABLE_MASK|OUTPUT_ENABLE_MASK can be used to set a pin. The "configValue" of the struct "GpioConfigEntry" can be set using that value (the logical or of configuration options). Each of the pin can be configured in a specific way [using the value].
void gpio_clearPortInterruptStatus | ( | BYTE | port, |
UINT16 | mask | ||
) |
Clear the interrupt status of multiple bits in a port.
The mask defines which interrupt bits are cleared. Only bits that are used for edge/level detection/interrupt should be cleared. Other bits should be left alone.
port | - port id(0-4). Must be in range or results are undefined. |
mask | - mask of which bits are cleared |
BYTE gpio_getPinInput | ( | BYTE | port, |
BYTE | pin | ||
) |
Read the current value at a pin.
Note that for this to be valid, the pin must be configured with input enabled.
BYTE gpio_getPinOutput | ( | BYTE | port, |
BYTE | pin | ||
) |
Get the programmed output value of a pin.
Note that this does not return the current pin value. It returns the value that the pin would attempt to drive if it is configured as output.
UINT16 gpio_getPortInput | ( | BYTE | port | ) |
Read the current value at a port.
For this to be valid, the pins must be configured with input enabled. Pins which are configured with input disabled will always return the same value (0 or 1) but the value is not specified.
port | - port id(0-1). Must be in range or results are undefined. |
UINT16 gpio_getPortInterruptStatus | ( | BYTE | port | ) |
Get the interrupt status of a port.
Pins which are not used for interrupts and do not have input disabled may report interrupts. Its the user's responsibility to mask out these bits.
port | - port id(0-4). Must be in range or results are undefined. |
UINT16 gpio_getPortOutput | ( | BYTE | port | ) |
Get the programmed output value of a port.
port | - port id(0-4). Must be in range or results are undefined. |
void gpio_setPortOutput | ( | BYTE | port, |
UINT16 | val | ||
) |
Set the output value of a port.
This only affects pins which are configured as outputs. Pins which are not outputs will still get the specified value written in the output register, but since they are not configured as utputs, the value will not be driven out on the pin.
port | - port id(0-3). Must be in range or results are undefined. |
val | - value to be set |