Presentation is loading. Please wait.

Presentation is loading. Please wait.

The System Services way of doing Lab. 2 Task 8. What was Lab. 2 zActivate EBIU, Flash memory, Flash LED, GPIO flags zConnect light sensor to PF11 zEach.

Similar presentations


Presentation on theme: "The System Services way of doing Lab. 2 Task 8. What was Lab. 2 zActivate EBIU, Flash memory, Flash LED, GPIO flags zConnect light sensor to PF11 zEach."— Presentation transcript:

1 The System Services way of doing Lab. 2 Task 8

2 What was Lab. 2 zActivate EBIU, Flash memory, Flash LED, GPIO flags zConnect light sensor to PF11 zEach time an interrupt occurs on PF11, record the CYCLES counter. zEvery second time an interrupt occurs, calculate the frequency of the light sensor voltage, and calculate light level zDisplay the light level on the LED lights 6/3/20162 / 28

3 6/3/20163 / 28

4 6/3/20164 / 28 All true, the third time you try using it However, that’s what you do in an industrial environment

5 6/3/20165 / 28 All the non-hardware stuff from Lab. 1, 2 and 3 stays the same VDK All the hardware stuff from Lab. 1, 2 and 3 – “better?”

6 6/3/20166 / 28 Shopping list ?????

7 Something related to Lab. 2 6/3/20167 / 28

8 6/3/20168 / 28

9 Sounds like Lab. 2 6/3/20169 / 28

10 6/3/201610 / 28

11 Where to start? zMake sure we understand the following zLab. 1 – Setting up the EBIU zLab. 1 – Activating the LED zLab. 1 – Activating the GPIO switches zLab. 2 – software interrupts on GPIO zLab. 2 – hardware interrupts on GPIO zLab. 2 – ISR for measuring light sensor output zAssignment 3 – Activating CYCLES 6/3/201611 / 28

12 Next step – look for an example 6/3/201612 / 28 This VDSP directory looks promising for GPIO and LED control

13 File LEDButtonCallback.c 6/3/201613 / 28 This is a.c file What happens if want to use an.cpp and asm compatible to C++? WAIL

14 Callback function 6/3/201614 / 28 This is NOT an ISR – this is a function called from the ISR activated on PF interrupts What is a “client handle”? What’s a “u32Event”? What’s a “void *pArg”? Why is function “static”? The rest we can guess

15 We can guess functionality 6/3/201615 / 28 Whats “ezErrorCheck( )? Same as Lab. 1 InitGPIOFlags( ) but 1 button at a time

16 We can guess functionality 6/3/201616 / 28 Guess – interrupts on PF8 and PF9 Guess – ADI_FLAG_TRIGGER_BOTH_EDGES Guess – ADI_FLAG_POLARITY????? Look in service.h files

17 6/3/201617 / 28 Improved WriteLEDASM( ) ? More complicated than InitLEDPort( ) Uses “memory variables” to remember “LED state”

18 6/3/201618 / 28 This is ReadGPIO( ) & SW3Pressed == true Terminate services needed fopen( ) fclose( ) equivalent Improved WriteLEDASM( )

19 Still a lot more to understand zMany questions still unanswered zIn principle we could fix this code to handle Lab. 2 and 3 since we know what Lab. 2 and 3 are supposed to do zWe could re-use most of the code ySwitch 4 for light sensor ySwitch 3 and 2 for thermal sensors ySwitch 1 for “stop” yCut and paste that code 6/3/201619 / 28

20 Call back function zUsing this “*pArg” thing I could fix it so zIf button 4 interrupt then read CYCLES and store in light sensor array zIf button 3 interrupt store CYCLES in temp 1 array zIf button 2 interrupt store CYCLES in temp 2 array zOnce 4 values stored in array, leave “message” for main( ) to do necessary calculation 6/3/201620 / 28

21 Main( ) zDo all the same init manager stuff zMake all three buttons call Callback zWhile loop yIf light sensor values ready, calculate light level and display yIf temp1 values ready, calculate temperature and print yIf temp2 values ready, calculate emperature and print 6/3/201621 / 28

22 Quote from Arthur C Clarke zThe technology of any sufficiently advanced civilization is indistinguishable from magic. zIt may be magic, but based on how I got Labs 1, 2 and 3, I reckon I could hack main( ) to get something to happen. zHow I would test it, debug it or customize it – I have not got a clue – meaning I could not extend the ideas to use SDMA or SPI service 6/3/201622 / 28

23 I recognize this stuff 6/3/201623 / 28

24 I can guess about this stuff 6/3/201624 / 28

25 Next Stage zNot entirely sure what is happening zBut I believe that if I do good code review, frequently check my syntax, and am lucky, I could do Lab. 1, Lab. 2 and Lab 3 tasks using Services zDebugging things – especially if services are not written as expected, or I have misunderstood something – may be problematic zMy code follows 6/3/201625 / 28

26 6/3/201626 / 28 4 ISR equivalents here

27 6/3/201627 / 28 We know enough to “fake” calling CPP ASM code from C code without rewriting the code

28 6/3/201628 / 28

29 Don’t know what we did But that’s Lab. 1, 2 and 3 6/3/201629 / 28


Download ppt "The System Services way of doing Lab. 2 Task 8. What was Lab. 2 zActivate EBIU, Flash memory, Flash LED, GPIO flags zConnect light sensor to PF11 zEach."

Similar presentations


Ads by Google