options to access the Pocuter user ports (Port0 - Port5)
More...
#include <PocuterPorts.h>
|
| enum | PORT_NUMBER {
PORT_0,
PORT_1,
PORT_2,
PORT_3,
PORT_4,
PORT_5
} |
| |
| enum | PORT_DIRECTION { PORT_DIRECTION_IN,
PORT_DIRECTION_OUT
} |
| |
| enum | PORT_PULLUP { PORT_PULLUP_OFF,
PORT_PULLUP_ON
} |
| |
| enum | PORT_MODE { PORT_MODE_BINARY,
PORT_MODE_ADC
} |
| |
| enum | PORTSERROR { PORTSERROR_OK,
PORTSERROR_NOT_SUPPORTED,
PORTSERROR_NOT_INITIALIZED,
PORTSERROR_UNKNOWN
} |
| |
| typedef void() | portEventHandler(PORT_NUMBER n, bool portValue, void *) |
| |
options to access the Pocuter user ports (Port0 - Port5)
◆ portEventHandler
| typedef void() PocuterPorts::portEventHandler(PORT_NUMBER n, bool portValue, void *) |
type definition of the event callback function
◆ PORT_DIRECTION
| Enumerator |
|---|
| PORT_DIRECTION_IN | |
| PORT_DIRECTION_OUT | |
◆ PORT_MODE
| Enumerator |
|---|
| PORT_MODE_BINARY | |
| PORT_MODE_ADC | |
◆ PORT_NUMBER
| Enumerator |
|---|
| PORT_0 | |
| PORT_1 | |
| PORT_2 | |
| PORT_3 | |
| PORT_4 | |
| PORT_5 | |
◆ PORT_PULLUP
| Enumerator |
|---|
| PORT_PULLUP_OFF | |
| PORT_PULLUP_ON | |
◆ PORTSERROR
| Enumerator |
|---|
| PORTSERROR_OK | |
| PORTSERROR_NOT_SUPPORTED | |
| PORTSERROR_NOT_INITIALIZED | |
| PORTSERROR_UNKNOWN | |
◆ deinitPort()
deinit an exposed port
- Note
- this also cancels the event registration
- Parameters
-
- Returns
- PORTSERROR_OK everything works well
- PORTSERROR_NOT_INITIALIZED the port wasn't initialized
◆ getValue() [1/2]
get a value from a binary port
- Parameters
-
| n | PORT_0 to PORT_5 |
| value | a pointer to a memory where the value should be saved |
- Returns
- PORTSERROR_OK everything works well
- PORTSERROR_NOT_INITIALIZED the port wasn't initialized
◆ getValue() [2/2]
get a value from an ADC port
- Parameters
-
| n | PORT_0 to PORT_5 |
| value | a pointer to a memory where the value should be saved |
- Returns
- PORTSERROR_OK everything works well
- PORTSERROR_NOT_INITIALIZED the port wasn't initialized
◆ initPort()
init an exposed port
- Note
- not all ports have the same possibilities Port 0: BIN or ADC, IN/OUT BIN, PULLUP Port 1: BIN, IN/OUT Port 2: BIN, IN/OUT Port 3: BIN, IN/OUT Port 4: BIN, IN/OUT Port 5: BIN or ADC, IN/OUT BIN, PULLUP
in ADC mode you cannot register an event handler
- Parameters
-
| n | PORT_0 to PORT_5 |
| d | IN or OUT direction |
| m | binary or ADC mode |
| p | internal pullup on/off |
- Returns
- PORTSERROR_OK everything works well
- PORTSERROR_NOT_SUPPORTED this combination of options is not possible
◆ pauseInterruptHandler()
| virtual PORTSERROR PocuterPorts::pauseInterruptHandler |
( |
| ) |
|
|
pure virtual |
◆ registerEventHandler()
register an event callback
- Note
- this is olny available for binary ports
-
the event handler is called every time the value of a binary port changed.
- Parameters
-
| n | the port number |
| h | a pointer to the callback function |
| u | a pointer to user data sent to the event handler on each event |
◆ resumeInterruptHandler()
| virtual PORTSERROR PocuterPorts::resumeInterruptHandler |
( |
| ) |
|
|
pure virtual |
◆ setValue()
set a binary port
- Parameters
-
| n | PORT_0 to PORT_5 |
| value | set or unset the port |
- Returns
- PORTSERROR_OK everything works well
- PORTSERROR_NOT_INITIALIZED the port wasn't initialized
The documentation for this class was generated from the following file: