Changeset f51aacc in avrstuff
- Timestamp:
- Jul 29, 2014, 7:58:35 PM (10 years ago)
- Branches:
- main
- Children:
- 0db7c37
- Parents:
- b83dc2a
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kbd/common.mk
rb83dc2a rf51aacc 7 7 LIBS=../../../libs 8 8 9 # Generic pattern-rules9 # Generic rules 10 10 %.hex: %.bin 11 11 $(OBJCOPY) -j .text -j .data -O ihex $^ $@ 12 12 13 clean: 14 rm *.bin *.o *.hex -
test_2313_muserial/Makefile
rb83dc2a rf51aacc 1 #Set vars 1 # K4KUSB 2 F_CPU=12000000 3 4 # muSerial 5 # F_CPU=20000000 6 7 # Common 2 8 MCU=attiny2313 3 COMPILE = avr-gcc -Wall -Os -std=c99 -mmcu=$(MCU) -DF_CPU=20000000 9 10 all: blinkdel.hex 11 12 include ../kbd/common.mk 13 14 COMPILE = $(CC) -Wall -Os -std=c99 -mmcu=$(MCU) -DF_CPU=$(F_CPU) 4 15 5 16 #Rules 6 blinkdel.hex: blinkdel.bin7 avr-objcopy -j .text -j .data -O ihex blinkdel.bin blinkdel.hex8 17 9 18 blinkdel.bin: main.o … … 23 32 avrdude -c usbasp -p $(MCU) -Uflash:w:blinkdel.hex 24 33 25 clean:26 rm *.bin *.o *.hex -
test_2313_muserial/main.c
rb83dc2a rf51aacc 8 8 #include <stdbool.h> 9 9 10 // muSerial: ATTiny2313 - LED = PD6 11 // K4KUSB: ATTiny2313 - LED = PB2 12 #define DDRLED DDRB 13 #define PORTLED PORTB 14 #define LEDBIT 1 << PB2 15 10 16 int main() { 11 17 wdt_enable(WDTO_2S); … … 15 21 16 22 //debug LED - output 17 DDR D |= 255;23 DDRLED |= 255; 18 24 19 PORT D = 0;25 PORTLED = 0; 20 26 21 27 // Serial PORT … … 24 30 25 31 UCSRB = (1<<RXEN) |(1<<TXEN); 26 UCSRC = (1 << UCSZ1) | (1 << UCSZ0); 32 UCSRC = (1 << UCSZ1) | (1 << UCSZ0); 27 33 28 34 while(1) { … … 33 39 if (TIFR & (1 << TOV0)) { 34 40 TIFR = (1 << TOV0); // reset flag 35 PORT D ^= (1<<PD6);41 PORTLED ^= LEDBIT; 36 42 37 43 UDR = 'H';
Note:
See TracChangeset
for help on using the changeset viewer.