libPocuter 1.0 Support library for programming the Pocuter

Public Types | Public Member Functions | List of all members
PocuterPorts Class Referenceabstract

options to access the Pocuter user ports (Port0 - Port5) More...

`#include <PocuterPorts.h>`

## Public Types
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 *)

## Public Member Functions
virtual PORTSERROR | initPort (PORT_NUMBER n, PORT_DIRECTION d, PORT_MODE m, PORT_PULLUP p)=0
| init an exposed port More...
virtual PORTSERROR | deinitPort (PORT_NUMBER n)=0
| deinit an exposed port More...
virtual PORTSERROR | getValue (PORT_NUMBER n, uint16_t *value)
| get a value from an ADC port More...
virtual PORTSERROR | getValue (PORT_NUMBER n, bool *value)
| get a value from a binary port More...
virtual PORTSERROR | setValue (PORT_NUMBER n, bool value)
| set a binary port More...
virtual PORTSERROR | registerEventHandler (PORT_NUMBER n, portEventHandler *h, void *u)=0
| register an event callback More...
virtual PORTSERROR | pauseInterruptHandler ()=0
| pause the eventhandler More...
virtual PORTSERROR | resumeInterruptHandler ()=0
| resume the eventhandler More...

## Detailed Description

options to access the Pocuter user ports (Port0 - Port5)

## Member Typedef Documentation

## ◆ portEventHandler

typedef void() PocuterPorts::portEventHandler(PORT_NUMBER n, bool portValue, void *)

type definition of the event callback function

## Member Enumeration Documentation

## ◆ PORT_DIRECTION

enum PocuterPorts::PORT_DIRECTION

Enumerator
PORT_DIRECTION_IN |
PORT_DIRECTION_OUT |

## ◆ PORT_MODE

enum PocuterPorts::PORT_MODE

Enumerator
PORT_MODE_BINARY |
PORT_MODE_ADC |

## ◆ PORT_NUMBER

enum PocuterPorts::PORT_NUMBER

Enumerator
PORT_0 |
PORT_1 |
PORT_2 |
PORT_3 |
PORT_4 |
PORT_5 |

## ◆ PORT_PULLUP

enum PocuterPorts::PORT_PULLUP

Enumerator
PORT_PULLUP_OFF |
PORT_PULLUP_ON |

## ◆ PORTSERROR

enum PocuterPorts::PORTSERROR

Enumerator
PORTSERROR_OK |
PORTSERROR_NOT_SUPPORTED |
PORTSERROR_NOT_INITIALIZED |
PORTSERROR_UNKNOWN |

## Member Function Documentation

## ◆ deinitPort()

virtual PORTSERROR PocuterPorts::deinitPort | ( | PORT_NUMBER | n | ) |
| pure virtual

deinit an exposed port

Note
  this also cancels the event registration

Parameters

  n | PORT_0 to PORT_5

Returns
  - PORTSERROR_OK everything works well
  - PORTSERROR_NOT_INITIALIZED the port wasn't initialized

## ◆ getValue() [1/2]

virtual PORTSERROR PocuterPorts::getValue | ( | PORT_NUMBER | n,
|  | bool * | value
| ) |  |
| virtual

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]

virtual PORTSERROR PocuterPorts::getValue | ( | PORT_NUMBER | n,
|  | uint16_t * | value
| ) |  |
| virtual

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()

virtual PORTSERROR PocuterPorts::initPort | ( | PORT_NUMBER | n,
|  | PORT_DIRECTION | d,
|  | PORT_MODE | m,
|  | PORT_PULLUP | p
| ) |  |
| pure virtual

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

pause the eventhandler

## ◆ registerEventHandler()

virtual PORTSERROR PocuterPorts::registerEventHandler | ( | PORT_NUMBER | n,
|  | portEventHandler * | h,
|  | void * | u
| ) |  |
| pure virtual

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

resume the eventhandler

## ◆ setValue()

virtual PORTSERROR PocuterPorts::setValue | ( | PORT_NUMBER | n,
|  | bool | value
| ) |  |
| virtual

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:

- include/hal/PocuterPorts.h