summaryrefslogtreecommitdiffstats
path: root/sw-avr/rom-loader/main.c
blob: 784afb6dbba1c79a1f9a79b7afc96b60c7fc298f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)
{
    io_init();
    usart_init();

    // TODO: remove
    DATA_PORT |= _BV(1);

    while (1) {
        DATA_PORT ^= _BV(1);
        _delay_ms(500);

        usart_send('c');
    }

    return 0;
}