Skip to content

Commit 904de6f

Browse files
jeremy-synPeter-ChangTimotheeeNivenJeremy Holleman
authored
Merging SWW into master (#176)
* updated demo notebook * added note about the demo notebook to readme * experimental code to save dataset from run to run * merged work from runner_dev_jeremy * compute_lfbe_f32 computes lfbe features in f32 for 1024 block length; short tests show matching to TF float * added code to measure execution time * removed DWT timing code (just using TIM16 now) and added timing measurement to run_model * updating some auto-generated files for the model * merged tims work on the runner * removed comment in auto-gen usart.c code * header file for timing left out of earlier commit * fixed interface gitignore to ignore settings files -- allow local changes * cleaning up * added help string, fixed bug where empty command (just %) prints NULL, so dumps memory to terminal * changed a couple of routines to return ai_error instead of meaningless int (0) * added sww_ref_l4r5zi; currently pretty similar to sww_testing * changed I2S buffers to int16_t * added readme to describe working of test project * streaming processing in progress * added linker scripts, somehow left out of earlier commits * fixed some issues in streaming feature extraction (mostly pointer arithmetic and scaling errors * sww_ref detects ww in streaming setup and pulses GPIO PB8, also changed stop command so we can do multiple I2S transactions w/o reboot * PowerBoard LPM * PowerBoard LPM * Needed to add timer and I2C so auto-gen code is correct. Adding GPIO interrupt to capture ww detections * Needed to add timer and I2C so auto-gen code is correct. Adding GPIO interrupt to capture ww detections * Needed to add timer and I2C so auto-gen code is correct. Adding GPIO interrupt to capture ww detections * removed wav capture code from streaming processing function * changed uart1 baud rate to 115200 * added interrupt EXTI15 on pin G15 * added interrupt EXTI15 on pin G15 * added interrupt EXTI15 on pin G15 * Log File Implmentations, DO NOT RUN POWERBOARD * Log File Implmentations, DO NOT RUN POWERBOARD * Log File Implmentations, DO NOT RUN POWERBOARD * interface now captures negative pulses on WW_DET_IN (G15) and can print out a list of timestamps. But timer rolls over at 64k * changed from timer 16 to timer 2 because it has 32 bits; also filtered out repeat detections within 10ms * removed some debug code and renamed pin PIN_WW_DETECTED => WW_DETECTED * removed some debug code and renamed pin PIN_WW_DETECTED => WW_DETECTED * interface -- reset timer 2 to 0 when beginning to record detections * AutoDetect Powerboard WIP * Powerboard WIP with Logging * changed voltage from 3V to 3.3V * Update README.md * Update README.md * Update README.md * Add files via upload Updated Images * Rename LPM01A.jpg to LPM01A_old.jpg * Rename LPM01A.JPG to LPM01A.jpg * Updated Images * Rename LPM01A.jpg to LPM01A._toast.jpg * Add files via upload * Delete benchmark/runner/img/LPM01A_old.jpg * Delete benchmark/runner/img/LPM01A._toast.jpg * making sww ref implementation follow common protocol * updating runner to run streaming wakeword * Update README.md * changes to runner for streaming ww in progress (not fully working here) * added variable timeout to send_command to accomodate long commands (like play wav-file) * fixed a couple mis-spellings in doc strings * changed EE_DEVICE_NAME to 'dut' to work with runner, though it should be able to handle other names * commented out unneeded db print; should remove later as long as it doesn't cause problems * in main, fixed case where all_negatives or all_positives == 0; also added model to dut_config; and added call to separate summarize function for sww * fixed order and added delay into stream step of script; and added return detected_timestamps * streaming ww benchmark runs in the runner, but does not yet compile false pos/neg ratios * cleaned up a couple of errors that had gotten into demo notebook * modified build_long_wav.py to take arguments and added a 10s easy test wav for validating setup * made build_long_wav deliver 2-chan (stereo) wav files for compatibility with I2S * updated build_long_wav to include sample rate and length in _ww_windows.json * AD AUC and Accuracy Update * Speed/No more Mode Update * No more mode * Powerboard WIP * updated ref sw to use detection threshold set by #define DETECT_THRESHOLD and to issue one detection at beginning of streaming (for synchronization) * modified play_wave to take optional timeout variable. still need to set this in a config file to match the file length * added a pause and a variable timeout in wav play in script step * added code to calculate detection statistics (false pos, etc.) * removed long_wav_ww_windows.json because its info is moved into sww_data_dir/sww_long_test.json * making PowerManager.board_timestamps_ms a list, to hold all timestamps in a test. Also printed out a caught exception and put the most recent timestamp into the data_queue along with other info * added is_energy_mode condition to some of the results handling * changed inference counting to count each cycle as 1 (instead of each element in the returned vector as 1) * Powerboard WIP 2.0 * Accuracy/Performance Updates * Accuracy/Performance Updates 2.0 * Interface/DUT Co-Working * fixed demo notebook to work with different directory structure * fixed processing of current measurement strings from lpm01a and fixed result handling in if mode == Energy block * fixed issue where multiple 'stop' commands were hanging the power manager shutdown sequence; lots of debug messages still there * now using 'events' from LPM01a based on D7 edges to measure timing. processing that info still WIP * Old Mode Interface * ReadMe Update * Delete benchmark/runner/img/L4R5ZI.png * Delete benchmark/runner/img/LPM01A.jpg * Old Pictures * Add files via upload * Rename L4R5ZI.png to L4R5ZI_old.png * Rename L4R5ZI_old.png to L4R5ZI.png * Rename L4R5ZI.png to L4R5ZI_1.png * Rename LPM01A.jpg to LPM01A_1.jpg * Update README.md * energy measurement working now. still some debug messages to remove * fixed issue with energy mode * some minor changes to make sww work with recent changes to results processing * added line to strip 2nd channel out of long_wav if it is a stereo wav * put log files in separate directory to avoid clogging main dir * fixed clocking on SAI to fix sampling rate error -- clock div ratio was rounded 15.6=>15 so sampling freq was 16.8kHz instead of 16kHz * fixed discrepancies wrt ref model (input scale factor and when to clip log mel energies) * removed sww_testing_l4r5zi. all of its functionality is in sww_ref_l4r5zi * added pin definitions to pulse D7 for timestamp and D6 for active processing (duty cycle) measurement * SWW ref toggles D7 at init, and beginning and end of streaming * sww power mode is mostly running now, but requires a 1sec delay after the wav stops playing before stopping power measurement * fixed feature extractor to continue pre-emphasis filter across segment boundaries * added 'echo' value in devices.yaml for enhanced interface board. * reduced sleep time from 1s to 0.25s; still need to find root cause * updated images in readme * minor edits * added contents for SD_card and sww_data_dir * fixed to respect configurable DUT voltages. Also removed dut.yaml and to put all dut config in devices.yaml * updated demo notebook because the wav file has moved to .../runner/sd_card * updated documentation and figures * added start time to wav playing * removed extra prints in strww utils * add 2 minute test * added notes on running streaming test * updated demo notebook to use the json test files * Baud Changer Done * Baud Changer Done * Baud Changer 1.2 * Baud Changer 1.3 * Baud Changer 1.3 * Baud Changer 1.4 * Baud Changer 1.5 * Baud Changer 1.6 * New YAML files * changed detection threshold 120=>115 to align with demo notebook * fixed pre-emphasis so correct value is carried over from one frame to the next * added a test command infer_wav [offset] that will run feature extraction and inference on a waveform stored in fixed_data.c as an array * added 30s timeout for infer * changed from_logits in add_qat() to False to be consistent w/ the initial float training and the model. softmax is needed during inference for consistent threshold * removed two preferences files that should not be in repo * removed sync_baud; moving to io_manager_enhanced * added echo option to constructor * perf_result is an output; should not be under git control * added io.__enter__() before sync_baud to fix crashing * added entry_count to SerialDevice enter()/exit() in case of multiple calls to __enter__() * updated evaluate.py to deal with the json streaming test spec * changed evaluate.py so it will choose TFLite intepreter or standard model code based on filename * added stream_wav_uart.py * added multiple retries on error. switched to logger for some output * added retry option to send_cmd function. * added db load, setptr, getptr; and extract_features_on_chunk * changed tests_accuracy to use all test files * added --specgram flag to evaluate to let you evaluate model on precomputed spectrogram features * added --specgram flag to evaluate to let you evaluate model on precomputed spectrogram features * proposed edits to rules * changed DUT baud rate back to 115200 for SWW * stashing some WIP in the temp branch while I go back and test an older commit * updated reference h5 and tflite models; normalized model file names * changed default epochs and l2 values * added some LR scheduling to QAT phase * fixed FP detection logic * changed long wav file * changed long wav file * added pulsing of 'active' pin to run_model * updated model; set model optimization to 'time' * modified DUT class to take echo argument * added echo to DUT definition * fixed printf format error * reverting devices.yaml; changed DUT baud rates were mistakenly commited * WIP on adding duty cycle measurement. Added structure, but handler is not currently called * duty cycle measurement (recording start and stop times on a 10us clock) working * added echo mode for power manager and most of the support for duty cycle measurement * added timeout kw arg to io_manager.send_command * fixed an image filename typo and added a couple notes on I2S debug * fixed logic so in performance or energy mode, anomaly detection only infers on one segment * added message to the end of the run to indicate the logfile name * fixed case of no loop count specified (e.g.'loop:' instead of 'loop 5:') so it uses full labels file. * selectively allocating g_wav_record and g_act_buff, since there is not enough RAM for both * restructured memory allocation for wav capture and activation capture to use a single pre-allocated general-purpose buffer * updated sww reference and runner to optionally capture activation value * updated wav capture function * updated connection diagrams to show 'processing' pin -- used for duty cycle calculation * was making a few edits, but now code does not work * added check in case no DUT or interface is present * a few local/temp edits were accidentally incorporated into the last commit; reverting those * removed unneeded debug message * interface board will report error if wav file does not successfully play * fixed recording of DUT voltage. * added line end to print_tee * added duty cycle print out to results.txt file and some comments elsewhere * fixed some code that relied on DUT name being l4r5zi * removed unused dut_config argument and parse_dut_config function * removed unused dut_voltage and dut_baud arguments. both are folded into devices.yaml file * updated readme on runner * Joulescope Power Update 1.0 * JS220 Partially Working * JS220 Trigger 1.0 * updated notes in readme * add try-except for undecodeable (corrupted) characters in serial_device._read_loop * added condition to skip past empty lines in infer response. otherwise None's cause an error * added print out of some debug info if power manager does not respond * fixed error in call to get_baud_rate * fixed error in call to print_energy_results * in error handling in run, cast exception to string so regex would work * auc and accuracy were backwards. fixed * JS220 Implimentation * JS220 Implimentation * Cleanup * JS vs LPM * minor additions to runner readme * removed some results files * Adding JouleScope JS220 support. Requires libusb and pyusb now. * fixed (again) bad get_baud_rate call that sneaked back in * changed echo for LPM to False (should only be True for debugging) * changed stopbits to 1 on DUT lpuart1 in sww ref (connects DUT to interface or host) * added logic to convert a single result (ie no loop in script) to a list of result dicts * fixed energy mode output; enforced 10s minimum * added binary for interface board * added notes on installing firmware * added benchmark-specific devices files * added note about DYLD_LIBRARY_PATH to resolve conflicting libusb versions on M1 macs * median energy info was not going to results file (only terminal). Fixed * made required number of cycles 1 for SWW, 5 for others * improved some informational print outs * added minor error handling to activation parsing * updated tests scripts for energy and performance * fixed AUC calculation (replaced with sklearn) * fixed AUC calculation (replaced with sklearn) * undoing two changes accidentally brought in by merging main->streaming_ww_dev: chane to interface/usart.c and sww_testing_l4r5zi came back in * added disambiguation using check_name property when VID/PID are repeated * added multi_class='ovr' to roc_auc_score to avoid errors in multiclass cases (all except ad) --------- Co-authored-by: Peter Chang <2179424+Peter-Chang@users.noreply.github.com> Co-authored-by: TimotheeeNiven <rniven1@uncc.edu> Co-authored-by: TimotheeeNiven <99817017+TimotheeeNiven@users.noreply.github.com> Co-authored-by: Jeremy Holleman <jeremy@mlcommons.org>
1 parent 8e48030 commit 904de6f

1,427 files changed

Lines changed: 476587 additions & 71409 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

benchmark/MLPerfTiny_Rules.adoc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ The suite includes the following benchmarks:
177177
| Visual Wake Words | Binary image classification | Visual Wake Words Dataset | MobileNet | 80% (Top 1)
178178
| Image Classification | Small image classification | Cifar10 | ResNet | 85% (Top 1)
179179
| Anomaly Detection | Detecting anomalies in machine operating sounds | ToyADMOS | Deep AutoEncoder | 0.85 (AUC)
180+
| Streaming Wakeword | Detecting wakewords in a continuous stream of audio| Custom | 1D DS-CNN | TBD
180181
|===
181182

182183
==== Relaxed constraints for the Open division
@@ -189,10 +190,13 @@ The suite includes the following benchmarks:
189190

190191
== Benchmark Runner
191192

193+
194+
192195
=== EnergyRunner™ benchmark framework
193-
The benchmark suite is run using the EnergyRunner™ benchmark framework, which detects the DUT, sends inputs, and reads outputs over UART.
196+
The benchmark suite is run using the EnergyRunner™ benchmark framework from EEMBC, which detects the DUT, sends inputs, and reads outputs over UART. The EEMBC runner is being phased out. It will be permitted for teh KWS, VWW, IC, and AD benchmarks in the summer 2015 submission. After that, only the MLCommons Runner will be permitted. The EEMBC runner does not support the streaming wakeword benchmark.
194197

195-
The runner is available here: https://github.com/eembc/energyrunner
198+
The EEMBC runner is available here: https://github.com/eembc/energyrunner
199+
The MLCommons runner is available in this repository: https://github.com/mlcommons/tiny/tree/master/benchmark/runner
196200

197201
Note: The same code must be run for both the accuracy and performance Runner modes.
198202

@@ -332,7 +336,8 @@ The following techniques are disallowed:
332336

333337
* Discarding non-zero weight elements, including pruning
334338

335-
* Caching queries or responses
339+
* Caching queries or responses between files. However, in the streaming test, it is
340+
permitted to store intermediate activations between frames of the same waveform.
336341

337342
* Coalescing identical queries
338343

benchmark/interface/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
cmake-build-*/
33
/STM32CubeIDE/Debug/
44
/STM32CubeIDE/Release/
5+
STM32CubeIDE/.settings/
6+
.metadata/

benchmark/interface/.mxproject

Lines changed: 76 additions & 72 deletions
Large diffs are not rendered by default.

benchmark/interface/.project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>interface</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
</buildSpec>
9+
<natures>
10+
</natures>
11+
</projectDescription>

benchmark/interface/Application/CLI/InterfaceMenu.cpp

Lines changed: 199 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#include "InterfaceMenu.hpp"
22
#include "../IDataSource.hpp"
3+
#include "../Audio/WaveSink.hpp"
34
#include "../ResourceManager.hpp"
5+
#include "usart.h"
6+
#include "baud_config.h"
7+
8+
49

510
void CLI_Init(TX_BYTE_POOL *byte_pool, UART_HandleTypeDef *huart)
611
{
@@ -14,6 +19,29 @@ void CLI_Run()
1419
CLI::InterfaceMenu::GetSingleton().Run();
1520
}
1621

22+
void Record_WW_Detection()
23+
{
24+
CLI::InterfaceMenu::GetSingleton().RecordOneDetection();
25+
}
26+
27+
void Record_Dutycycle_Start()
28+
{
29+
if( CLI::InterfaceMenu::InstanceInitialized() )
30+
{
31+
// only call this if the CLI instance is initialized
32+
CLI::InterfaceMenu::GetSingleton().DutycycleStart();
33+
}
34+
}
35+
void Record_Dutycycle_Stop()
36+
{
37+
if( CLI::InterfaceMenu::InstanceInitialized() )
38+
{
39+
// only call this if the CLI instance is initialized
40+
CLI::InterfaceMenu::GetSingleton().DutycycleStop();
41+
}
42+
}
43+
44+
1745
namespace CLI
1846
{
1947
InterfaceMenu *InterfaceMenu::instance = (InterfaceMenu *)TX_NULL;
@@ -26,8 +54,22 @@ namespace CLI
2654
{"name", NameWrapper},
2755
{"ls", ListWrapper},
2856
{"play", PlayWrapper},
57+
{"setbaud", SetBaudWrapper},
58+
{"checkbaud", CheckBaudWrapper},
59+
{"record_detections", RecDetsWrapper},
60+
{"print_detections", PrintDetsWrapper},
61+
{"print_dutycycle", PrintDutycycleWrapper},
2962
{"", DefaultWrapper} };
3063

64+
bool InterfaceMenu::InstanceInitialized()
65+
{
66+
if( instance )
67+
return true;
68+
else
69+
return false;
70+
}
71+
72+
3173
/**
3274
* Wrap the singleton function in a static function
3375
*/
@@ -51,6 +93,43 @@ namespace CLI
5193
{
5294
instance->Play(args);
5395
}
96+
/**
97+
* Wrap the singleton function in a static function
98+
*/
99+
void InterfaceMenu::SetBaudWrapper(const std::string &args)
100+
{
101+
instance->SetBaud(args);
102+
}
103+
/**
104+
* Wrap the singleton function in a static function
105+
*/
106+
void InterfaceMenu::CheckBaudWrapper(const std::string &args)
107+
{
108+
instance->CheckBaud(args);
109+
}
110+
/**
111+
* Wrap the singleton function in a static function
112+
*/
113+
void InterfaceMenu::RecDetsWrapper(const std::string &args)
114+
{
115+
instance->RecordDetections(args);
116+
}
117+
118+
/**
119+
* Wrap the singleton function in a static function
120+
*/
121+
void InterfaceMenu::PrintDetsWrapper(const std::string &args)
122+
{
123+
instance->PrintDetections(args);
124+
}
125+
126+
/**
127+
* Wrap the singleton function in a static function
128+
*/
129+
void InterfaceMenu::PrintDutycycleWrapper(const std::string &args)
130+
{
131+
instance->PrintDutycycle(args);
132+
}
54133

55134
/**
56135
* Wrap the singleton function in a static function
@@ -155,14 +234,132 @@ namespace CLI
155234
*/
156235
void InterfaceMenu::Play(const std::string &args)
157236
{
237+
Audio::PlayerResult result;
158238
IDataSource *source = file_system.OpenFile(args);
159239
Audio::WaveSource wav(*source);
160-
std::string *msg = new std::string("Playing ");
240+
// if( !wav.valid_wave ) {
241+
// std::string *msg = new std::string("Error. Not a valid wav file: ");
242+
// msg->append(source->GetName());
243+
// msg->append("\n");
244+
// SendString(msg->c_str());
245+
// }
246+
std::string *msg = new std::string("Attempting to play ");
161247
msg->append(source->GetName());
162248
msg->append("\n");
163249
SendString(msg->c_str());
164-
player.Play(wav);
250+
result = player.Play(wav);
251+
if( result == Audio::ERROR ) {
252+
SendString("Error playing file. Check that the file exists and is a 2-channel wav file.\n");
253+
}
254+
else {
255+
SendString("succeeded.\n");
256+
}
257+
165258
SendEnd();
166259
delete source;
167260
}
261+
262+
/**
263+
* Set the new baud rate for the board
264+
*/
265+
void InterfaceMenu::SetBaud(const std::string &args)
266+
{
267+
int baud = std::stoi(args);
268+
SaveBaudRateToFlash(baud); // Save permanently to Flash
269+
270+
SendString("set baud to: " + args + "\n");
271+
272+
SendEnd();
273+
NVIC_SystemReset(); //Reset the MCU
274+
}
275+
276+
277+
/**
278+
* Check the current baud rate
279+
*/
280+
void InterfaceMenu::CheckBaud(const std::string &args)
281+
{
282+
int currentBaud = huart3.Init.BaudRate;
283+
284+
SendString("baud is: " + std::to_string(currentBaud) + "\n");
285+
286+
SendEnd(); // End response
287+
}
288+
289+
290+
291+
292+
void InterfaceMenu::RecordDetections(const std::string &args)
293+
{
294+
// Sets the interface board into mode to capture detections,
295+
// but the detections are recorded in an interrupt handler,
296+
// so we can return here and proceed to playing the wav file
297+
298+
__HAL_TIM_SET_COUNTER(&htim2, 0);
299+
SendString("Now recording detections");
300+
SendEndLine();
301+
dut.StartRecordingDetections();
302+
SendEnd();
303+
}
304+
305+
void InterfaceMenu::PrintDetections(const std::string &args)
306+
{
307+
uint32_t *timestamps = dut.GetDetections();
308+
uint32_t num_timestamps = dut.GetNumDetections();
309+
310+
SendString("Detection Timestamps (ms)");
311+
SendEndLine();
312+
for(uint32_t i=0; i<num_timestamps; i++)
313+
{
314+
SendString(std::to_string(timestamps[i]) + ",");
315+
SendEndLine();
316+
}
317+
SendEnd();
318+
}
319+
320+
void InterfaceMenu::PrintDutycycle(const std::string &args)
321+
{
322+
uint32_t *rising_edges = dut.GetDutycycleRisingEdges();
323+
uint32_t num_rising_edges = dut.GetNumDutycycleRisingEdges();
324+
uint32_t *falling_edges = dut.GetDutycycleFallingEdges();
325+
uint32_t num_falling_edges = dut.GetNumDutycycleFallingEdges();
326+
327+
SendString("Duty cycle start times (s)");
328+
SendEndLine();
329+
for(uint32_t i=0; i<num_rising_edges; i++)
330+
{
331+
SendString(std::to_string(rising_edges[i]) + ", ");
332+
if( (i+1) % 8 == 0){
333+
SendEndLine();
334+
}
335+
}
336+
SendEndLine();
337+
SendString("Duty cycle stop times (s)");
338+
SendEndLine();
339+
for(uint32_t i=0; i<num_falling_edges; i++)
340+
{
341+
SendString(std::to_string(falling_edges[i]) + ", ");
342+
if( (i+1) % 8 == 0){
343+
SendEndLine();
344+
}
345+
}
346+
SendEnd();
347+
}
348+
349+
350+
void InterfaceMenu::RecordOneDetection()
351+
{
352+
dut.RecordDetection();
353+
}
354+
355+
void InterfaceMenu::DutycycleStart()
356+
{
357+
dut.RecordDutycycleStart();
358+
}
359+
360+
void InterfaceMenu::DutycycleStop()
361+
{
362+
dut.RecordDutycycleStop();
363+
}
364+
168365
}

benchmark/interface/Application/CLI/InterfaceMenu.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ void CLI_Init(TX_BYTE_POOL *byte_pool, UART_HandleTypeDef *huart);
1919
*/
2020
void CLI_Run();
2121

22+
void Record_WW_Detection();
23+
void Record_Dutycycle_Stop();
24+
void Record_Dutycycle_Start();
25+
2226
#ifdef __cplusplus
2327
}
2428
#endif

