WIP: somethings wrong.. #19
@ -5,6 +5,8 @@
|
|||||||
// to be implemented by bsp
|
// to be implemented by bsp
|
||||||
extern "C" void printChar(const char*);
|
extern "C" void printChar(const char*);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ServiceInterfaceBuffer::overflow(int c) {
|
int ServiceInterfaceBuffer::overflow(int c) {
|
||||||
// Handle output
|
// Handle output
|
||||||
putChars(pbase(), pptr());
|
putChars(pbase(), pptr());
|
||||||
@ -19,16 +21,18 @@ int ServiceInterfaceBuffer::overflow(int c) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// custom stdio.c library for at91sam9g20 chip which does not support unsigned long
|
||||||
|
// So I cast (unsigned int) on loggerTimes
|
||||||
int ServiceInterfaceBuffer::sync(void) {
|
int ServiceInterfaceBuffer::sync(void) {
|
||||||
if (this->isActive) {
|
if (this->isActive) {
|
||||||
Clock::TimeOfDay_t loggerTime;
|
Clock::TimeOfDay_t loggerTime;
|
||||||
Clock::getDateAndTime(&loggerTime);
|
Clock::getDateAndTime(&loggerTime);
|
||||||
char preamble[96] = { 0 };
|
char preamble[96] = { 0 };
|
||||||
sprintf(preamble, "%s: | %lu:%02lu:%02lu.%03lu | ",
|
sprintf(preamble, "%s: | %u:%02u:%02u.%03u | ",
|
||||||
this->log_message.c_str(), (unsigned long) loggerTime.hour,
|
this->log_message.c_str(), (unsigned int) loggerTime.hour,
|
||||||
(unsigned long) loggerTime.minute,
|
(unsigned int) loggerTime.minute,
|
||||||
(unsigned long) loggerTime.second,
|
(unsigned int) loggerTime.second,
|
||||||
(unsigned long) loggerTime.usecond /1000);
|
(unsigned int) loggerTime.usecond /1000);
|
||||||
// Write log_message and time
|
// Write log_message and time
|
||||||
this->putChars(preamble, preamble + sizeof(preamble));
|
this->putChars(preamble, preamble + sizeof(preamble));
|
||||||
// Handle output
|
// Handle output
|
||||||
|
Loading…
Reference in New Issue
Block a user