I2C hang recover function added
Dependencies: UniGraphic mbed vt100
edge_accel Class Reference
edge_accel edge_sensor which manage the accelerometer sensor (MMA8451Q) More...
#include <edge_accel.h>
Inherits edge_sensor.
Public Member Functions | |
edge_accel (MMA8451Q *accel) | |
constructor | |
~edge_accel (void) | |
destructor | |
virtual void | reset (void) |
clear and reset interval values | |
virtual int | sample (void) |
sample calculate the average value from _accumulation and _sample_count the average value is assigned to _value and currnt _sample_count is stored in _num_sampled then both _accumuation and _sample_count will be cleared | |
virtual int | deliver (void) |
deliver the value to the afero cloud | |
virtual void | show (void) |
show the data in the display (TFT) | |
int | accum (void) |
accum this is the real sampling and the differences of sampled values and previous values are calcurated and accumulated | |
void | clear_value (void) |
Clear internal values. | |
virtual void | setId (uint16_t id) |
assign _id manually | |
virtual void | enable (void) |
enable the edge_sensor | |
virtual void | disable (void) |
disable the edge_sensor | |
virtual bool | isEnabled (void) |
test if the edge_sensor is enabled (or not) | |
virtual void | prepare (void) |
prepare the sensor for sampling | |
virtual void | toJson (char *buf) |
toJson convert sampled data to json format | |
virtual void | displayTime (int32_t ts) |
display timestamp in human readable format ts int32_t timestamp value to display | |
void | setInterval (uint16_t interval) |
setInterval assign sampling interval time (in sec) | |
uint16_t | getInterval (void) |
getInterval get sampling interval time (in sec) | |
int | getStatus (void) |
getStatus get current status of the state machine | |
int | advanceStatus (void) |
advanceStatus proceed status into the next state | |
virtual int | runStateMachine (void) |
runStateMachine run the statemachine for single cycle |
Detailed Description
edge_accel edge_sensor which manage the accelerometer sensor (MMA8451Q)
- Note:
- The behavior of this class is somewhat exceptional as an edge_sensor
- it samples and accumulates data which is the abs sum of current
- values and previous values every 0.1 sec
- and in each "interval" it delivers the averaged value
Definition at line 15 of file edge_accel.h.
Constructor & Destructor Documentation
edge_accel | ( | MMA8451Q * | accel ) |
~edge_accel | ( | void | ) |
destructor
Definition at line 20 of file edge_accel.cpp.
Member Function Documentation
int accum | ( | void | ) |
accum this is the real sampling and the differences of sampled values and previous values are calcurated and accumulated
- Returns:
- 0: success non-0: failure
Definition at line 126 of file edge_accel.cpp.
int advanceStatus | ( | void | ) | [inherited] |
advanceStatus proceed status into the next state
- Returns:
- advanced status
void clear_value | ( | void | ) |
Clear internal values.
Definition at line 153 of file edge_accel.cpp.
int deliver | ( | void | ) | [virtual] |
deliver the value to the afero cloud
Reimplemented from edge_sensor.
Definition at line 56 of file edge_accel.cpp.
void disable | ( | void | ) | [virtual, inherited] |
disable the edge_sensor
Definition at line 36 of file edge_sensor.cpp.
void displayTime | ( | int32_t | ts ) | [virtual, inherited] |
display timestamp in human readable format ts int32_t timestamp value to display
Definition at line 70 of file edge_sensor.cpp.
void enable | ( | void | ) | [virtual, inherited] |
enable the edge_sensor
Definition at line 31 of file edge_sensor.cpp.
uint16_t getInterval | ( | void | ) | [inherited] |
getInterval get sampling interval time (in sec)
- Returns:
- the interval time in uint16_t
Definition at line 103 of file edge_sensor.cpp.
int getStatus | ( | void | ) | [inherited] |
getStatus get current status of the state machine
- Returns:
- current status as int
Definition at line 108 of file edge_sensor.cpp.
bool isEnabled | ( | void | ) | [virtual, inherited] |
test if the edge_sensor is enabled (or not)
- Returns:
- true: the sensor is enabled false: the sensor is disabled
Definition at line 41 of file edge_sensor.cpp.
void prepare | ( | void | ) | [virtual, inherited] |
prepare the sensor for sampling
Reimplemented in edge_color, edge_pressure, and edge_temp.
Definition at line 46 of file edge_sensor.cpp.
void reset | ( | void | ) | [virtual] |
clear and reset interval values
Reimplemented from edge_sensor.
Definition at line 25 of file edge_accel.cpp.
int runStateMachine | ( | void | ) | [virtual, inherited] |
runStateMachine run the statemachine for single cycle
- Returns:
- the result status
Definition at line 122 of file edge_sensor.cpp.
int sample | ( | void | ) | [virtual] |
sample calculate the average value from _accumulation and _sample_count the average value is assigned to _value and currnt _sample_count is stored in _num_sampled then both _accumuation and _sample_count will be cleared
- Returns:
- 0: success non-0: failure
Reimplemented from edge_sensor.
Definition at line 38 of file edge_accel.cpp.
virtual void setId | ( | uint16_t | id ) | [virtual, inherited] |
assign _id manually
Definition at line 32 of file edge_sensor.h.
void setInterval | ( | uint16_t | interval ) | [inherited] |
setInterval assign sampling interval time (in sec)
- Parameters:
-
interval uint16_t the value to assign
Definition at line 98 of file edge_sensor.cpp.
void show | ( | void | ) | [virtual] |
show the data in the display (TFT)
Reimplemented from edge_sensor.
Definition at line 86 of file edge_accel.cpp.
void toJson | ( | char * | buf ) | [virtual, inherited] |
toJson convert sampled data to json format
- Parameters:
-
buf char* string buf to store the json string
Definition at line 93 of file edge_sensor.cpp.
Generated on Sat Jul 16 2022 08:26:44 by 1.7.2