Firmware SDK
|
Library for computations on stream of data. More...
Data Structures | |
struct | twr_data_stream_buffer_t |
Buffer for data stream. More... | |
Macros | |
#define | TWR_DATA_STREAM_FLOAT_BUFFER(NAME, NUMBER_OF_SAMPLES) |
Macro for float data stream buffer declaration. More... | |
#define | TWR_DATA_STREAM_INT_BUFFER(NAME, NUMBER_OF_SAMPLES) |
Macro for int data stream buffer declaration. More... | |
#define | TWR_DATA_STREAM_FLOAT_ARRAY(NAME, COUNT, NUMBER_OF_SAMPLES) |
Macro for float data stream array declaration. More... | |
#define | TWR_DATA_STREAM_FLOAT_ARRAY_INIT(NAME, COUNT, MIN_NUMBER_OF_SAMPLES) |
Macro for float data stream array initialization. More... | |
Typedefs | |
typedef struct twr_data_stream_t | twr_data_stream_t |
Data stream instance. | |
Enumerations | |
enum | twr_data_stream_type_t { TWR_DATA_STREAM_TYPE_FLOAT = 0 , TWR_DATA_STREAM_TYPE_INT = 1 } |
Data stream type. | |
Functions | |
void | twr_data_stream_init (twr_data_stream_t *self, int min_number_of_samples, twr_data_stream_buffer_t *buffer) |
Initialize data stream instance. More... | |
void | twr_data_stream_feed (twr_data_stream_t *self, void *data) |
Feed data into stream instance. More... | |
void | twr_data_stream_reset (twr_data_stream_t *self) |
Reset data stream. More... | |
int | twr_data_stream_get_counter (twr_data_stream_t *self) |
Get counter. | |
int | twr_data_stream_get_length (twr_data_stream_t *self) |
Get length. | |
twr_data_stream_type_t | twr_data_stream_get_type (twr_data_stream_t *self) |
Get type. | |
int | twr_data_stream_get_number_of_samples (twr_data_stream_t *self) |
Get buffer number_of_samples. | |
bool | twr_data_stream_get_average (twr_data_stream_t *self, void *result) |
Get average value of data stream. More... | |
bool | twr_data_stream_get_median (twr_data_stream_t *self, void *result) |
Get median value of data stream. More... | |
bool | twr_data_stream_get_first (twr_data_stream_t *self, void *result) |
Get first value in data stream. More... | |
bool | twr_data_stream_get_last (twr_data_stream_t *self, void *result) |
Get last value in data stream. More... | |
bool | twr_data_stream_get_nth (twr_data_stream_t *self, int n, void *result) |
Get nth value in data stream. More... | |
bool | twr_data_stream_get_max (twr_data_stream_t *self, void *result) |
Get max value. More... | |
bool | twr_data_stream_get_min (twr_data_stream_t *self, void *result) |
Get min value. More... | |
Library for computations on stream of data.
#define TWR_DATA_STREAM_FLOAT_ARRAY | ( | NAME, | |
COUNT, | |||
NUMBER_OF_SAMPLES | |||
) |
Macro for float data stream array declaration.
Definition at line 36 of file twr_data_stream.h.
#define TWR_DATA_STREAM_FLOAT_ARRAY_INIT | ( | NAME, | |
COUNT, | |||
MIN_NUMBER_OF_SAMPLES | |||
) |
Macro for float data stream array initialization.
Definition at line 44 of file twr_data_stream.h.
#define TWR_DATA_STREAM_FLOAT_BUFFER | ( | NAME, | |
NUMBER_OF_SAMPLES | |||
) |
Macro for float data stream buffer declaration.
Definition at line 12 of file twr_data_stream.h.
#define TWR_DATA_STREAM_INT_BUFFER | ( | NAME, | |
NUMBER_OF_SAMPLES | |||
) |
Macro for int data stream buffer declaration.
Definition at line 24 of file twr_data_stream.h.
void twr_data_stream_feed | ( | twr_data_stream_t * | self, |
void * | data | ||
) |
Feed data into stream instance.
[in] | self | Instance |
[in] | data | Input data to be fed into data stream |
Definition at line 15 of file twr_data_stream.c.
bool twr_data_stream_get_average | ( | twr_data_stream_t * | self, |
void * | result | ||
) |
Get average value of data stream.
[in] | self | Instance |
[out] | self | Pointer to buffer where result will be stored |
Definition at line 84 of file twr_data_stream.c.
bool twr_data_stream_get_first | ( | twr_data_stream_t * | self, |
void * | result | ||
) |
Get first value in data stream.
[in] | self | Instance |
[out] | self | Pointer to buffer where result will be stored |
Definition at line 185 of file twr_data_stream.c.
bool twr_data_stream_get_last | ( | twr_data_stream_t * | self, |
void * | result | ||
) |
Get last value in data stream.
[in] | self | Instance |
[out] | self | Pointer to buffer where result will be stored |
Definition at line 220 of file twr_data_stream.c.
bool twr_data_stream_get_max | ( | twr_data_stream_t * | self, |
void * | result | ||
) |
Get max value.
[in] | self | Instance |
[out] | self | Pointer to buffer where result will be stored |
Definition at line 304 of file twr_data_stream.c.
bool twr_data_stream_get_median | ( | twr_data_stream_t * | self, |
void * | result | ||
) |
Get median value of data stream.
[in] | self | Instance |
[out] | self | Pointer to buffer where result will be stored |
Definition at line 131 of file twr_data_stream.c.
bool twr_data_stream_get_min | ( | twr_data_stream_t * | self, |
void * | result | ||
) |
Get min value.
[in] | self | Instance |
[out] | self | Pointer to buffer where result will be stored |
Definition at line 360 of file twr_data_stream.c.
bool twr_data_stream_get_nth | ( | twr_data_stream_t * | self, |
int | n, | ||
void * | result | ||
) |
Get nth value in data stream.
[in] | self | Instance |
[in] | n | position (example: 0 is first, -1 is last) |
[out] | self | Pointer to buffer where result will be stored |
Definition at line 248 of file twr_data_stream.c.
void twr_data_stream_init | ( | twr_data_stream_t * | self, |
int | min_number_of_samples, | ||
twr_data_stream_buffer_t * | buffer | ||
) |
Initialize data stream instance.
[in] | self | Instance |
[in] | int | min_number_of_samples minimal number of samples for calculation avarage, median ... |
[in] | buffer | Buffer holding data stream content |
[in] | buffer_size | Size of buffer holding data stream content |
Definition at line 6 of file twr_data_stream.c.
void twr_data_stream_reset | ( | twr_data_stream_t * | self | ) |
Reset data stream.
[in] | self | Instance |
Definition at line 58 of file twr_data_stream.c.
Referenced by twr_data_stream_feed().