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@14:9cfe0041cc4e, 2020-05-19 (annotated)
- Committer:
- lukeocarwright
- Date:
- Tue May 19 15:04:33 2020 +0000
- Revision:
- 14:9cfe0041cc4e
- Parent:
- 11:6ae098535da9
- Child:
- 15:1c67f064278e
Actually make proper sound atlast. Checked Concert A against piano. included more preprocessor debug (SLOW TIME) for Debug if output check required w. printf
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 | 9:f6ba53e355a0 | 12 | bool run_sin_debug() |
lukeocarwright | 9:f6ba53e355a0 | 13 | { |
lukeocarwright | 9:f6ba53e355a0 | 14 | int passed=0; |
lukeocarwright | 9:f6ba53e355a0 | 15 | if(sin_debug(0, 32768))passed++; |
lukeocarwright | 9:f6ba53e355a0 | 16 | if(sin_debug(512, 32768))passed++; |
lukeocarwright | 9:f6ba53e355a0 | 17 | if(sin_debug(256, 65535))passed++; |
lukeocarwright | 10:258a1eca02cc | 18 | |
lukeocarwright | 9:f6ba53e355a0 | 19 | if (passed==3) { |
lukeocarwright | 9:f6ba53e355a0 | 20 | printf("Sin debug PASS\n"); |
lukeocarwright | 9:f6ba53e355a0 | 21 | return (1); |
lukeocarwright | 9:f6ba53e355a0 | 22 | } else { |
lukeocarwright | 9:f6ba53e355a0 | 23 | printf("Sin debug FAIL\n"); |
lukeocarwright | 9:f6ba53e355a0 | 24 | printf("tests passed = %d", passed); |
lukeocarwright | 9:f6ba53e355a0 | 25 | return (0); |
lukeocarwright | 9:f6ba53e355a0 | 26 | } |
lukeocarwright | 9:f6ba53e355a0 | 27 | } |
lukeocarwright | 10:258a1eca02cc | 28 | |
lukeocarwright | 10:258a1eca02cc | 29 | bool run_tri_debug() |
lukeocarwright | 10:258a1eca02cc | 30 | { |
lukeocarwright | 10:258a1eca02cc | 31 | int passed=0; |
lukeocarwright | 10:258a1eca02cc | 32 | if(tri_debug(50,0,0))passed++; |
lukeocarwright | 11:6ae098535da9 | 33 | if(tri_debug(50,511, 65408))passed++; |
lukeocarwright | 11:6ae098535da9 | 34 | if(tri_debug(100,0,0))passed++; |
lukeocarwright | 11:6ae098535da9 | 35 | if(tri_debug(1,11,65529))passed++; |
lukeocarwright | 14:9cfe0041cc4e | 36 | |
lukeocarwright | 11:6ae098535da9 | 37 | if (passed==4) { |
lukeocarwright | 10:258a1eca02cc | 38 | printf("Tri debug PASS\n"); |
lukeocarwright | 10:258a1eca02cc | 39 | return (1); |
lukeocarwright | 10:258a1eca02cc | 40 | } else { |
lukeocarwright | 10:258a1eca02cc | 41 | printf("Tri debug FAIL\n"); |
lukeocarwright | 10:258a1eca02cc | 42 | printf("tests passed = %d\n", passed); |
lukeocarwright | 10:258a1eca02cc | 43 | return (0); |
lukeocarwright | 10:258a1eca02cc | 44 | } |
lukeocarwright | 10:258a1eca02cc | 45 | } |
lukeocarwright | 10:258a1eca02cc | 46 | |
lukeocarwright | 11:6ae098535da9 | 47 | bool run_pulse_debug() |
lukeocarwright | 11:6ae098535da9 | 48 | { |
lukeocarwright | 11:6ae098535da9 | 49 | int passed=0; |
lukeocarwright | 11:6ae098535da9 | 50 | if(pulse_debug(50,0,65535))passed++; |
lukeocarwright | 11:6ae098535da9 | 51 | if(pulse_debug(50,512,65535))passed++; |
lukeocarwright | 11:6ae098535da9 | 52 | if(pulse_debug(50,513,0))passed++; |
lukeocarwright | 11:6ae098535da9 | 53 | if(pulse_debug(1,10,65535))passed++; |
lukeocarwright | 11:6ae098535da9 | 54 | |
lukeocarwright | 11:6ae098535da9 | 55 | if (passed==4) { |
lukeocarwright | 11:6ae098535da9 | 56 | printf("Pulse debug PASS\n"); |
lukeocarwright | 11:6ae098535da9 | 57 | return (1); |
lukeocarwright | 11:6ae098535da9 | 58 | } else { |
lukeocarwright | 11:6ae098535da9 | 59 | printf("Pulse debug FAIL\n"); |
lukeocarwright | 11:6ae098535da9 | 60 | printf("tests passed = %d\n", passed); |
lukeocarwright | 11:6ae098535da9 | 61 | return (0); |
lukeocarwright | 11:6ae098535da9 | 62 | } |
lukeocarwright | 11:6ae098535da9 | 63 | } |
lukeocarwright | 11:6ae098535da9 | 64 | |
lukeocarwright | 10:258a1eca02cc | 65 | void run_LUTs_debug () |
lukeocarwright | 9:f6ba53e355a0 | 66 | { |
lukeocarwright | 9:f6ba53e355a0 | 67 | int masterpass=0; |
lukeocarwright | 9:f6ba53e355a0 | 68 | if(run_sin_debug())masterpass++; |
lukeocarwright | 10:258a1eca02cc | 69 | if(run_tri_debug())masterpass++; |
lukeocarwright | 11:6ae098535da9 | 70 | if(run_pulse_debug())masterpass++; |
lukeocarwright | 11:6ae098535da9 | 71 | if(masterpass==3) { |
lukeocarwright | 9:f6ba53e355a0 | 72 | printf("DEBUG PASSED\n"); |
lukeocarwright | 10:258a1eca02cc | 73 | } else { |
lukeocarwright | 11:6ae098535da9 | 74 | printf("DEBUG FAIL master tests passed = %d\n",masterpass); |
lukeocarwright | 10:258a1eca02cc | 75 | } |
lukeocarwright | 9:f6ba53e355a0 | 76 | } |
lukeocarwright | 9:f6ba53e355a0 | 77 | |
lukeocarwright | 9:f6ba53e355a0 | 78 | |
lukeocarwright | 9:f6ba53e355a0 | 79 | #endif |