Mercurial > nyan
changeset 9:393915e97bb1 tiny13 tiny10
ATtiny13 code
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Thu, 01 Dec 2016 15:51:42 +0100 |
| parents | 49a2ab305115 |
| children | bdc31489aa88 184193daf9aa a24c832d292a |
| files | main/Makefile main/main.c |
| diffstat | 2 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/main/Makefile Sat Nov 26 18:58:15 2016 +0100 +++ b/main/Makefile Thu Dec 01 15:51:42 2016 +0100 @@ -1,5 +1,5 @@ DEVICE = attiny85 -CLOCK = 8000000 +CLOCK = 1000000 PROGRAMMER = -c usbasp OBJECTS = main.o
--- a/main/main.c Sat Nov 26 18:58:15 2016 +0100 +++ b/main/main.c Thu Dec 01 15:51:42 2016 +0100 @@ -38,28 +38,29 @@ byte raw; } note; - while (length--) { + while (length --> 0) { note.raw = pgm_read_byte_near(notes++); if (note.note.octave) { - TCCR1 |= (8 - note.note.octave); - OCR1C = pgm_read_byte_near(FREQ + note.note.tone); + TCCR0B = 2; + OCR0A = pgm_read_byte_near(FREQ + note.note.tone) >> (note.note.octave - 1); } if (note.note.length) { _delay_ms(220); - TCCR1 = 1<<CTC1; + TCCR0B = 0; _delay_ms(30); } else { _delay_ms(110); - TCCR1 = 1<<CTC1; + TCCR0B = 0; _delay_ms(15); } - PORTB ^= 1<<3; + PORTB ^= 1<<3 | 1<<4; } } int main() { - DDRB = 1<<4 | 1<<3; - GTCCR |= 1<<COM1B0; + DDRB = 1<<0 | 1<<3 | 1<<4; + TCCR0A |= 1<<COM0A0 | 1<<WGM01; + PORTB ^= 1<<4; play(INTRO_NOTES, 26); while(1) { play(MELODY_NOTES, 216);
