Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: con_exp.h
- Revision:
- 2:d9745be6c253
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/con_exp.h Thu Aug 04 15:14:29 2022 -0400 @@ -0,0 +1,47 @@ +#pragma once + +#include "stepper.h" +#include "capsense.h" +#include <cstdint> +#include <vector> +#include <tuple> + +class ContinuousExperiment { + public: + ContinuousExperiment(StepperMotor& motor, CapSense& capsense, + int32_t n_measure, uint32_t t_measure_us, + int32_t delta_steps, int32_t max_steps); + void proceed(); + bool is_done(); + /** + * Returns a vector of tuples of (steps, tau in microseconds) + */ + std::vector<std::tuple<int32_t, uint32_t>>& report(); /*steps instead of dis */ + void start(); + void reset(); + + private: + enum State { + IDLE, + MOVING, + MEASURING, + DONE + }; + + private: + StepperMotor& motor; + CapSense& capsense; + + int32_t n_measure; + uint32_t t_measure_us; + int32_t delta_steps; + int32_t max_steps; + + std::vector<std::tuple<int32_t, uint32_t>> data; + State state; + + int32_t move_counter; + int32_t measu_counter; + int32_t steps_taken; + +}; \ No newline at end of file