comparison examples/7segment/render.cpp @ 314:611306d840b3 prerelease

Merge
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 19:00:43 +0100
parents 02c4ca0e3718
children 9dc5a0ccad25
comparison
equal deleted inserted replaced
313:c770cdf3d8b2 314:611306d840b3
56 rt_printf("Error: this project needs the audio and digital sample rates to be the same.\n"); 56 rt_printf("Error: this project needs the audio and digital sample rates to be the same.\n");
57 return false; 57 return false;
58 } 58 }
59 59
60 for(int i = 0; i < NUM_PINS; i++) { 60 for(int i = 0; i < NUM_PINS; i++) {
61 pinModeFrame(context, 0, kPins[i], OUTPUT); 61 pinMode(context, 0, kPins[i], OUTPUT);
62 } 62 }
63 63
64 return true; 64 return true;
65 } 65 }
66 66
78 gDigitDisplayTime = kDigitMaxDisplayTime; 78 gDigitDisplayTime = kDigitMaxDisplayTime;
79 } 79 }
80 80
81 // Write the currently displaying digit low and the rest high 81 // Write the currently displaying digit low and the rest high
82 for(int i = 0; i < 4; i++) 82 for(int i = 0; i < 4; i++)
83 digitalWriteFrameOnce(context, n, kPins[kDigits[i]], HIGH); 83 digitalWriteOnce(context, n, kPins[kDigits[i]], HIGH);
84 digitalWriteFrameOnce(context, n, kPins[kDigits[gCurrentlyDisplayingDigit]], LOW); 84 digitalWriteOnce(context, n, kPins[kDigits[gCurrentlyDisplayingDigit]], LOW);
85 85
86 // Write the digit to the other outputs 86 // Write the digit to the other outputs
87 digitalWriteFrameOnce(context, n, kPins[11], 87 digitalWriteOnce(context, n, kPins[11],
88 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x01); // a 88 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x01); // a
89 digitalWriteFrameOnce(context, n, kPins[6], 89 digitalWriteOnce(context, n, kPins[6],
90 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x02); // b 90 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x02); // b
91 digitalWriteFrameOnce(context, n, kPins[4], 91 digitalWriteOnce(context, n, kPins[4],
92 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x04); // c 92 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x04); // c
93 digitalWriteFrameOnce(context, n, kPins[1], 93 digitalWriteOnce(context, n, kPins[1],
94 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x08); // d 94 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x08); // d
95 digitalWriteFrameOnce(context, n, kPins[0], 95 digitalWriteOnce(context, n, kPins[0],
96 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x10); // e 96 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x10); // e
97 digitalWriteFrameOnce(context, n, kPins[10], 97 digitalWriteOnce(context, n, kPins[10],
98 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x20); // f 98 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x20); // f
99 digitalWriteFrameOnce(context, n, kPins[5], 99 digitalWriteOnce(context, n, kPins[5],
100 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x40); // g 100 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x40); // g
101 digitalWriteFrameOnce(context, n, kPins[2], 101 digitalWriteOnce(context, n, kPins[2],
102 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x80); // . 102 gCharacterToDisplay[gCurrentlyDisplayingDigit] & 0x80); // .
103 103
104 // Check for changing state 104 // Check for changing state
105 if(--gStateCounter <= 0) { 105 if(--gStateCounter <= 0) {
106 gState = (gState + 1) % kMaxState; 106 gState = (gState + 1) % kMaxState;