Rev 2 | Rev 4 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 3 | ||
---|---|---|---|
Line 23... | Line 23... | ||
23 | int const HEIGHT = 64; |
23 | int const HEIGHT = 64; |
24 | int const DISPLAY_RAMWIDTH = 132; |
24 | int const DISPLAY_RAMWIDTH = 132; |
25 | 25 | ||
26 | int x = 500; |
26 | int x = 500; |
27 | int y = 20; |
27 | int y = 20; |
- | 28 | int ph= 0; |
|
28 | } |
29 | } |
29 | 30 | ||
30 | uint8_t displayBuffer[2][dataSize(WIDTH, HEIGHT)]; |
31 | uint8_t displayBuffer[2][dataSize(WIDTH, HEIGHT)]; |
31 | 32 | ||
32 | stm32_halDisplay_t displays[MAX_DISPLAYS] = |
33 | stm32_halDisplay_t displays[MAX_DISPLAYS] = |
Line 41... | Line 42... | ||
41 | SPI_NSS1_Pin), |
42 | SPI_NSS1_Pin), |
42 | }; |
43 | }; |
43 | // display from 0 to 1000 rpm , and 0 to 100kPa |
44 | // display from 0 to 1000 rpm , and 0 to 100kPa |
44 | displayXY_t dispXY(displays[0], 500, 6000, 100, 0); |
45 | displayXY_t dispXY(displays[0], 500, 6000, 100, 0); |
45 | 46 | ||
- | 47 | // set up sine tables |
|
- | 48 | ap_math m; |
|
- | 49 | ||
46 | #if defined __cplusplus |
50 | #if defined __cplusplus |
47 | extern "C" |
51 | extern "C" |
48 | { |
52 | { |
49 | #endif |
53 | #endif |
50 | 54 | ||
Line 74... | Line 78... | ||
74 | return -1; |
78 | return -1; |
75 | stm32_halDisplay_t &display = displays[dialIndex]; |
79 | stm32_halDisplay_t &display = displays[dialIndex]; |
76 | char buff[10]; |
80 | char buff[10]; |
77 | display.clearDisplay(BLACK); |
81 | display.clearDisplay(BLACK); |
78 | dispXY.drawAxes(); |
82 | dispXY.drawAxes(); |
79 | x+=100; |
83 | x += 100; |
- | 84 | y = m.ap_sin((ph+x)/2 )/10 + 50; |
|
- | 85 | ||
80 | if (x > 6000) |
86 | if (x > 6000) |
81 | { |
87 | { |
82 | y++; |
88 | ph += 200; |
83 | if (y > 100) |
89 | if(ph> 360*m.SINE_SCALING) |
- | 90 | ph-=360*m.SINE_SCALING; |
|
84 | y = 0; |
91 | |
85 | x = 500; |
92 | x = 500; |
86 | - | ||
87 | - | ||
88 | } |
93 | } |
89 | display.dim(false); |
94 | display.dim(false); |
90 | char buff1[10]; |
95 | char buff1[10]; |
91 | char buff2[10]; |
96 | char buff2[10]; |
92 | small_sprintf |
- | |
93 | (buff1,"x=%4d",x); |
97 | small_sprintf(buff1, "x=%4d", x); |
94 | small_sprintf |
- | |
95 | (buff2,"y=%4d",y); |
98 | small_sprintf(buff2, "y=%4d", y); |
96 | 99 | ||
97 | dispXY.plotPoint(x, y, "frogs",buff1,buff2); |
100 | dispXY.plotPoint(x, y, "frogs", buff1, buff2); |
98 | display.dim(true); |
101 | display.dim(true); |
99 | display.display(); |
102 | display.display(); |
100 | 103 | ||
101 | return 0; |
104 | return 0; |
102 | } |
105 | } |