This is a two part question. First, when I declare Serial pc(USBTX, USBRX), does the USB-Serial port also become stdout? I am starting to work with BlueUSB to learn (hopefully) how to receive data from a USB keyboard. In the process I find many uses of printf in the BlueUSB code that indeed result in output to the USBRX port.
The second part: In the BlueUSB code I find something that I am guessing is "overloading" of printf:
00036 void printf(const BD_ADDR* addr)
00037 {
00038 const u8* a = addr->addr;
00039 printf("%02X:%02X:%02X:%02X:%02X:%02X",a[5],a[4],a[3],a[2],a[1],a[0]);
00040 }
I am completely new to any uses of C++, so this caught me completely off guard. My guess now is that the compiler finds the printf function seen above in the BlueUSB source and magically figures out that it is an overloaded use of printf and that the call to printf inside the function is then taken by the compiler to be from the cstdio library (or where ever it comes from)?
I will appreciate any guidance related to these topics.
Thanks,
Chuck
This is a two part question. First, when I declare Serial pc(USBTX, USBRX), does the USB-Serial port also become stdout? I am starting to work with BlueUSB to learn (hopefully) how to receive data from a USB keyboard. In the process I find many uses of printf in the BlueUSB code that indeed result in output to the USBRX port.
The second part: In the BlueUSB code I find something that I am guessing is "overloading" of printf:
00036 void printf(const BD_ADDR* addr)
00037 {
00038 const u8* a = addr->addr;
00039 printf("%02X:%02X:%02X:%02X:%02X:%02X",a[5],a[4],a[3],a[2],a[1],a[0]);
00040 }
I am completely new to any uses of C++, so this caught me completely off guard. My guess now is that the compiler finds the printf function seen above in the BlueUSB source and magically figures out that it is an overloaded use of printf and that the call to printf inside the function is then taken by the compiler to be from the cstdio library (or where ever it comes from)?
I will appreciate any guidance related to these topics.
Thanks,
Chuck