summaryrefslogtreecommitdiffstats
path: root/sw-avr/rom-loader/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sw-avr/rom-loader/main.c')
-rw-r--r--sw-avr/rom-loader/main.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/sw-avr/rom-loader/main.c b/sw-avr/rom-loader/main.c
index b178c06..784afb6 100644
--- a/sw-avr/rom-loader/main.c
+++ b/sw-avr/rom-loader/main.c
@@ -1,6 +1,38 @@
#include <avr/io.h>
+#include "usart.h"
+#include "pinmap.h"
+
+// TODO: remove
+#include <util/delay.h>
+
+
+inline void io_init(void)
+{
+ ADDRL_DDR |= (_BV(ADDRL_bitE) | _BV(ADDRL_bitD));
+ ADDRL_DDR |= (0x7<<ADDRL_bitA0); // 3 bits
+
+ ADDRH_DDR |= (_BV(ADDRH_bitE) | _BV(ADDRH_bitD));
+ ADDRH_DDR |= (0x7<<ADDRH_bitA0);
+
+ // all output
+ DATA_DDR = 0xFF;
+}
+
int main(void)
{
- return;
+ io_init();
+ usart_init();
+
+ // TODO: remove
+ DATA_PORT |= _BV(1);
+
+ while (1) {
+ DATA_PORT ^= _BV(1);
+ _delay_ms(500);
+
+ usart_send('c');
+ }
+
+ return 0;
}