benchmark/interface/Application/CLI/InterfaceMenu.hpp

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,28 @@ namespace CLI
1919
* @return the menu instance
2020
*/
2121
static InterfaceMenu &GetSingleton();
22+
void RecordOneDetection();
23+
void DutycycleStart();
24+
void DutycycleStop();
25+
26+
27+
// Wrapper function declarations
28+
static void ListWrapper(const std::string &args);
29+
static void NameWrapper(const std::string &args);
30+
static void PassthroughWrapper(const std::string &args);
31+
static void PlayWrapper(const std::string &args);
32+
static void SetBaudWrapper(const std::string &args);
33+
static void CheckBaudWrapper(const std::string &args);
34+
static void RecDetsWrapper(const std::string &args);
35+
static void PrintDetsWrapper(const std::string &args);
36+
static void PrintDutycycleWrapper(const std::string &args);
37+
static void DefaultWrapper(const std::string &args);
38+
static bool InstanceInitialized();
39+
40+
// Declarations for SetBaud and CheckBaud
41+
void SetBaud(const std::string &args);
42+
void CheckBaud(const std::string &args);
43+
2244
private:
2345
/**
2446
* Allow CLI_Init access to private constructor to create the singleton.
@@ -28,20 +50,22 @@ namespace CLI
2850
static TX_MUTEX singleton_mutex;
2951
static InterfaceMenu *instance;
3052
static void InitSingleton(TX_BYTE_POOL &byte_pool, IO::Uart *uart, IO::FileSystem &file_system, Audio::WaveSink &player, Test::DeviceUnderTest &dut);
31-
static void ListWrapper(const std::string &args);
32-
static void NameWrapper(const std::string &args);
33-
static void PassthroughWrapper(const std::string &args);
34-
static void PlayWrapper(const std::string &args);
35-
static void DefaultWrapper(const std::string &args);
53+
3654
InterfaceMenu(TX_BYTE_POOL &byte_pool, IO::Uart &uart, IO::FileSystem &file_system, Audio::WaveSink &player, Test::DeviceUnderTest &dut);
3755
void List(const std::string &args);
3856
void Name(const std::string &args);
3957
void Passthrough(const std::string &args);
4058
void Play(const std::string &args);
59+
void RecordDetections(const std::string &args);
60+
void PrintDetections(const std::string &args);
61+
void PrintDutycycle(const std::string &args);
62+
4163
IO::FileSystem &file_system;
4264
Audio::WaveSink &player;
4365
Test::DeviceUnderTest &dut;
4466
};
4567
}
4668

47-
#endif //CLI_INTERFACEMENU_HPP
69+
void Record_WW_Detection();
70+
71+
#endif // CLI_INTERFACEMENU_HPP

benchmark/interface/Application/CLI/Menu.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "Menu.hpp"
22
#include "usart.h"
3+
#include "tim.h" // jhdbg only needed for debug
34

45
#define RESPONSE_QUEUE_SIZE 20 * sizeof(ULONG)
56

@@ -20,6 +21,17 @@ namespace CLI
2021
const std::string *buffer = uart.ReadUntil("%");
2122
HandleCommand(*buffer);
2223
delete buffer;
24+
25+
// HAL_GPIO_WritePin(WW_DET_IN_GPIO_Port, WW_DET_IN_Pin, GPIO_PIN_SET);
26+
// int delay_start = __HAL_TIM_GET_COUNTER(&htim2);
27+
// while(__HAL_TIM_GET_COUNTER(&htim2) < delay_start + 100 ){
28+
// ;
29+
// }
30+
// HAL_GPIO_WritePin(WW_DET_IN_GPIO_Port, WW_DET_IN_Pin, GPIO_PIN_RESET);
31+
32+
// int pin_val = HAL_GPIO_ReadPin(WW_DET_IN_GPIO_Port, WW_DET_IN_Pin);
33+
// std::string message = "pin is " + std::to_string(pin_val);
34+
// uart.SendString(message);
2335
}
2436
}
2537

benchmark/interface/Application/ResourceManager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ ResourceManager::ResourceManager(TX_BYTE_POOL &byte_pool): task_runner(new Tasks
6363
dut(new Test::DeviceUnderTest(*task_runner, new IO::Uart(byte_pool, &huart3)))
6464
{
6565
}
66+
67+

0 commit comments

Comments
 (0)