Mercurial > hg > beaglert
comparison examples/7segment/render.cpp @ 308:1feb9c23ac57 prerelease
Renamed read/write functions to remove the Frame --> e.g. analogWriteFrameOnce -> analogWriteOnce, digitalReadFrame -> digitalRead
author | andrewm |
---|---|
date | Fri, 27 May 2016 18:21:21 +0100 |
parents | e4392164b458 |
children | 02c4ca0e3718 |
comparison
equal
deleted
inserted
replaced
307:ff5f346a293e | 308:1feb9c23ac57 |
---|---|
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; |