AVR baud rates are good, but the values are hackish.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sun, 17 Apr 2011 22:23:46 +0000 (22:23 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sun, 17 Apr 2011 22:23:46 +0000 (22:23 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@998 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/apps/monitor/monitor.c
firmware/lib/arduino.c
firmware/lib/atmega168.c

index 73aa61c..701de9e 100644 (file)
@@ -146,9 +146,11 @@ void monitor_handle_fn(uint8_t const app,
                break;
 
        case MONITOR_CONNECTED:
-               msp430_init_dco_done();
-               txdata(app,verb,0);
-               break;
+         #ifdef MSP430
+         msp430_init_dco_done();
+         #endif
+         txdata(app,verb,0);
+         break;
        }
 }
 
index 503492c..698aa9e 100644 (file)
@@ -13,20 +13,7 @@ void arduino_init(){
   /* set PORTB for output*/
   DDRB = 0xFF;
   
-  /*
-  while (1)
-    {
-    //LED on
-      PORTB = 0x20;
-
-      _delay_ms(1000);
-
-      //LED off
-      PORTB = 0x00;
-
-      _delay_ms(1000);
-    }
-*/
+  avr_init_uart0();
 }
 
 #endif
index 1ed8840..c6516ea 100644 (file)
@@ -51,15 +51,14 @@ void setbaud0(unsigned char rate){
     break;
   }
   
-  uint16_t bittimer=( F_CPU / SPEED / 16 ) - 1;
-  UBRR0H = (unsigned char) (bittimer >> 8);
-  UBRR0L = (unsigned char) bittimer;
+#define F_CPU 16000000L
+#define BAUD 230400L
+#include <util/setbaud.h>
+  UBRR0H = UBRRH_VALUE;
+  UBRR0L = UBRRL_VALUE;
   
-  
-  /* set the framing to 8N1 */
-  UCSR0C = (3 << UCSZ00);
-  /* Engage! */
-  UCSR0B = (1 << RXEN0) | (1 << TXEN0);
+  UCSR0C = _BV(UCSZ01) | _BV(UCSZ00);
+  UCSR0B = _BV(RXEN0) | _BV(TXEN0);
   return;
   
 }
@@ -88,22 +87,13 @@ void setbaud1(unsigned char rate){
 }
 
 
-void msp430_init_uart0(){
-}
-
-
-void msp430_init_uart1(){
+void avr_init_uart0(){
+  setbaud0(0);
 }
 
 
-
-//! Initialization is correct.
-void msp430_init_dco_done(){
-  //Nothing to do for the AVR w/ xtal.
+void avr_init_uart1(){
 }
 
 
-void msp430_init_dco() {
-  //
-}