libPocuter 1.0 Support library for programming the Pocuter

Classes | Public Types | Public Member Functions | List of all members
PocuterAccelerometer Class Referenceabstract

options to access the Pocuter accelerometer More...

`#include <PocuterAccelerometer.h>`

## Classes
struct | State

## Public Types
enum | ACCERROR { ACCERROR_OK = 0, ACCERROR_OFFLINE, ACCERROR_COMMUNICATION_FAILED, ACCERROR_UNKNOWN }
enum | ACCSCALE { G2 = 0, G4 = 1, G8 = 2 }
enum | ACCEVENT { ACC_ORIENTATION, ACC_SHAKE }
typedef void() | accEventHandler(ACCEVENT, void *)

## Public Member Functions
virtual ACCERROR | registerEventHandler (accEventHandler *e, void *u)=0
| register an event callback More...
virtual void | unregisterEventHandler ()=0
| unregister the event handler More...
virtual ACCERROR | isOnline ()=0
| checks if the accelerometer is online More...
virtual ACCERROR | getState (State *state)=0
| get the current position of the accelerometer in space. More...
virtual ACCERROR | setScale (ACCSCALE)=0
| set the accelerometer scale. More...
virtual ACCERROR | getTemperature (int8_t *)=0
| get the current sensor temperature More...
virtual ACCERROR | pauseInterruptHandler ()=0
| pause the eventhandler More...
virtual ACCERROR | resumeInterruptHandler ()=0
| resume the eventhandler More...

## Detailed Description

options to access the Pocuter accelerometer

## Member Typedef Documentation

## ◆ accEventHandler

typedef void() PocuterAccelerometer::accEventHandler(ACCEVENT, void *)

type definition of the event callback function

## Member Enumeration Documentation

## ◆ ACCERROR

enum PocuterAccelerometer::ACCERROR

Enumerator
ACCERROR_OK | everything went well
ACCERROR_OFFLINE | no accelerometer found
ACCERROR_COMMUNICATION_FAILED | communication problems with the accelerometer
ACCERROR_UNKNOWN | unknown error

## ◆ ACCEVENT

enum PocuterAccelerometer::ACCEVENT

Enumerator
ACC_ORIENTATION | Accelerometer event, orientation has changed
ACC_SHAKE | Accelerometer event, the pocuter was shaked

## ◆ ACCSCALE

enum PocuterAccelerometer::ACCSCALE

Enumerator
G2 | Accelerometer scale factor 0
G4 | Accelerometer scale factor 1
G8 | Accelerometer scale factor 2

## Member Function Documentation

## ◆ getState()

virtual ACCERROR PocuterAccelerometer::getState | ( | State * | state | ) |
| pure virtual

get the current position of the accelerometer in space.

Parameters

  state | the state struct

Returns
  ACCERROR_OK everything works well ACCERROR_OFFLINE no accelerometer found ACCERROR_COMMUNICATION_FAILED an communication error the the accelerometer occurred

## ◆ getTemperature()

virtual ACCERROR PocuterAccelerometer::getTemperature | ( | int8_t * |  | ) |
| pure virtual

get the current sensor temperature

Returns
  ACCERROR_OK everything works well ACCERROR_OFFLINE no accelerometer found ACCERROR_COMMUNICATION_FAILED an communication error the the accelerometer occurred

## ◆ isOnline()

virtual ACCERROR PocuterAccelerometer::isOnline | ( |  | ) |
| pure virtual

checks if the accelerometer is online

Returns
  true / false

## ◆ pauseInterruptHandler()

virtual ACCERROR PocuterAccelerometer::pauseInterruptHandler | ( |  | ) |
| pure virtual

pause the eventhandler

## ◆ registerEventHandler()

virtual ACCERROR PocuterAccelerometer::registerEventHandler | ( | accEventHandler * | e,
|  | void * | u
| ) |  |
| pure virtual

register an event callback

Note
  the event handler is called every time an ACCEVENT occurred.

Parameters

  e | a pointer to the callback function
  u | a pointer to user data sent to the event handler on each event

Returns
  - ACCERROR_OK everything works well
  - ACCERROR_OFFLINE can not add an event handler now

## ◆ resumeInterruptHandler()

virtual ACCERROR PocuterAccelerometer::resumeInterruptHandler | ( |  | ) |
| pure virtual

resume the eventhandler

## ◆ setScale()

virtual ACCERROR PocuterAccelerometer::setScale | ( | ACCSCALE |  | ) |
| pure virtual

set the accelerometer scale.

Returns
  ACCERROR_OK everything works well ACCERROR_OFFLINE no accelerometer found ACCERROR_COMMUNICATION_FAILED an communication error the the accelerometer occurred

## ◆ unregisterEventHandler()

virtual void PocuterAccelerometer::unregisterEventHandler | ( |  | ) |
| pure virtual

unregister the event handler

The documentation for this class was generated from the following file:

- include/hal/PocuterAccelerometer.h