display adc measure with provided app
This commit is contained in:
		| @@ -6,6 +6,9 @@ | ||||
| extern "C" TIM_HandleTypeDef htim1;         // Defined in main.c | ||||
| extern "C" ADC_HandleTypeDef hadc3;         // Defined in main.c | ||||
|  | ||||
| extern "C" uint16_t adcValuesBuffer[ADC_VALUES_BUFFER_SIZE]; | ||||
| extern "C" int ADCBufferIndex; | ||||
|  | ||||
| oscilloscope::Controller Factory::_oscilloscopeController; | ||||
| oscilloscope::Gui Factory::_gui; | ||||
| external::FrequencyGenerator Factory::_fgen; | ||||
| @@ -34,8 +37,7 @@ void Factory::initialize() | ||||
|     Trace::out("---------------------------------------------"); | ||||
|     Trace::out("Initializing..."); | ||||
|  | ||||
|     // TODO: Uncomment code line below in order to call OscilloscopeController's initialize() method | ||||
| //	getOscilloscopeController().initialize(getGui(), adcValuesBuffer, ADC_VALUES_BUFFER_SIZE); | ||||
| 	getOscilloscopeController().initialize(getGui(), adcValuesBuffer, ADC_VALUES_BUFFER_SIZE); | ||||
|     getFrequencyGenerator().initialize(); | ||||
|     getFreqGenController().initialize(getGui()); | ||||
| #if (TOUCHGFX_BAREMETAL != 0) | ||||
|   | ||||
| @@ -18,6 +18,8 @@ | ||||
| #include "board/buttonscontroller.h" | ||||
| using external::FrequencyGenerator; | ||||
|  | ||||
| #define ADC_VALUES_BUFFER_SIZE 8000 | ||||
|  | ||||
| /** | ||||
|  * @brief Factory creating all objects/components and relations between them. | ||||
|  */ | ||||
|   | ||||
| @@ -108,9 +108,20 @@ void Controller::onCheckBoxTriggerCheckState(bool checked) | ||||
|     GEN(evCheckBoxTrigger(checked, CHECK_BOX_TRIGGER_ID)); | ||||
| } | ||||
|  | ||||
| void Controller::doShowAnalogSignal() | ||||
| { | ||||
| 	// TODO: Call gui().drawGraphPoints() with the appropriate data. | ||||
| void Controller::doShowAnalogSignal() { | ||||
|  | ||||
| 	/* | ||||
| 	 * 460px for 8 div | ||||
| 	 * fs = 100kHz => 100 samples/ms | ||||
| 	 * 500	us/div =>  400 samples => scale =  400/460 =  0,870 | ||||
| 	 * 1	ms/div =>  800 samples => scale =  800/460 =  1,739 | ||||
| 	 * 2	ms/div => 1600 samples => scale = 1600/460 =  3,478 | ||||
| 	 * 5	ms/div => 4000 samples => scale = 4000/460 =  8,696 | ||||
| 	 * 10	ms/div => 8000 samples => scale = 8000/460 = 17,391 | ||||
| 	 */ | ||||
| 	static float scales[7] = {0.87,0.87,1.739,3.478,8.696,17.391,17.391}; | ||||
| 	float scale = scales[this->_tdivValue]; | ||||
| 	gui().drawGraphPoints(_adcValuesBuffer, _adcValuesBufferSize, scale); | ||||
| } | ||||
|  | ||||
| void Controller::doButtonTimePlusPressed() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user