comparison main.c @ 330:7ac6b8846eea

- some fixes for server code - don't turn off bluetooth in avr code
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Jun 2012 22:32:49 +0800
parents 46070aaf29ea
children 2943f62c8e62
comparison
equal deleted inserted replaced
329:740438e21ea0 330:7ac6b8846eea
55 // fixed at 8, have a shorter name 55 // fixed at 8, have a shorter name
56 #define ID_LEN OW_ROMCODE_SIZE 56 #define ID_LEN OW_ROMCODE_SIZE
57 57
58 int uart_putchar(char c, FILE *stream); 58 int uart_putchar(char c, FILE *stream);
59 static void long_delay(int ms); 59 static void long_delay(int ms);
60 static void blink();
60 61
61 static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, 62 static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
62 _FDEV_SETUP_WRITE); 63 _FDEV_SETUP_WRITE);
63 64
64 uint16_t crc_out; 65 uint16_t crc_out;
136 { 137 {
137 PORT_SHDN &= ~_BV(PIN_SHDN); 138 PORT_SHDN &= ~_BV(PIN_SHDN);
138 } 139 }
139 else 140 else
140 { 141 {
141 PORT_SHDN |= _BV(PIN_SHDN); 142 //PORT_SHDN |= _BV(PIN_SHDN);
142 } 143 }
143 } 144 }
144 145
145 static void 146 static void
146 setup_tick_counter() 147 setup_tick_counter()
179 } 180 }
180 181
181 static void 182 static void
182 uart_off() 183 uart_off()
183 { 184 {
185 #if 0
184 // Turn of interrupts and disable tx/rx 186 // Turn of interrupts and disable tx/rx
185 UCSR0B = 0; 187 UCSR0B = 0;
186 188
187 // Power reduction register 189 // Power reduction register
188 //PRR |= _BV(PRUSART0); 190 //PRR |= _BV(PRUSART0);
191 #endif
189 } 192 }
190 193
191 int 194 int
192 uart_putchar(char c, FILE *stream) 195 uart_putchar(char c, FILE *stream)
193 { 196 {
461 } 464 }
462 465
463 ISR(INT0_vect) 466 ISR(INT0_vect)
464 { 467 {
465 need_comms = 1; 468 need_comms = 1;
469 blink();
470 _delay_ms(100);
471 blink();
472 _delay_ms(100);
473 blink();
474 _delay_ms(100);
475 blink();
476 _delay_ms(100);
477 blink();
478 _delay_ms(100);
479 blink();
480 _delay_ms(100);
481 blink();
482 _delay_ms(100);
466 } 483 }
467 484
468 485
469 ISR(USART_RX_vect) 486 ISR(USART_RX_vect)
470 { 487 {
650 667
651 static void 668 static void
652 do_comms() 669 do_comms()
653 { 670 {
654 // turn on bluetooth 671 // turn on bluetooth
672 set_aux_power(1);
655 uart_on(); 673 uart_on();
656 674
657 // write sd card here? same 3.3v regulator... 675 // write sd card here? same 3.3v regulator...
658 676
659 printf("ready> \n"); 677 printf("ready> \n");