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: dis_exp.h
- Revision:
- 0:4e3ad938564e
- Child:
- 2:d9745be6c253
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dis_exp.h Tue Jun 28 21:32:51 2022 +0000 @@ -0,0 +1,43 @@ +#pragma once + +#include "stepper.h" +#include "capsense.h" +#include <vector> +#include <tuple> + +class DiscreteExperiment { + public: + DiscreteExperiment(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(); + std::vector<std::tuple<int32_t, long>>& 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, long>> data; + State state; + + int32_t move_counter; + int32_t measu_counter; + int32_t steps_taken; + +}; \ No newline at end of file