3 #include <util/delay.h>
5 //The DDRs of the led matrix outputs are set in the mux loop.
10 void swapBuffers(void){
11 uint8_t* tmp
= frameBuffer
;
12 frameBuffer
= secondFrameBuffer
;
13 secondFrameBuffer
= tmp
;
16 void setLED(int num
, int val
){
18 frameBuffer
[num
>>3] &= ~(1<<(num
&7));
20 frameBuffer
[num
>>3] |= 1<<(num
&7);
25 uint8_t row
= 2; //selects the currently active "row" of the matrix. On the protoboards I make, this actually corresponds to physical traces.
26 for(int i
=0; i
<7; i
++){
27 uint8_t DDRQ
= frameBuffer
[i
];
32 led_output_stuff1(Q
, DDRQ
);
37 //this scary construct is in place to make the compiler happy. if you know a better way, feel free to improve.
38 uint8_t _frameBuffer
[] = {0,0,0,0,0,0,0};
39 uint8_t _secondFrameBuffer
[] = {0,0,0,0,0,0,0};
40 uint8_t* frameBuffer
= _frameBuffer
;
41 uint8_t* secondFrameBuffer
= _secondFrameBuffer
;
43 #else//HAS_LED_SUPPORT
47 #endif//HAS_LED_SUPPORT