Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Committer:
lukeocarwright
Date:
Tue May 26 10:17:47 2020 +0000
Revision:
30:08cc4ec58d07
Parent:
21:60f01b17b0a6
Child:
31:cfdb014ff086
Sorted Settings Menu Final Touches. More Code Tidying.

Who changed what in which revision?

UserRevisionLine numberNew 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 luts.sin_wavetable();
lukeocarwright 9:f6ba53e355a0 20 if (sin_wavtable[i]==expected_sin) {
lukeocarwright 9:f6ba53e355a0 21 return (1);
lukeocarwright 9:f6ba53e355a0 22 } else {
lukeocarwright 30:08cc4ec58d07 23 printf("expected-%i__real-%u \n",expected_sin,sin_wavtable[i]);
lukeocarwright 9:f6ba53e355a0 24 return(0);
lukeocarwright 9:f6ba53e355a0 25 }
lukeocarwright 9:f6ba53e355a0 26 }
lukeocarwright 10:258a1eca02cc 27
lukeocarwright 21:60f01b17b0a6 28 /**debugs tri wave
lukeocarwright 21:60f01b17b0a6 29 * @takes input Pulsewidth, wavetable number and expected
lukeocarwright 21:60f01b17b0a6 30 * @returns true tri table value
lukeocarwright 21:60f01b17b0a6 31 */
lukeocarwright 10:258a1eca02cc 32 bool tri_debug(int pulsewidth,int i, int expected_tri)
lukeocarwright 10:258a1eca02cc 33 {
lukeocarwright 10:258a1eca02cc 34 luts.tri_wavetable(pulsewidth);
lukeocarwright 10:258a1eca02cc 35
lukeocarwright 10:258a1eca02cc 36 if (tri_wavtable[i]==expected_tri) {
lukeocarwright 10:258a1eca02cc 37 return (1);
lukeocarwright 10:258a1eca02cc 38 } else {
lukeocarwright 11:6ae098535da9 39 printf("expected-%i__real-%u \n",expected_tri,tri_wavtable[i]);
lukeocarwright 11:6ae098535da9 40 return(0);
lukeocarwright 11:6ae098535da9 41 }
lukeocarwright 11:6ae098535da9 42 }
lukeocarwright 11:6ae098535da9 43
lukeocarwright 21:60f01b17b0a6 44 /**debugs sqr wave
lukeocarwright 21:60f01b17b0a6 45 * @takes input Pulsewidth, wavetable number and expected
lukeocarwright 21:60f01b17b0a6 46 * @returns true sqr table value
lukeocarwright 21:60f01b17b0a6 47 */
lukeocarwright 11:6ae098535da9 48 bool pulse_debug(int pulsewidth,int i, int expected_pulse)
lukeocarwright 11:6ae098535da9 49 {
lukeocarwright 11:6ae098535da9 50 luts.pulse_wavetable(pulsewidth);
lukeocarwright 11:6ae098535da9 51
lukeocarwright 11:6ae098535da9 52 if (pulse_wavtable[i]==expected_pulse) {
lukeocarwright 11:6ae098535da9 53 return (1);
lukeocarwright 11:6ae098535da9 54 } else {
lukeocarwright 11:6ae098535da9 55 printf("expected-%i__real-%u \n",expected_pulse,pulse_wavtable[i]);
lukeocarwright 10:258a1eca02cc 56 return(0);
lukeocarwright 10:258a1eca02cc 57 }
lukeocarwright 10:258a1eca02cc 58 }
lukeocarwright 10:258a1eca02cc 59
lukeocarwright 21:60f01b17b0a6 60 #endif