Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Debug.h@30:08cc4ec58d07, 2020-05-26 (annotated)
- Committer:
- lukeocarwright
- Date:
- Tue May 26 10:17:47 2020 +0000
- Revision:
- 30:08cc4ec58d07
- Parent:
- 29:207111ffd6e6
- Child:
- 31:cfdb014ff086
Sorted Settings Menu Final Touches. More Code Tidying.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| lukeocarwright | 9:f6ba53e355a0 | 1 | #ifndef DEBUG_H |
| lukeocarwright | 9:f6ba53e355a0 | 2 | #define DEBUG_H |
| lukeocarwright | 9:f6ba53e355a0 | 3 | |
| lukeocarwright | 9:f6ba53e355a0 | 4 | #include "LUTs_debug.h" |
| lukeocarwright | 9:f6ba53e355a0 | 5 | |
| lukeocarwright | 9:f6ba53e355a0 | 6 | /** Debug |
| lukeocarwright | 9:f6ba53e355a0 | 7 | @brief Runs debug codes |
| lukeocarwright | 9:f6ba53e355a0 | 8 | @author Luke Cartwright, University of Leeds |
| lukeocarwright | 9:f6ba53e355a0 | 9 | @date May 2020 |
| lukeocarwright | 9:f6ba53e355a0 | 10 | */ |
| lukeocarwright | 9:f6ba53e355a0 | 11 | |
| lukeocarwright | 30:08cc4ec58d07 | 12 | |
| lukeocarwright | 30:08cc4ec58d07 | 13 | void run_LUTs_debug () |
| lukeocarwright | 30:08cc4ec58d07 | 14 | { |
| lukeocarwright | 30:08cc4ec58d07 | 15 | int masterpass=0; |
| lukeocarwright | 30:08cc4ec58d07 | 16 | if(run_sin_debug())masterpass++; |
| lukeocarwright | 30:08cc4ec58d07 | 17 | if(run_tri_debug())masterpass++; |
| lukeocarwright | 30:08cc4ec58d07 | 18 | if(run_pulse_debug())masterpass++; |
| lukeocarwright | 30:08cc4ec58d07 | 19 | if(masterpass==3) { |
| lukeocarwright | 30:08cc4ec58d07 | 20 | printf("DEBUG PASSED\n"); |
| lukeocarwright | 30:08cc4ec58d07 | 21 | } else { |
| lukeocarwright | 30:08cc4ec58d07 | 22 | printf("DEBUG FAIL master tests passed = %d\n",masterpass); |
| lukeocarwright | 30:08cc4ec58d07 | 23 | } |
| lukeocarwright | 30:08cc4ec58d07 | 24 | } |
| lukeocarwright | 30:08cc4ec58d07 | 25 | |
| lukeocarwright | 9:f6ba53e355a0 | 26 | bool run_sin_debug() |
| lukeocarwright | 9:f6ba53e355a0 | 27 | { |
| lukeocarwright | 9:f6ba53e355a0 | 28 | int passed=0; |
| lukeocarwright | 9:f6ba53e355a0 | 29 | if(sin_debug(0, 32768))passed++; |
| lukeocarwright | 9:f6ba53e355a0 | 30 | if(sin_debug(512, 32768))passed++; |
| lukeocarwright | 9:f6ba53e355a0 | 31 | if(sin_debug(256, 65535))passed++; |
| lukeocarwright | 10:258a1eca02cc | 32 | |
| lukeocarwright | 9:f6ba53e355a0 | 33 | if (passed==3) { |
| lukeocarwright | 9:f6ba53e355a0 | 34 | printf("Sin debug PASS\n"); |
| lukeocarwright | 9:f6ba53e355a0 | 35 | return (1); |
| lukeocarwright | 9:f6ba53e355a0 | 36 | } else { |
| lukeocarwright | 9:f6ba53e355a0 | 37 | printf("Sin debug FAIL\n"); |
| lukeocarwright | 9:f6ba53e355a0 | 38 | printf("tests passed = %d", passed); |
| lukeocarwright | 9:f6ba53e355a0 | 39 | return (0); |
| lukeocarwright | 9:f6ba53e355a0 | 40 | } |
| lukeocarwright | 9:f6ba53e355a0 | 41 | } |
| lukeocarwright | 10:258a1eca02cc | 42 | |
| lukeocarwright | 10:258a1eca02cc | 43 | bool run_tri_debug() |
| lukeocarwright | 10:258a1eca02cc | 44 | { |
| lukeocarwright | 10:258a1eca02cc | 45 | int passed=0; |
| lukeocarwright | 10:258a1eca02cc | 46 | if(tri_debug(50,0,0))passed++; |
| lukeocarwright | 11:6ae098535da9 | 47 | if(tri_debug(50,511, 65408))passed++; |
| lukeocarwright | 11:6ae098535da9 | 48 | if(tri_debug(100,0,0))passed++; |
| lukeocarwright | 15:1c67f064278e | 49 | if(tri_debug(1,11,65471))passed++; |
| lukeocarwright | 14:9cfe0041cc4e | 50 | |
| lukeocarwright | 11:6ae098535da9 | 51 | if (passed==4) { |
| lukeocarwright | 10:258a1eca02cc | 52 | printf("Tri debug PASS\n"); |
| lukeocarwright | 10:258a1eca02cc | 53 | return (1); |
| lukeocarwright | 10:258a1eca02cc | 54 | } else { |
| lukeocarwright | 10:258a1eca02cc | 55 | printf("Tri debug FAIL\n"); |
| lukeocarwright | 10:258a1eca02cc | 56 | printf("tests passed = %d\n", passed); |
| lukeocarwright | 10:258a1eca02cc | 57 | return (0); |
| lukeocarwright | 10:258a1eca02cc | 58 | } |
| lukeocarwright | 10:258a1eca02cc | 59 | } |
| lukeocarwright | 10:258a1eca02cc | 60 | |
| lukeocarwright | 11:6ae098535da9 | 61 | bool run_pulse_debug() |
| lukeocarwright | 11:6ae098535da9 | 62 | { |
| lukeocarwright | 11:6ae098535da9 | 63 | int passed=0; |
| lukeocarwright | 29:207111ffd6e6 | 64 | if(pulse_debug(50,0,58981))passed++; |
| lukeocarwright | 29:207111ffd6e6 | 65 | if(pulse_debug(50,512,58981))passed++; |
| lukeocarwright | 29:207111ffd6e6 | 66 | if(pulse_debug(50,513,6553))passed++; |
| lukeocarwright | 29:207111ffd6e6 | 67 | if(pulse_debug(1,10,58981))passed++; |
| lukeocarwright | 11:6ae098535da9 | 68 | |
| lukeocarwright | 11:6ae098535da9 | 69 | if (passed==4) { |
| lukeocarwright | 11:6ae098535da9 | 70 | printf("Pulse debug PASS\n"); |
| lukeocarwright | 11:6ae098535da9 | 71 | return (1); |
| lukeocarwright | 11:6ae098535da9 | 72 | } else { |
| lukeocarwright | 11:6ae098535da9 | 73 | printf("Pulse debug FAIL\n"); |
| lukeocarwright | 11:6ae098535da9 | 74 | printf("tests passed = %d\n", passed); |
| lukeocarwright | 11:6ae098535da9 | 75 | return (0); |
| lukeocarwright | 11:6ae098535da9 | 76 | } |
| lukeocarwright | 11:6ae098535da9 | 77 | } |
| lukeocarwright | 11:6ae098535da9 | 78 | |
| lukeocarwright | 9:f6ba53e355a0 | 79 | #endif |