Luke Cartwright / Mbed 2 deprecated ELEC2645_Project_el18loc_nearlythere

Dependencies:   mbed

Committer:
lukeocarwright
Date:
Thu May 07 12:22:39 2020 +0000
Revision:
11:6ae098535da9
Parent:
10:258a1eca02cc
Child:
21:60f01b17b0a6
Added pulse and enhanced other degubbing. Also eddited tri_wavtable algorithm.

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 9:f6ba53e355a0 14 bool sin_debug(int i, int expected_sin)
lukeocarwright 9:f6ba53e355a0 15 {
lukeocarwright 9:f6ba53e355a0 16 //method
lukeocarwright 9:f6ba53e355a0 17 luts.sin_wavetable();
lukeocarwright 9:f6ba53e355a0 18
lukeocarwright 9:f6ba53e355a0 19 if (sin_wavtable[i]==expected_sin) {
lukeocarwright 9:f6ba53e355a0 20 return (1);
lukeocarwright 9:f6ba53e355a0 21 } else {
lukeocarwright 9:f6ba53e355a0 22 return(0);
lukeocarwright 9:f6ba53e355a0 23 }
lukeocarwright 9:f6ba53e355a0 24 }
lukeocarwright 10:258a1eca02cc 25
lukeocarwright 10:258a1eca02cc 26 bool tri_debug(int pulsewidth,int i, int expected_tri)
lukeocarwright 10:258a1eca02cc 27 {
lukeocarwright 10:258a1eca02cc 28 //method
lukeocarwright 10:258a1eca02cc 29 luts.tri_wavetable(pulsewidth);
lukeocarwright 10:258a1eca02cc 30
lukeocarwright 10:258a1eca02cc 31 if (tri_wavtable[i]==expected_tri) {
lukeocarwright 10:258a1eca02cc 32 return (1);
lukeocarwright 10:258a1eca02cc 33 } else {
lukeocarwright 11:6ae098535da9 34 printf("expected-%i__real-%u \n",expected_tri,tri_wavtable[i]);
lukeocarwright 11:6ae098535da9 35 return(0);
lukeocarwright 11:6ae098535da9 36 }
lukeocarwright 11:6ae098535da9 37 }
lukeocarwright 11:6ae098535da9 38
lukeocarwright 11:6ae098535da9 39 bool pulse_debug(int pulsewidth,int i, int expected_pulse)
lukeocarwright 11:6ae098535da9 40 {
lukeocarwright 11:6ae098535da9 41 //method
lukeocarwright 11:6ae098535da9 42 luts.pulse_wavetable(pulsewidth);
lukeocarwright 11:6ae098535da9 43
lukeocarwright 11:6ae098535da9 44 if (pulse_wavtable[i]==expected_pulse) {
lukeocarwright 11:6ae098535da9 45 return (1);
lukeocarwright 11:6ae098535da9 46 } else {
lukeocarwright 11:6ae098535da9 47 printf("expected-%i__real-%u \n",expected_pulse,pulse_wavtable[i]);
lukeocarwright 10:258a1eca02cc 48 return(0);
lukeocarwright 10:258a1eca02cc 49 }
lukeocarwright 10:258a1eca02cc 50 }
lukeocarwright 10:258a1eca02cc 51
lukeocarwright 9:f6ba53e355a0 52 #endif