Skip to content

Commit e59fd74

Browse files
committed
Prepare for release
1 parent e4843bf commit e59fd74

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

main.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,37 @@
1919
// Demo code to check if selected baud rate works on device
2020
int main(void)
2121
{
22+
// disable the default div8 prescaler
23+
CLKPR = 1<<CLKPCE;
24+
CLKPR = 0b0000<<CLKPS0;
25+
2226
// initializes IO
2327
tinyuart_init();
2428
_delay_us(10);
29+
// interrupts must be disabled while using the send function
30+
// cli();
31+
2532
// toggle pattern test: after every bit delay the TX pin is toggled
26-
tinyuart_send_uint8(0b01010101);
33+
tinyuart_send_uint8(0b01010101); // = 0x55
2734
_delay_us(10);
2835

2936
// every character test: verify that your receiver can read all chars at the chosen baud rate
3037
// cheap UART-USB converts often have an issue with 0x00
3138
for (uint16_t n = 0; n<256; n++)
3239
{
33-
tinyuart_send_uint8((uint8_t)(255-n));
40+
tinyuart_send_uint8((uint8_t)(n));
3441
_delay_us(10);
3542
}
3643

3744
// Test 0x00 to catch any glitches
38-
while(1)
45+
for (uint8_t n = 0; n<64; n++)
3946
{
4047
tinyuart_send_uint8(0);
4148
_delay_us(1000);
42-
}
49+
}
50+
51+
// re-enable interrupts
52+
// sei();
53+
54+
while(1);
4355
}

0 commit comments

Comments
 (0)