diff options
author | Nao Pross <naopross@thearcway.org> | 2018-10-30 12:07:58 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-10-30 12:34:37 +0100 |
commit | cda16639cbf19d6eb5c11f05f1045e54b3fdaba9 (patch) | |
tree | 25227b76ae6dd50d5eddc30e4806af2003e70f54 /sw-avr/rom-loader/main.c | |
parent | Update gitignore (diff) | |
download | z80uPC-cda16639cbf19d6eb5c11f05f1045e54b3fdaba9.tar.gz z80uPC-cda16639cbf19d6eb5c11f05f1045e54b3fdaba9.zip |
[avr] Add test program for IO and basic usart
Diffstat (limited to '')
-rw-r--r-- | sw-avr/rom-loader/main.c | 34 |
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; } |