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.
LUTs/LUTs_debug.h@21:60f01b17b0a6, 2020-05-23 (annotated)
- Committer:
- lukeocarwright
- Date:
- Sat May 23 14:40:40 2020 +0000
- Revision:
- 21:60f01b17b0a6
- Parent:
- 11:6ae098535da9
- Child:
- 30:08cc4ec58d07
Publish to check Documentation;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lukeocarwright | 9:f6ba53e355a0 | 1 | #ifndef LUTS_DEBUG_H |
lukeocarwright | 9:f6ba53e355a0 | 2 | #define LUTS_DEBUG_H |
lukeocarwright | 9:f6ba53e355a0 | 3 | |
lukeocarwright | 9:f6ba53e355a0 | 4 | /** Spaceship Test |
lukeocarwright | 9:f6ba53e355a0 | 5 | @brief Checks LUT values are correct |
lukeocarwright | 9:f6ba53e355a0 | 6 | @author Luke Cartwright, University of Leeds |
lukeocarwright | 9:f6ba53e355a0 | 7 | @date May 2020 |
lukeocarwright | 9:f6ba53e355a0 | 8 | @return true if debug is passed |
lukeocarwright | 9:f6ba53e355a0 | 9 | */ |
lukeocarwright | 9:f6ba53e355a0 | 10 | |
lukeocarwright | 10:258a1eca02cc | 11 | // Objects |
lukeocarwright | 10:258a1eca02cc | 12 | LUTs luts; |
lukeocarwright | 10:258a1eca02cc | 13 | |
lukeocarwright | 21:60f01b17b0a6 | 14 | /**debugs sine wave |
lukeocarwright | 21:60f01b17b0a6 | 15 | * @takes input wavetable number and expected |
lukeocarwright | 21:60f01b17b0a6 | 16 | * @returns true sin table value |
lukeocarwright | 21:60f01b17b0a6 | 17 | */ |
lukeocarwright | 9:f6ba53e355a0 | 18 | bool sin_debug(int i, int expected_sin) |
lukeocarwright | 9:f6ba53e355a0 | 19 | //method |
lukeocarwright | 9:f6ba53e355a0 | 20 | luts.sin_wavetable(); |
lukeocarwright | 9:f6ba53e355a0 | 21 | |
lukeocarwright | 9:f6ba53e355a0 | 22 | if (sin_wavtable[i]==expected_sin) { |
lukeocarwright | 9:f6ba53e355a0 | 23 | return (1); |
lukeocarwright | 9:f6ba53e355a0 | 24 | } else { |
lukeocarwright | 9:f6ba53e355a0 | 25 | return(0); |
lukeocarwright | 9:f6ba53e355a0 | 26 | } |
lukeocarwright | 9:f6ba53e355a0 | 27 | } |
lukeocarwright | 10:258a1eca02cc | 28 | |
lukeocarwright | 21:60f01b17b0a6 | 29 | /**debugs tri wave |
lukeocarwright | 21:60f01b17b0a6 | 30 | * @takes input Pulsewidth, wavetable number and expected |
lukeocarwright | 21:60f01b17b0a6 | 31 | * @returns true tri table value |
lukeocarwright | 21:60f01b17b0a6 | 32 | */ |
lukeocarwright | 10:258a1eca02cc | 33 | bool tri_debug(int pulsewidth,int i, int expected_tri) |
lukeocarwright | 10:258a1eca02cc | 34 | { |
lukeocarwright | 10:258a1eca02cc | 35 | //method |
lukeocarwright | 10:258a1eca02cc | 36 | luts.tri_wavetable(pulsewidth); |
lukeocarwright | 10:258a1eca02cc | 37 | |
lukeocarwright | 10:258a1eca02cc | 38 | if (tri_wavtable[i]==expected_tri) { |
lukeocarwright | 10:258a1eca02cc | 39 | return (1); |
lukeocarwright | 10:258a1eca02cc | 40 | } else { |
lukeocarwright | 11:6ae098535da9 | 41 | printf("expected-%i__real-%u \n",expected_tri,tri_wavtable[i]); |
lukeocarwright | 11:6ae098535da9 | 42 | return(0); |
lukeocarwright | 11:6ae098535da9 | 43 | } |
lukeocarwright | 11:6ae098535da9 | 44 | } |
lukeocarwright | 11:6ae098535da9 | 45 | |
lukeocarwright | 21:60f01b17b0a6 | 46 | /**debugs sqr wave |
lukeocarwright | 21:60f01b17b0a6 | 47 | * @takes input Pulsewidth, wavetable number and expected |
lukeocarwright | 21:60f01b17b0a6 | 48 | * @returns true sqr table value |
lukeocarwright | 21:60f01b17b0a6 | 49 | */ |
lukeocarwright | 11:6ae098535da9 | 50 | bool pulse_debug(int pulsewidth,int i, int expected_pulse) |
lukeocarwright | 11:6ae098535da9 | 51 | { |
lukeocarwright | 11:6ae098535da9 | 52 | //method |
lukeocarwright | 11:6ae098535da9 | 53 | luts.pulse_wavetable(pulsewidth); |
lukeocarwright | 11:6ae098535da9 | 54 | |
lukeocarwright | 11:6ae098535da9 | 55 | if (pulse_wavtable[i]==expected_pulse) { |
lukeocarwright | 11:6ae098535da9 | 56 | return (1); |
lukeocarwright | 11:6ae098535da9 | 57 | } else { |
lukeocarwright | 11:6ae098535da9 | 58 | printf("expected-%i__real-%u \n",expected_pulse,pulse_wavtable[i]); |
lukeocarwright | 10:258a1eca02cc | 59 | return(0); |
lukeocarwright | 10:258a1eca02cc | 60 | } |
lukeocarwright | 10:258a1eca02cc | 61 | } |
lukeocarwright | 10:258a1eca02cc | 62 | |
lukeocarwright | 21:60f01b17b0a6 | 63 | #endif |