Header for the digital port driver. More...
Go to the source code of this file.
Data Structures | |
struct | _ioDef |
Holds port, pad and mode for a given cortex digital IO pin. More... | |
Macros | |
Digital IO Pins | |
correlate a port on the cortex with a port/pin combo on the STM32 The STM32F103 has five 16 bit GPIO ports, A through E. We define the 12 digital port/pad pairs in the board.h file but then dereference them once more here. | |
#define | VEX_DIGIO_1_PAD GPIOE_DIGIO_1 |
#define | VEX_DIGIO_2_PAD GPIOE_DIGIO_2 |
#define | VEX_DIGIO_3_PAD GPIOC_DIGIO_3 |
#define | VEX_DIGIO_4_PAD GPIOC_DIGIO_4 |
#define | VEX_DIGIO_5_PAD GPIOE_DIGIO_5 |
#define | VEX_DIGIO_6_PAD GPIOE_DIGIO_6 |
#define | VEX_DIGIO_7_PAD GPIOE_DIGIO_7 |
#define | VEX_DIGIO_8_PAD GPIOE_DIGIO_8 |
#define | VEX_DIGIO_9_PAD GPIOE_DIGIO_9 |
#define | VEX_DIGIO_10_PAD GPIOE_DIGIO_10 |
#define | VEX_DIGIO_11_PAD GPIOD_DIGIO_11 |
#define | VEX_DIGIO_12_PAD GPIOD_DIGIO_12 |
#define | VEX_DIGIO_1_PORT PORT_DIGIO_1 |
#define | VEX_DIGIO_2_PORT PORT_DIGIO_2 |
#define | VEX_DIGIO_3_PORT PORT_DIGIO_3 |
#define | VEX_DIGIO_4_PORT PORT_DIGIO_4 |
#define | VEX_DIGIO_5_PORT PORT_DIGIO_5 |
#define | VEX_DIGIO_6_PORT PORT_DIGIO_6 |
#define | VEX_DIGIO_7_PORT PORT_DIGIO_7 |
#define | VEX_DIGIO_8_PORT PORT_DIGIO_8 |
#define | VEX_DIGIO_9_PORT PORT_DIGIO_9 |
#define | VEX_DIGIO_10_PORT PORT_DIGIO_10 |
#define | VEX_DIGIO_11_PORT PORT_DIGIO_11 |
#define | VEX_DIGIO_12_PORT PORT_DIGIO_12 |
Fast IO pin access | |
These are used to bypass IO pin boundary checks when maximum speed is desired. Normal IO pin access should be done using vexDigitalPinSet | |
#define | VexDigInput_1() palReadPad( VEX_DIGIO_1_PORT, VEX_DIGIO_1_PAD ) |
#define | VexDigInput_2() palReadPad( VEX_DIGIO_2_PORT, VEX_DIGIO_2_PAD ) |
#define | VexDigInput_3() palReadPad( VEX_DIGIO_3_PORT, VEX_DIGIO_3_PAD ) |
#define | VexDigInput_4() palReadPad( VEX_DIGIO_4_PORT, VEX_DIGIO_4_PAD ) |
#define | VexDigInput_5() palReadPad( VEX_DIGIO_5_PORT, VEX_DIGIO_5_PAD ) |
#define | VexDigInput_6() palReadPad( VEX_DIGIO_6_PORT, VEX_DIGIO_6_PAD ) |
#define | VexDigInput_7() palReadPad( VEX_DIGIO_7_PORT, VEX_DIGIO_7_PAD ) |
#define | VexDigInput_8() palReadPad( VEX_DIGIO_8_PORT, VEX_DIGIO_8_PAD ) |
#define | VexDigInput_9() palReadPad( VEX_DIGIO_9_PORT, VEX_DIGIO_9_PAD ) |
#define | VexDigInput_10() palReadPad( VEX_DIGIO_10_PORT, VEX_DIGIO_10_PAD ) |
#define | VexDigInput_11() palReadPad( VEX_DIGIO_11_PORT, VEX_DIGIO_11_PAD ) |
#define | VexDigInput_12() palReadPad( VEX_DIGIO_12_PORT, VEX_DIGIO_12_PAD ) |
#define | VexPinOutput_1(x) |
#define | VexPinOutput_2(x) |
#define | VexPinOutput_3(x) |
#define | VexPinOutput_4(x) |
#define | VexPinOutput_5(x) |
#define | VexPinOutput_6(x) |
#define | VexPinOutput_7(x) |
#define | VexPinOutput_8(x) |
#define | VexPinOutput_9(x) |
#define | VexPinOutput_10(x) |
#define | VexPinOutput_11(x) |
#define | VexPinOutput_12(x) |
Typedefs | |
typedef struct _ioDef | ioDef |
Holds port, pad and mode for a given cortex digital IO pin. More... | |
Enumerations | |
enum | tVexDigitalPin { kVexDigital_None = -1, kVexDigital_1 = 0, kVexDigital_2, kVexDigital_3, kVexDigital_4, kVexDigital_5, kVexDigital_6, kVexDigital_7, kVexDigital_8, kVexDigital_9, kVexDigital_10, kVexDigital_11, kVexDigital_12, kVexDigital_Num } |
Digital pin indexes. More... | |
enum | tVexDigitalMode { kVexDigitalInput = 0, kVexDigitalOutput = 1 } |
Digital pin types. More... | |
enum | tVexDigitalState { kVexDigitalLow = 0, kVexDigitalHigh } |
Digital pin states. More... | |
Functions | |
void | vexDigitalModeSet (tVexDigitalPin pin, tVexDigitalMode mode) |
Set digital port mode. More... | |
tVexDigitalMode | vexDigitalModeGet (tVexDigitalPin pin) |
Set digital port mode. More... | |
void | vexDigitalPinSet (tVexDigitalPin pin, tVexDigitalState state) |
Set digital pin state. More... | |
tVexDigitalState | vexDigitalPinGet (tVexDigitalPin pin) |
Get digital pin state. More... | |
void | vexDigitalIntrSet (tVexDigitalPin pin) |
Set digital pin to cause interrupt. More... | |
void | vexDigitalIntrRun (void) |
Enable any digital pin interrupts. More... | |
int32_t | vexDigitalIntrCountGet (tVexDigitalPin pin) |
Get the interrupt count for a given digital pin. More... | |
void | vexExtIrqInit (void) |
Initialise external interrupts. More... | |
void | vexExtSet (ioportid_t port, uint16_t channel, uint32_t mode, extcallback_t cb) |
Configure GPIO pin to be external interrupt source. More... | |
Variables | |
ioDef | vexioDefinition [kVexDigital_Num] |
definition of a digital IO pin More... | |
Header for the digital port driver.
#define VEX_DIGIO_1_PAD GPIOE_DIGIO_1 |
#define VEX_DIGIO_2_PAD GPIOE_DIGIO_2 |
#define VEX_DIGIO_3_PAD GPIOC_DIGIO_3 |
#define VEX_DIGIO_4_PAD GPIOC_DIGIO_4 |
#define VEX_DIGIO_5_PAD GPIOE_DIGIO_5 |
#define VEX_DIGIO_6_PAD GPIOE_DIGIO_6 |
#define VEX_DIGIO_7_PAD GPIOE_DIGIO_7 |
#define VEX_DIGIO_8_PAD GPIOE_DIGIO_8 |
#define VEX_DIGIO_9_PAD GPIOE_DIGIO_9 |
#define VEX_DIGIO_10_PAD GPIOE_DIGIO_10 |
#define VEX_DIGIO_11_PAD GPIOD_DIGIO_11 |
#define VEX_DIGIO_12_PAD GPIOD_DIGIO_12 |
#define VEX_DIGIO_1_PORT PORT_DIGIO_1 |
#define VEX_DIGIO_2_PORT PORT_DIGIO_2 |
#define VEX_DIGIO_3_PORT PORT_DIGIO_3 |
#define VEX_DIGIO_4_PORT PORT_DIGIO_4 |
#define VEX_DIGIO_5_PORT PORT_DIGIO_5 |
#define VEX_DIGIO_6_PORT PORT_DIGIO_6 |
#define VEX_DIGIO_7_PORT PORT_DIGIO_7 |
#define VEX_DIGIO_8_PORT PORT_DIGIO_8 |
#define VEX_DIGIO_9_PORT PORT_DIGIO_9 |
#define VEX_DIGIO_10_PORT PORT_DIGIO_10 |
#define VEX_DIGIO_11_PORT PORT_DIGIO_11 |
#define VEX_DIGIO_12_PORT PORT_DIGIO_12 |
#define VexDigInput_1 | ( | ) | palReadPad( VEX_DIGIO_1_PORT, VEX_DIGIO_1_PAD ) |
#define VexDigInput_2 | ( | ) | palReadPad( VEX_DIGIO_2_PORT, VEX_DIGIO_2_PAD ) |
#define VexDigInput_3 | ( | ) | palReadPad( VEX_DIGIO_3_PORT, VEX_DIGIO_3_PAD ) |
#define VexDigInput_4 | ( | ) | palReadPad( VEX_DIGIO_4_PORT, VEX_DIGIO_4_PAD ) |
#define VexDigInput_5 | ( | ) | palReadPad( VEX_DIGIO_5_PORT, VEX_DIGIO_5_PAD ) |
#define VexDigInput_6 | ( | ) | palReadPad( VEX_DIGIO_6_PORT, VEX_DIGIO_6_PAD ) |
#define VexDigInput_7 | ( | ) | palReadPad( VEX_DIGIO_7_PORT, VEX_DIGIO_7_PAD ) |
#define VexDigInput_8 | ( | ) | palReadPad( VEX_DIGIO_8_PORT, VEX_DIGIO_8_PAD ) |
#define VexDigInput_9 | ( | ) | palReadPad( VEX_DIGIO_9_PORT, VEX_DIGIO_9_PAD ) |
#define VexDigInput_10 | ( | ) | palReadPad( VEX_DIGIO_10_PORT, VEX_DIGIO_10_PAD ) |
#define VexDigInput_11 | ( | ) | palReadPad( VEX_DIGIO_11_PORT, VEX_DIGIO_11_PAD ) |
#define VexDigInput_12 | ( | ) | palReadPad( VEX_DIGIO_12_PORT, VEX_DIGIO_12_PAD ) |
#define VexPinOutput_1 | ( | x) |
#define VexPinOutput_2 | ( | x) |
#define VexPinOutput_3 | ( | x) |
#define VexPinOutput_4 | ( | x) |
#define VexPinOutput_5 | ( | x) |
#define VexPinOutput_6 | ( | x) |
#define VexPinOutput_7 | ( | x) |
#define VexPinOutput_8 | ( | x) |
#define VexPinOutput_9 | ( | x) |
#define VexPinOutput_10 | ( | x) |
#define VexPinOutput_11 | ( | x) |
#define VexPinOutput_12 | ( | x) |
enum tVexDigitalPin |
enum tVexDigitalMode |
enum tVexDigitalState |
void vexDigitalModeSet | ( | tVexDigitalPin | pin, |
tVexDigitalMode | mode | ||
) |
Set digital port mode.
[in] | pin | The pin to set the new mode on |
[in] | mode | kVexDigitalInput or kVexDigitalOutput |
Change the type of a digital IO port All ports are initially initialized to be INPUTs unless the board.h file is changed (not recommended)
tVexDigitalMode vexDigitalModeGet | ( | tVexDigitalPin | pin) |
Set digital port mode.
[in] | pin | The pin to get the mode for |
void vexDigitalPinSet | ( | tVexDigitalPin | pin, |
tVexDigitalState | state | ||
) |
Set digital pin state.
[in] | pin | The pin to set the new state on |
[in] | state | kVexDigitalLow or kVexDigitalHigh |
Set a digital pin to a value, high or low. If the pin is an input then this enables the pullup or pulldown resistor.
tVexDigitalState vexDigitalPinGet | ( | tVexDigitalPin | pin) |
Get digital pin state.
[in] | pin | The pin to get the state of |
Read the value of a digital pin, if the pin is a digital output then the output value is returned.
void vexDigitalIntrSet | ( | tVexDigitalPin | pin) |
Set digital pin to cause interrupt.
[in] | pin | The pin |
This is used for testing at present, the interrupt just increments a counter
void vexDigitalIntrRun | ( | void | ) |
Enable any digital pin interrupts.
int32_t vexDigitalIntrCountGet | ( | tVexDigitalPin | pin) |
Get the interrupt count for a given digital pin.
[in] | pin | The pin |
This is used for testing at present, the interrupt just increments a counter
void vexExtIrqInit | ( | void | ) |
Initialise external interrupts.
void vexExtSet | ( | ioportid_t | port, |
uint16_t | channel, | ||
uint32_t | mode, | ||
extcallback_t | cb | ||
) |
Configure GPIO pin to be external interrupt source.
[in] | port | The digital port to configure |
[in] | channel | The ext irq channel to configure |
[in] | mode | The ext irq mode |
[in] | cb | A callback to be called when the irq fires |
ioDef vexioDefinition[kVexDigital_Num] |
definition of a digital IO pin
This data structure is used to correlate a digital port(pin) number on the cortex with the port/pad pair on the STM32.