aboutsummaryrefslogtreecommitdiff
path: root/tools/avr_codegen/test.c
diff options
context:
space:
mode:
authorCharles Lohr <lohr85@gmail.com>2016-12-05 21:27:57 -0500
committerCharles Lohr <lohr85@gmail.com>2016-12-05 21:27:57 -0500
commit110e71c2334950b0fcdd2f90bff595f55390666d (patch)
treea77dfa7cb83f13246218ef00c99def0638245269 /tools/avr_codegen/test.c
parentced3b89795a5d3698da27749339670bd4da121c7 (diff)
downloadlibsurvive-110e71c2334950b0fcdd2f90bff595f55390666d.tar.gz
libsurvive-110e71c2334950b0fcdd2f90bff595f55390666d.tar.bz2
Update with changes from livestream.
Diffstat (limited to 'tools/avr_codegen/test.c')
-rw-r--r--tools/avr_codegen/test.c57
1 files changed, 25 insertions, 32 deletions
diff --git a/tools/avr_codegen/test.c b/tools/avr_codegen/test.c
index 24b9066..2c875f1 100644
--- a/tools/avr_codegen/test.c
+++ b/tools/avr_codegen/test.c
@@ -26,6 +26,7 @@ static void setup_clock( void )
int main( )
{
+ int k;
cli();
setup_clock();
DDRB = _BV(4) | _BV(3) | _BV(1);
@@ -50,38 +51,30 @@ int main( )
// 14 = 0x95 0x01
// 15 = 0xa1 0x01
//0x10 = 0xab 0x01
- marker = 30;
- do{
- PORTB = _BV(3); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- marker = 30;
-/* do{
- PORTB = _BV(3)|_BV(1); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- marker = 30;
- do{
- PORTB = _BV(3); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- marker = 30;
- do{
- PORTB = _BV(3)|_BV(4); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- marker = 30;
- do{
- PORTB = _BV(3); //4 = 0x40 3 = 0x48 1 = 0x50
- marker--;
- PORTB = 0;
- } while( marker );
- _delay_us(80);
-*/
+
+ // 0x81 0x04
+ // <- <-
+
+ // First look at 0x04. There will be another byte because it is less than
+ // 128!
+ // 0x04<<7 = 0x200
+ // Because 0x81 is >= 128, it's a terminator.
+ // 0x200 | 0x81 = 0x281 << The actual value
+ //
+
+ // _BV(x) is a synonym for (1<<x)
+ #define LED48 _BV(3)
+ #define LED40 _BV(4)
+ #define LED50 _BV(1)
+ //Marker = Length of time for following
+
+ #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 );
+
+
/*
marker = 30;
do{