Bluenet
5.7.0
Bluenet, firmware for nRF52 smart home devices
|
Class that keeps up the buffers used for ADC. More...
#include <cs_AdcBuffer.h>
Public Member Functions | |
cs_ret_code_t | init () |
Allocate the buffers. More... | |
adc_buffer_t * | getBuffer (adc_buffer_id_t buffer_id) |
Get buffer with given id. More... | |
adc_sample_value_t | getValue (adc_buffer_id_t buffer_id, adc_channel_id_t channel_id, adc_sample_value_id_t value_id) |
Get a particular value from a buffer. More... | |
void | setValue (adc_buffer_id_t buffer_id, adc_channel_id_t channel_id, adc_sample_value_id_t value_id, adc_sample_value_t value) |
For in-place filtering it is necessary to write a particular value into the buffer. More... | |
Static Public Member Functions | |
static AdcBuffer & | getInstance () |
Singleton implementation. More... | |
static constexpr adc_sample_value_id_t | getBufferLength () |
Get total number of samples in a buffer. More... | |
static constexpr adc_sample_value_id_t | getChannelLength () |
Get number of samples for each channel in a buffer. More... | |
static constexpr adc_channel_id_t | getChannelCount () |
Get number of channels per buffer. More... | |
static constexpr adc_buffer_id_t | getBufferCount () |
Get number of buffers. More... | |
Private Member Functions | |
AdcBuffer () | |
AdcBuffer (AdcBuffer const &) | |
Private Attributes | |
adc_buffer_t * | _buf [ADC_BUFFER_COUNT] = {nullptr} |
bool | _allocated = false |
Class that keeps up the buffers used for ADC.
|
inlineprivate |
|
inlineprivate |
|
inline |
Get buffer with given id.
|
inlinestaticconstexpr |
Get number of buffers.
|
inlinestaticconstexpr |
Get total number of samples in a buffer.
|
inlinestaticconstexpr |
Get number of channels per buffer.
|
inlinestaticconstexpr |
Get number of samples for each channel in a buffer.
|
inlinestatic |
Singleton implementation.
There is no foreseen need to have multiple objects instantiated. Note that this singleton implementation does not have dynamic memory allocation.
|
inline |
Get a particular value from a buffer.
The value_id is a reference to the index of a value within a channel (half of the buffer length).
[in] | buffer_id | Index to the buffer (0 up to getBufferCount() - 1) |
[in] | channel_id | Particular channel within this buffer (0 or 1) |
[in] | value_id | Index to the value in the buffer (0 up to getChannelLength() - 1) |
|
inline |
Allocate the buffers.
|
inline |
For in-place filtering it is necessary to write a particular value into the buffer.
[in] | buffer_id | Index to the buffer (0 up to getBufferCount() - 1) |
[in] | channel_id | Particular channel within this buffer (0 or 1) |
[in] | value_id | Index to the value in the buffer |
[in] | value | Value to be written to the buffer |
|
private |
|
private |