File: debug.c

package info (click to toggle)
firmware-microbit-micropython 1.0.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 25,448 kB
  • sloc: ansic: 83,496; cpp: 27,664; python: 2,475; asm: 274; makefile: 245; javascript: 41; sh: 25
file content (71 lines) | stat: -rwxr-xr-x 1,917 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include<stdio.h>
#include "sam.h"

extern unsigned char signInputTable1[];
extern unsigned char signInputTable2[];

void PrintPhonemes(char* title, phoneme_t *phonemes)
{
	int i = 0;
	printf("===========================================\r\n");

	printf("%s:\r\n\r\n", title);
	printf(" idx    phoneme  length  stress\r\n");
	printf("------------------------------\r\n");

	while((phonemes[i].index != PHONEME_END) && (i < 255))
	{
		if (phonemes[i].index < 81)
		{
			printf(" %3i      %c%c      %3i       %i\r\n",
			phonemes[i].index,
			signInputTable1[phonemes[i].index],
			signInputTable2[phonemes[i].index],
			phonemes[i].length,
			phonemes[i].stress
			);
		} else
		{
			printf(" %3i      ??      %3i       %i\r\n", phonemes[i].index, phonemes[i].length, phonemes[i].stress);
		}
		i++;
	}
	printf("===========================================\r\n");
	printf("\r\n");
}

void PrintOutput(unsigned char *flags, render_freq_amp_t *frames, unsigned char *pitches, unsigned char count)
{
	printf("===========================================\r\n");
	printf("Final data for speech output. %i frames:\r\n\r\n", count);
	int i = 0;
	printf(" flags ampl1 freq1 ampl2 freq2 ampl3 freq3 pitch\r\n");
	printf("------------------------------------------------\r\n");
	while(i < count)
	{
        render_freq_amp_t frame = frames[i];
		printf("%5i %5i %5i %5i %5i %5i %5i %5i\r\n", flags[i], frame.amp1, frame.freq1, frame.amp2, frame.freq2, frame.amp3, frame.freq3, pitches[i]);
		i++;
	}
	printf("===========================================\r\n");

}

/* For debugging or modifying reciter rules ...

extern unsigned char GetRuleByte(unsigned short mem62, unsigned char Y);

void PrintRule(int offset)
{
	int i = 1;
	unsigned char A = 0;
	printf("Applying rule: ");
	do
	{
		A = GetRuleByte(offset, i);
		if ((A&127) == '=') printf(" -> "); else printf("%c", A&127);
		i++;
	} while ((A&128)==0);
	printf("\r\n");
}
*/