
Impedance Fast Circuitry Software
Fork of DSP_200kHz by
Jareds_DSP/print_data.cpp@84:5b4466dd2326, 2018-02-21 (annotated)
- Committer:
- baxterja
- Date:
- Wed Feb 21 23:23:17 2018 +0000
- Revision:
- 84:5b4466dd2326
- Parent:
- 78:10b2916b8f5c
- Child:
- 86:b3520f4453cf
Pre_mavrik Version
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 | 84:5b4466dd2326 | 11 | void print_filter_data(Serial *pc, bool is_actively_printing) |
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 | 84:5b4466dd2326 | 27 | if (is_actively_printing) |
baxterja | 84:5b4466dd2326 | 28 | { |
baxterja | 84:5b4466dd2326 | 29 | pc->printf("%c",print_buffer[current_print_frequency][printing_counter[current_print_frequency]]); |
baxterja | 84:5b4466dd2326 | 30 | } |
baxterja | 78:10b2916b8f5c | 31 | printing_counter[current_print_frequency]++; |
baxterja | 77:1ee17a9e9f8b | 32 | |
baxterja | 76:704fc58ffcd0 | 33 | status_2 = 0; |
baxterja | 76:704fc58ffcd0 | 34 | } |
baxterja | 84:5b4466dd2326 | 35 | void set_print_buffer(double mag,double phase, int print_identifier) |
baxterja | 76:704fc58ffcd0 | 36 | { |
baxterja | 77:1ee17a9e9f8b | 37 | |
baxterja | 78:10b2916b8f5c | 38 | |
baxterja | 76:704fc58ffcd0 | 39 | if (printing_counter<printing_length) |
baxterja | 76:704fc58ffcd0 | 40 | { |
baxterja | 76:704fc58ffcd0 | 41 | printf("PRINT OVERLOAD\n\r"); |
baxterja | 76:704fc58ffcd0 | 42 | } |
baxterja | 77:1ee17a9e9f8b | 43 | |
baxterja | 78:10b2916b8f5c | 44 | printing_length[print_identifier]=sprintf (print_buffer[print_identifier], "%d %E %f\n\r",print_identifier, mag, phase); |
baxterja | 78:10b2916b8f5c | 45 | //printing_counter[print_identifier] = 0; |
baxterja | 77:1ee17a9e9f8b | 46 | |
baxterja | 76:704fc58ffcd0 | 47 | } |