12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
-
- #include <stdlib.h>
- #include <stdint.h>
- #include <avr/io.h>
- #include <util/delay.h>
-
- #include "adc.h"
- #include "eq.h"
- #include "twislave.h"
-
- #ifndef F_CPU
- #define F_CPU 16000000L
- #endif
-
- void blinkStatus(void) {
- uint8_t i, mem[7] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
-
- PORTB |= (1 << PB2);
- PORTB &= ~(1 << PB1);
- eqLed(mem);
- _delay_ms(250);
- PORTB &= ~(1 << PB2);
- PORTB |= (1 << PB1);
- for (i = 0; i < 7; i++) {
- mem[i] = 0x00;
- }
- eqLed(mem);
- _delay_ms(250);
- }
-
- int main(void) {
- uint8_t *music;
-
- DDRB = 0x3F;
- DDRC = 0x0C;
- DDRD = 0xFF;
-
- twiInit(0x42);
- adcInit();
- equalizerInit();
-
- blinkStatus();
- blinkStatus();
-
- music = equalizerGet();
- twiSetDataToSend(music);
- free(music);
-
- while (1) {
- music = equalizerGet();
- if (twiDataWasSent()) {
- twiSetDataToSend(music);
- }
- eqLed(music);
- free(music);
-
-
- PORTB ^= (1 << PB1);
- _delay_ms(1);
-
- }
-
- return 0;
- }
|