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@9:f6ba53e355a0, 2020-05-06 (annotated)
- Committer:
- lukeocarwright
- Date:
- Wed May 06 14:37:34 2020 +0000
- Revision:
- 9:f6ba53e355a0
- Child:
- 10:258a1eca02cc
Outputted sin LUT in uint16_t with unit test using DEBUG macro. Allows direct writing of value to table to 16-bit DAC.
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 | 9:f6ba53e355a0 | 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 | 9:f6ba53e355a0 | 30 | void run_LUTs_debug () |
| lukeocarwright | 9:f6ba53e355a0 | 31 | { |
| lukeocarwright | 9:f6ba53e355a0 | 32 | int masterpass=0; |
| lukeocarwright | 9:f6ba53e355a0 | 33 | if(run_sin_debug())masterpass++; |
| lukeocarwright | 9:f6ba53e355a0 | 34 | if(masterpass==1) { |
| lukeocarwright | 9:f6ba53e355a0 | 35 | printf("DEBUG PASSED\n"); |
| lukeocarwright | 9:f6ba53e355a0 | 36 | }else { |
| lukeocarwright | 9:f6ba53e355a0 | 37 | printf("DEBUG FAIL tests passed = %d\n",masterpass); |
| lukeocarwright | 9:f6ba53e355a0 | 38 | } |
| lukeocarwright | 9:f6ba53e355a0 | 39 | } |
| lukeocarwright | 9:f6ba53e355a0 | 40 | |
| lukeocarwright | 9:f6ba53e355a0 | 41 | |
| lukeocarwright | 9:f6ba53e355a0 | 42 | #endif |