Created
April 11, 2026 23:00
-
-
Save philipturner/f1f3ae394151420af1bf390d42eed6dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "IC/ADC.h" | |
| #include "IC/CDC.h" | |
| #include "IC/DAC.h" | |
| #include "Metrology/Metrology.h" | |
| #include "Time/KilohertzLoop.h" | |
| #include "Time/TimeStatistics.h" | |
| #include "Util/Application.h" | |
| #include "Util/Bitset.h" | |
| Metrology::Mode currentMode; | |
| Metrology metrology; | |
| void setup() { | |
| Application::setupSerial(); | |
| Application::setupSPI(); | |
| Application::setupI2C(); | |
| currentMode = Metrology::Mode::basicMeasurement; | |
| Metrology::Descriptor descriptor; | |
| descriptor.mode = currentMode; | |
| metrology = Metrology(descriptor); | |
| } | |
| void programBody() { | |
| #if 0 | |
| Metrology::ProgramDescriptor programDesc; | |
| programDesc.logSingleSamples = true; | |
| programDesc.verboseDriftCancellation = true; | |
| programDesc.bipolarVoltage = 100; | |
| programDesc.creepTime = 0.0; | |
| metrology.metrologyProgram(programDesc); | |
| #else | |
| metrology.hysteresisPlot(); | |
| #endif | |
| } | |
| void loop() { | |
| if (Serial.available() > 0) { | |
| char incomingByte = Serial.read(); | |
| if (incomingByte == 'm') { | |
| if (currentMode != Metrology::Mode::metrology) { | |
| currentMode = Metrology::Mode::metrology; | |
| Metrology::Descriptor descriptor; | |
| descriptor.mode = currentMode; | |
| metrology = Metrology(descriptor); | |
| programBody(); | |
| } | |
| } | |
| } | |
| metrology.loop(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment