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@11:6ae098535da9, 2020-05-07 (annotated)
- Committer:
- lukeocarwright
- Date:
- Thu May 07 12:22:39 2020 +0000
- Revision:
- 11:6ae098535da9
- Parent:
- 10:258a1eca02cc
- Child:
- 14:9cfe0041cc4e
Added pulse and enhanced other degubbing. Also eddited tri_wavtable algorithm.
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 | |
| lukeocarwright | 9:f6ba53e355a0 | 7 | /** Debug |
| lukeocarwright | 9:f6ba53e355a0 | 8 | @brief Runs debug codes |
| lukeocarwright | 9:f6ba53e355a0 | 9 | @author Luke Cartwright, University of Leeds |
| lukeocarwright | 9:f6ba53e355a0 | 10 | @date May 2020 |
| lukeocarwright | 9:f6ba53e355a0 | 11 | */ |
| lukeocarwright | 9:f6ba53e355a0 | 12 | |
| lukeocarwright | 9:f6ba53e355a0 | 13 | |
| lukeocarwright | 9:f6ba53e355a0 | 14 | bool run_sin_debug() |
| lukeocarwright | 9:f6ba53e355a0 | 15 | { |
| lukeocarwright | 9:f6ba53e355a0 | 16 | int passed=0; |
| lukeocarwright | 9:f6ba53e355a0 | 17 | if(sin_debug(0, 32768))passed++; |
| lukeocarwright | 9:f6ba53e355a0 | 18 | if(sin_debug(512, 32768))passed++; |
| lukeocarwright | 9:f6ba53e355a0 | 19 | if(sin_debug(256, 65535))passed++; |
| lukeocarwright | 10:258a1eca02cc | 20 | |
| lukeocarwright | 9:f6ba53e355a0 | 21 | if (passed==3) { |
| lukeocarwright | 9:f6ba53e355a0 | 22 | printf("Sin debug PASS\n"); |
| lukeocarwright | 9:f6ba53e355a0 | 23 | return (1); |
| lukeocarwright | 9:f6ba53e355a0 | 24 | } else { |
| lukeocarwright | 9:f6ba53e355a0 | 25 | printf("Sin debug FAIL\n"); |
| lukeocarwright | 9:f6ba53e355a0 | 26 | printf("tests passed = %d", passed); |
| lukeocarwright | 9:f6ba53e355a0 | 27 | return (0); |
| lukeocarwright | 9:f6ba53e355a0 | 28 | } |
| lukeocarwright | 9:f6ba53e355a0 | 29 | } |
| lukeocarwright | 10:258a1eca02cc | 30 | |
| lukeocarwright | 10:258a1eca02cc | 31 | bool run_tri_debug() |
| lukeocarwright | 10:258a1eca02cc | 32 | { |
| lukeocarwright | 10:258a1eca02cc | 33 | int passed=0; |
| lukeocarwright | 10:258a1eca02cc | 34 | if(tri_debug(50,0,0))passed++; |
| lukeocarwright | 11:6ae098535da9 | 35 | if(tri_debug(50,511, 65408))passed++; |
| lukeocarwright | 11:6ae098535da9 | 36 | if(tri_debug(100,0,0))passed++; |
| lukeocarwright | 11:6ae098535da9 | 37 | if(tri_debug(1,11,65529))passed++; |
| lukeocarwright | 11:6ae098535da9 | 38 | |
| lukeocarwright | 11:6ae098535da9 | 39 | if (passed==4) { |
| lukeocarwright | 10:258a1eca02cc | 40 | printf("Tri debug PASS\n"); |
| lukeocarwright | 10:258a1eca02cc | 41 | return (1); |
| lukeocarwright | 10:258a1eca02cc | 42 | } else { |
| lukeocarwright | 10:258a1eca02cc | 43 | printf("Tri debug FAIL\n"); |
| lukeocarwright | 10:258a1eca02cc | 44 | printf("tests passed = %d\n", passed); |
| lukeocarwright | 10:258a1eca02cc | 45 | return (0); |
| lukeocarwright | 10:258a1eca02cc | 46 | } |
| lukeocarwright | 10:258a1eca02cc | 47 | } |
| lukeocarwright | 10:258a1eca02cc | 48 | |
| lukeocarwright | 11:6ae098535da9 | 49 | bool run_pulse_debug() |
| lukeocarwright | 11:6ae098535da9 | 50 | { |
| lukeocarwright | 11:6ae098535da9 | 51 | int passed=0; |
| lukeocarwright | 11:6ae098535da9 | 52 | if(pulse_debug(50,0,65535))passed++; |
| lukeocarwright | 11:6ae098535da9 | 53 | if(pulse_debug(50,512,65535))passed++; |
| lukeocarwright | 11:6ae098535da9 | 54 | if(pulse_debug(50,513,0))passed++; |
| lukeocarwright | 11:6ae098535da9 | 55 | if(pulse_debug(1,10,65535))passed++; |
| lukeocarwright | 11:6ae098535da9 | 56 | |
| lukeocarwright | 11:6ae098535da9 | 57 | if (passed==4) { |
| lukeocarwright | 11:6ae098535da9 | 58 | printf("Pulse debug PASS\n"); |
| lukeocarwright | 11:6ae098535da9 | 59 | return (1); |
| lukeocarwright | 11:6ae098535da9 | 60 | } else { |
| lukeocarwright | 11:6ae098535da9 | 61 | printf("Pulse debug FAIL\n"); |
| lukeocarwright | 11:6ae098535da9 | 62 | printf("tests passed = %d\n", passed); |
| lukeocarwright | 11:6ae098535da9 | 63 | return (0); |
| lukeocarwright | 11:6ae098535da9 | 64 | } |
| lukeocarwright | 11:6ae098535da9 | 65 | } |
| lukeocarwright | 11:6ae098535da9 | 66 | |
| lukeocarwright | 10:258a1eca02cc | 67 | void run_LUTs_debug () |
| lukeocarwright | 9:f6ba53e355a0 | 68 | { |
| lukeocarwright | 9:f6ba53e355a0 | 69 | int masterpass=0; |
| lukeocarwright | 9:f6ba53e355a0 | 70 | if(run_sin_debug())masterpass++; |
| lukeocarwright | 10:258a1eca02cc | 71 | if(run_tri_debug())masterpass++; |
| lukeocarwright | 11:6ae098535da9 | 72 | if(run_pulse_debug())masterpass++; |
| lukeocarwright | 11:6ae098535da9 | 73 | if(masterpass==3) { |
| lukeocarwright | 9:f6ba53e355a0 | 74 | printf("DEBUG PASSED\n"); |
| lukeocarwright | 10:258a1eca02cc | 75 | } else { |
| lukeocarwright | 11:6ae098535da9 | 76 | printf("DEBUG FAIL master tests passed = %d\n",masterpass); |
| lukeocarwright | 10:258a1eca02cc | 77 | } |
| lukeocarwright | 9:f6ba53e355a0 | 78 | } |
| lukeocarwright | 9:f6ba53e355a0 | 79 | |
| lukeocarwright | 9:f6ba53e355a0 | 80 | |
| lukeocarwright | 9:f6ba53e355a0 | 81 | #endif |