From 09efa97593f2ba47cbc528b76172e877662ced49 Mon Sep 17 00:00:00 2001 From: Charles Lohr Date: Tue, 6 Dec 2016 00:19:44 -0500 Subject: Update with changes from livestream. --- tools/avr_codegen/Makefile | 8 ++++---- tools/avr_codegen/test.c | 23 ++++++++++++++--------- tools/avr_codegen/test.elf | Bin 6792 -> 9820 bytes tools/avr_codegen/test.hex | 32 +++++++++++++++++++++----------- 4 files changed, 39 insertions(+), 24 deletions(-) (limited to 'tools/avr_codegen') diff --git a/tools/avr_codegen/Makefile b/tools/avr_codegen/Makefile index e7b8673..2d3a17e 100644 --- a/tools/avr_codegen/Makefile +++ b/tools/avr_codegen/Makefile @@ -12,11 +12,11 @@ test.hex : test.elf avr-objcopy -j .text -j .data -O ihex test.elf test.hex avrdude -c usbtiny -p $(PROGPART) -V -U flash:w:test.hex -test.elf : test.c - avr-gcc -I -g $(CFLAGS) -mmcu=$(PART) -Wl,-Map,test.map -o $@ test.c -L/usr/lib/binutils/avr/2.18 +test.elf : test.c avr_print.c + avr-gcc -I -g $(CFLAGS) -mmcu=$(PART) -Wl,-Map,test.map -o $@ test.c avr_print.c -L/usr/lib/binutils/avr/2.18 -test.lst : test.c - avr-gcc -c -g -Wa,-a,-ad $(CFLAGS) test.c > $@ +test.lst : test.c avr_print.c + avr-gcc -c -g -Wa,-a,-ad $(CFLAGS) test.c avr_print.c > $@ burn : test.hex avrdude -c usbtiny -p $(PROGPART) -V -U flash:w:test.hex diff --git a/tools/avr_codegen/test.c b/tools/avr_codegen/test.c index 2c875f1..0215e09 100644 --- a/tools/avr_codegen/test.c +++ b/tools/avr_codegen/test.c @@ -19,9 +19,7 @@ static void setup_clock( void ) CLKPR = 0x80; /*Setup CLKPCE to be receptive*/ CLKPR = 0x00; /*No scalar*/ - OSCCAL = 0x30; //B8 is bottom E8 is top. - - //This is gonna be about 1.8 MHz, turns out that's probably better than the 2MHz suggestion from the lighthouse-redox people. + OSCCAL = 0x42; //B8 is bottom E8 is top. } int main( ) @@ -30,6 +28,9 @@ int main( ) cli(); setup_clock(); DDRB = _BV(4) | _BV(3) | _BV(1); + +// setup_spi(); //XXX WARNING: If you use this, you can't use LED50 since it's on the SPI bus. + uint8_t marker; while(1) @@ -70,11 +71,14 @@ int main( ) #define DO_MARKER( time, LEDS ) \ marker = time; do { PORTB = LEDS; marker--; PORTB = 0; } while( marker ); - DO_MARKER( 22, LED40 ); - DO_MARKER( 22, LED50|LED40 ); - DO_MARKER( 22, LED50 ); - - + DO_MARKER(20, LED40); + DO_MARKER(35, LED50|LED40); + DO_MARKER(25, LED50); + DO_MARKER(45, LED50|LED48); + DO_MARKER(60, LED50); + +// sendhex2( 5 ); +// sendchr('\n'); /* marker = 30; do{ @@ -133,7 +137,8 @@ int main( ) //_delay_us(1000000/60); - _delay_ms(10); + //_delay_ms(10); //actually 5.3ms + _delay_ms(32); } return 0; diff --git a/tools/avr_codegen/test.elf b/tools/avr_codegen/test.elf index 3ebb44e..f9fd72e 100755 Binary files a/tools/avr_codegen/test.elf and b/tools/avr_codegen/test.elf differ diff --git a/tools/avr_codegen/test.hex b/tools/avr_codegen/test.hex index eda91aa..1d0610e 100644 --- a/tools/avr_codegen/test.hex +++ b/tools/avr_codegen/test.hex @@ -1,12 +1,22 @@ -:100000000EC015C014C013C012C011C010C00FC064 -:100010000EC00DC00CC00BC00AC009C008C011241E -:100020001FBECFE5D2E0DEBFCDBF1AD03AC0E8CFC9 -:100030000F931F9300E010E0980106171707280799 -:10004000390759F0EFECF7E03197F1F700C0000005 -:100050000F5F1F4F2F4F3F4FF0CF1F910F9108950C -:10006000F89480E886BD16BC80E381BF8AE187BB37 -:1000700090E122E132E086E198BB18BA8150E1F7C5 -:1000800086E128BB18BA8150E1F786E138BB18BA7F -:100090008150E1F7EFE1FEE43197F1F700C0000095 -:0600A000EACFF894FFCF47 +:100000000EC028C027C026C025C024C023C022C0DF +:1000100021C020C01FC01EC01DC01CC01BC0112499 +:100020001FBECFE5D2E0DEBFCDBF10E0A0E6B0E05E +:10003000ECE3F1E002C005900D92AE36B107D9F7BE +:1000400020E0AEE6B0E001C01D92A437B207E1F7B0 +:1000500047D072C0D5CF0F931F9300E010E09801F6 +:10006000061717072807390759F0EFECF7E0319723 +:10007000F1F700C000000F5F1F4F2F4F3F4FF0CF31 +:100080001F910F910895769BFECF8FB980E48EB9B2 +:100090000895F9DF80E090E008958A3010F4805DE3 +:1000A00001C0895CF0CFCF93C82F82958F70F5DFA8 +:1000B0008C2F8F70CF91F1CFCF93C82F892FF3DF83 +:1000C0008C2FCF91F0CF87B38A7F87BBB99A88E115 +:1000D0008DB980E690E09093710080937000089550 +:1000E000F89480E886BD16BC82E481BF8AE187BBB4 +:1000F00020E132E192E04AE084E128BB18BA815065 +:10010000E1F783E238BB18BA8150E1F789E198BB87 +:1001100018BA8150E1F78DE248BB18BA8150E1F777 +:100120008CE398BB18BA8150E1F7EFEFF9EF319704 +:0C013000F1F700C00000E0CFF894FFCF12 +:0E013C0000000002000000004900000000006A :00000001FF -- cgit v1.2.3