Computation
Data Acquisition (DAQ)
Data acquisition can switch between on-demand (“one-shot”) and continuous streaming into a ring buffer. See the following example or the test case test/hardware/components/daq/test_flexio_daq_num_of_samples/test.cpp how to use it in practice.
// Initialize daq once
daq::init();
// On-demand sampling
auto data = daq::sample();
auto data_averaged = daq::average(100, 10);
// Scoped continuous stream
{
Run run(...);
RunDataHandler data_handler(...);
auto stream = daq::stream::get(run, &data_handler);
while (1) {
// ... do things ...
// Process continuous data in chunks
stream.process();
}
// Process any remaining data
stream.process(true);
}
// On-demand sampling
data = daq::sample();
-
namespace daq
Routines for data acquisition (DAQ) using the internal analog-to-digital converters (ADC).
Data acquisition can switch between on-demand (“one-shot”) and continuous streaming into a ring buffer. For on-demand sampling, use the sample_raw(), sample() or average() function. For continuous streaming, you should use stream::get() to enable a scoped continuous acquisition and periodically call the stream::Scope::process function to handle incoming data. The continuous acquisition of samples currently only happens while the OP signal is active. Stopping a continuous acquisition thus mostly refers to cleaning up state and side-effects in software and is automatically done when the stream::Scope object is destructed. Alternatively, you can use the stream::start(), stream::process() and stream::stop() functions manually. You cannot use on-demand sampling while a continuous acquisition is active.
See
test/hardware/components/daq/test_flexio_daq_num_of_samples/test.cpp
for how to use it in practice.Warning
You need to call daq::init() once before you can do any sampling.
-
namespace stream
-
namespace stream
Mode Managament
-
namespace mode
Variables
-
uint8_t PIN_MODE_IC = 40
-
uint8_t PIN_MODE_OP = 41
-
uint8_t PIN_MODE_OVERLOAD = 20
-
uint8_t PIN_MODE_EXTHALT = 21
-
uint8_t PIN_SYNC_CLK = 22
-
uint8_t PIN_SYNC_ID = 23
-
uint8_t PIN_QTMR_OP_GATE = 12
-
class FlexIOControl
- #include <mode.h>
Public Static Functions
-
static bool init(unsigned long long ic_time_ns, unsigned long long op_time_ns, mode::OnOverload on_overload = mode::OnOverload::HALT, mode::OnExtHalt on_ext_halt = mode::OnExtHalt::IGNORE, mode::Sync sync = mode::Sync::NONE)
-
static inline bool is_initialized()
-
static void disable()
-
static void enable()
-
static inline bool is_enabled()
-
static void reset()
-
static void _init_qtmr_op()
-
static void _reset_qtmr_op()
-
static unsigned long long get_actual_op_time()
-
static void force_start()
-
static void to_idle()
-
static void to_ic()
-
static void to_op()
-
static void to_exthalt()
-
static void to_end()
-
static bool is_idle()
-
static bool is_op()
-
static bool is_done()
-
static bool is_overloaded()
-
static bool is_exthalt()
-
static void delay_till_done()
-
static bool init(unsigned long long ic_time_ns, unsigned long long op_time_ns, mode::OnOverload on_overload = mode::OnOverload::HALT, mode::OnExtHalt on_ext_halt = mode::OnExtHalt::IGNORE, mode::Sync sync = mode::Sync::NONE)
-
uint8_t PIN_MODE_IC = 40
Run Managament
-
namespace run
Functions
- FLASHMEM void run_traditional (run::Run &run, RunStateChangeHandler *state_change_handler, RunDataHandler *run_data_handler, client::StreamingRunDataNotificationHandler *alt_run_data_handler)
- FLASHMEM void run_flexio (Run &run, RunStateChangeHandler *state_change_handler, RunDataHandler *run_data_handler)