comparison main.c @ 18:bf733e8e8cf0

Add INT0 button
author Matt Johnston <matt@ucc.asn.au>
date Tue, 22 May 2012 21:27:50 +0800
parents 54b0fda9cba7
children f1016b151689
comparison
equal deleted inserted replaced
15:54b0fda9cba7 18:bf733e8e8cf0
89 }; 89 };
90 90
91 #define DEBUG(str) printf_P(PSTR(str)) 91 #define DEBUG(str) printf_P(PSTR(str))
92 92
93 static void deep_sleep(); 93 static void deep_sleep();
94
95 static void
96 chip_setup()
97 {
98 // INT0 setup
99 EIMSK = _BV(INT0);
100 // set pullup
101 PORTD |= _BV(PD2);
102 }
103
94 104
95 static void 105 static void
96 uart_on() 106 uart_on()
97 { 107 {
98 // Power reduction register 108 // Power reduction register
392 { 402 {
393 printf_P(PSTR("Bad command\n")); 403 printf_P(PSTR("Bad command\n"));
394 } 404 }
395 } 405 }
396 406
407 ISR(INT0_vwct)
408 {
409 need_comms = 1;
410 }
411
412
397 ISR(USART_RX_vect) 413 ISR(USART_RX_vect)
398 { 414 {
399 char c = UDR0; 415 char c = UDR0;
400 uart_putchar(c, NULL); 416 uart_putchar(c, NULL);
401 if (c == '\r') 417 if (c == '\r')