2011-10-05 21:03:53 +02:00
|
|
|
/*
|
|
|
|
* Test how to use uart stuff as an outside library. Redirects stdout
|
|
|
|
* to uart.
|
|
|
|
*
|
|
|
|
* Led at Arduino digital 13 (PORTB5). Cause we all love blinken leds!
|
|
|
|
*
|
|
|
|
* To compile and upload run: make clean; make; make program;
|
2011-10-09 00:43:30 +02:00
|
|
|
* Connect to serial with: screen /dev/tty.usbserial-* 9600
|
2011-10-05 21:03:53 +02:00
|
|
|
*
|
|
|
|
* Copyright 2011 Mika Tuupola
|
|
|
|
*
|
|
|
|
* Licensed under the MIT license:
|
|
|
|
* http://www.opensource.org/licenses/mit-license.php
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef F_CPU
|
|
|
|
#define F_CPU 16000000UL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//#include <stdlib.h>
|
|
|
|
#include <avr/io.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <util/delay.h>
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
#include "uart.h"
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
|
|
|
|
uart_init();
|
|
|
|
stdout = &uart_output;
|
|
|
|
stdin = &uart_input;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
/* Blink led by toggling state of PORTB5 (Arduino digital 13). */
|
|
|
|
PORTB ^= _BV(PORTB5);
|
|
|
|
|
|
|
|
puts("Hello world!");
|
|
|
|
|
|
|
|
_delay_ms(500);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|