Added test for number conversion

This commit is contained in:
BlackMark 2019-08-03 17:33:05 +02:00
parent dafb7ee059
commit 2ba032c103
2 changed files with 20 additions and 2 deletions

View File

@ -57,7 +57,7 @@ void newUartUsage2()
void newUartStreamOverloads() void newUartStreamOverloads()
{ {
using namespace uart; using namespace uart;
Uart1<> serial; Uart1<Config<115200>> serial;
serial.init(); serial.init();
sei(); sei();
@ -90,6 +90,24 @@ void newUartStreamOverloads()
serial << F("unsigned long long : ") << ullVal << F("\r\n"); serial << F("unsigned long long : ") << ullVal << F("\r\n");
serial << F("const void : ") << &bVal << F("\r\n"); serial << F("const void : ") << &bVal << F("\r\n");
auto number = 0xBADF00D;
serial << F("Binary : 0b");
serial.txNumber<decltype(number), 2>(number);
serial << F("\r\n");
serial << F("Octal : 0");
serial.txNumber<decltype(number), 8>(number);
serial << F("\r\n");
serial << F("Decimal : ");
serial.txNumber<decltype(number), 10>(number);
serial << F("\r\n");
serial << F("Hex : 0x");
serial.txNumber<decltype(number), 16>(number);
serial << F("\r\n");
_delay_ms(1000); _delay_ms(1000);
} }

@ -1 +1 @@
Subproject commit 8d07e2d4db6f0fafebb00db7993b43b49aee30fc Subproject commit b6c1c3b51b44b3d7cb32e7f5f0222ecc155f8294