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@10:258a1eca02cc, 2020-05-06 (annotated)
- Committer:
- lukeocarwright
- Date:
- Wed May 06 19:51:22 2020 +0000
- Revision:
- 10:258a1eca02cc
- Parent:
- 9:f6ba53e355a0
- Child:
- 11:6ae098535da9
Added Triangle/saw LUT with debug test
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 | 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 | 10:258a1eca02cc | 34 | return(0); |
lukeocarwright | 10:258a1eca02cc | 35 | } |
lukeocarwright | 10:258a1eca02cc | 36 | } |
lukeocarwright | 10:258a1eca02cc | 37 | |
lukeocarwright | 9:f6ba53e355a0 | 38 | #endif |