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.
Fork of DSP_200kHz by
Jareds_DSP/print_data.cpp@83:0d068da1c6b7, 2017-08-30 (annotated)
- Committer:
- baxterja
- Date:
- Wed Aug 30 02:45:23 2017 +0000
- Revision:
- 83:0d068da1c6b7
- Parent:
- 81:30d699e951a8
Not working
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| baxterja | 76:704fc58ffcd0 | 1 | #include "print_data.h" |
| baxterja | 76:704fc58ffcd0 | 2 | |
| baxterja | 78:10b2916b8f5c | 3 | #define NUM_PRINT_INPUTS 2 |
| baxterja | 77:1ee17a9e9f8b | 4 | DigitalOut status_2(D4); |
| baxterja | 78:10b2916b8f5c | 5 | int printing_length[NUM_PRINT_INPUTS] = {0}; |
| baxterja | 78:10b2916b8f5c | 6 | int printing_counter[NUM_PRINT_INPUTS] = {0}; |
| baxterja | 78:10b2916b8f5c | 7 | char print_buffer[NUM_PRINT_INPUTS][50]; |
| baxterja | 78:10b2916b8f5c | 8 | |
| baxterja | 76:704fc58ffcd0 | 9 | |
| baxterja | 77:1ee17a9e9f8b | 10 | |
| baxterja | 77:1ee17a9e9f8b | 11 | void print_filter_data(Serial *pc) |
| baxterja | 76:704fc58ffcd0 | 12 | { |
| baxterja | 78:10b2916b8f5c | 13 | static int current_print_frequency = 0; |
| baxterja | 78:10b2916b8f5c | 14 | if (printing_counter[current_print_frequency]>=printing_length[current_print_frequency]) |
| baxterja | 78:10b2916b8f5c | 15 | { |
| baxterja | 78:10b2916b8f5c | 16 | printing_counter[current_print_frequency]= 0; |
| baxterja | 78:10b2916b8f5c | 17 | printing_length[current_print_frequency] = 0; |
| baxterja | 78:10b2916b8f5c | 18 | current_print_frequency++; |
| baxterja | 78:10b2916b8f5c | 19 | if (current_print_frequency>=NUM_PRINT_INPUTS) |
| baxterja | 78:10b2916b8f5c | 20 | { |
| baxterja | 78:10b2916b8f5c | 21 | current_print_frequency=0; |
| baxterja | 78:10b2916b8f5c | 22 | } |
| baxterja | 76:704fc58ffcd0 | 23 | return; |
| baxterja | 78:10b2916b8f5c | 24 | } |
| baxterja | 76:704fc58ffcd0 | 25 | status_2 = 1; |
| baxterja | 77:1ee17a9e9f8b | 26 | //printf("Y"); |
| baxterja | 78:10b2916b8f5c | 27 | pc->printf("%c",print_buffer[current_print_frequency][printing_counter[current_print_frequency]]); |
| baxterja | 78:10b2916b8f5c | 28 | printing_counter[current_print_frequency]++; |
| baxterja | 77:1ee17a9e9f8b | 29 | |
| baxterja | 76:704fc58ffcd0 | 30 | status_2 = 0; |
| baxterja | 76:704fc58ffcd0 | 31 | } |
| baxterja | 78:10b2916b8f5c | 32 | void set_print_buffer(float mag,float phase, int print_identifier) |
| baxterja | 76:704fc58ffcd0 | 33 | { |
| baxterja | 83:0d068da1c6b7 | 34 | /* |
| baxterja | 81:30d699e951a8 | 35 | if(isnan(mag)||isinf(mag)||isnan(phase)||isinf(phase)) |
| baxterja | 81:30d699e951a8 | 36 | { |
| baxterja | 81:30d699e951a8 | 37 | return; |
| baxterja | 81:30d699e951a8 | 38 | } |
| baxterja | 83:0d068da1c6b7 | 39 | */ |
| baxterja | 76:704fc58ffcd0 | 40 | if (printing_counter<printing_length) |
| baxterja | 76:704fc58ffcd0 | 41 | { |
| baxterja | 76:704fc58ffcd0 | 42 | printf("PRINT OVERLOAD\n\r"); |
| baxterja | 76:704fc58ffcd0 | 43 | } |
| baxterja | 77:1ee17a9e9f8b | 44 | |
| baxterja | 78:10b2916b8f5c | 45 | printing_length[print_identifier]=sprintf (print_buffer[print_identifier], "%d %E %f\n\r",print_identifier, mag, phase); |
| baxterja | 78:10b2916b8f5c | 46 | //printing_counter[print_identifier] = 0; |
| baxterja | 77:1ee17a9e9f8b | 47 | |
| baxterja | 76:704fc58ffcd0 | 48 | } |

