mirror of
				https://github.com/portapack-mayhem/mayhem-firmware.git
				synced 2025-10-30 22:50:28 +00:00 
			
		
		
		
	Start/stop control of baseband capture.
This commit is contained in:
		| @@ -28,7 +28,13 @@ | ||||
| namespace ui { | ||||
|  | ||||
| CaptureAppView::CaptureAppView(NavigationView&) { | ||||
| 	capture_thread = std::make_unique<AudioThread>("baseband.c16"); | ||||
| 	add_children({ { | ||||
| 		&button_start, | ||||
| 		&button_stop, | ||||
| 	} }); | ||||
|  | ||||
| 	button_start.on_select = [this](Button&){ this->on_start(); }; | ||||
| 	button_stop.on_select = [this](Button&){ this->on_stop(); }; | ||||
|  | ||||
| 	radio::enable({ | ||||
| 		tuning_frequency(), | ||||
| @@ -51,6 +57,20 @@ CaptureAppView::~CaptureAppView() { | ||||
| 	radio::disable(); | ||||
| } | ||||
|  | ||||
| void CaptureAppView::focus() { | ||||
| 	button_start.focus(); | ||||
| } | ||||
|  | ||||
| void CaptureAppView::on_start() { | ||||
| 	if( !capture_thread ) { | ||||
| 		capture_thread = std::make_unique<AudioThread>("baseband.c16"); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CaptureAppView::on_stop() { | ||||
| 	capture_thread.reset(); | ||||
| } | ||||
|  | ||||
| uint32_t CaptureAppView::target_frequency() const { | ||||
| 	return initial_target_frequency; | ||||
| } | ||||
|   | ||||
| @@ -37,6 +37,8 @@ public: | ||||
| 	CaptureAppView(NavigationView& nav); | ||||
| 	~CaptureAppView(); | ||||
|  | ||||
| 	void focus() override; | ||||
|  | ||||
| 	std::string title() const override { return "Capture"; }; | ||||
|  | ||||
| private: | ||||
| @@ -48,6 +50,19 @@ private: | ||||
|  | ||||
| 	uint32_t target_frequency() const; | ||||
| 	uint32_t tuning_frequency() const; | ||||
|  | ||||
| 	void on_start(); | ||||
| 	void on_stop(); | ||||
|  | ||||
| 	Button button_start { | ||||
| 		{ 16, 17 * 16, 96, 24 }, | ||||
| 		"Start" | ||||
| 	}; | ||||
|  | ||||
| 	Button button_stop { | ||||
| 		{ 240 - 96 - 16, 17 * 16, 96, 24 }, | ||||
| 		"Stop" | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| } /* namespace ui */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jared Boone
					Jared Boone