-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from hytech-racing/feature/tc_mux_simplification
send it
- Loading branch information
Showing
61 changed files
with
2,077 additions
and
2,722 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef __PRINTLOGGER_H__ | ||
#define __PRINTLOGGER_H__ | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
#ifdef ARDUINO | ||
#include <Arduino.h> | ||
#else | ||
#include <cstdarg> | ||
#include <stdio.h> | ||
#include <iostream> | ||
#endif | ||
|
||
#ifdef ARDUINO | ||
template <typename T> | ||
void logger_println(T out){ | ||
Serial.println(out); | ||
} | ||
#else | ||
template <typename T> | ||
void logger_println(T out){ | ||
std::cout << out<<std::endl; | ||
} | ||
#endif | ||
|
||
class RateLimitedLogger | ||
{ | ||
private: | ||
unsigned long last_out_time_; | ||
public: | ||
RateLimitedLogger() | ||
{ | ||
last_out_time_ = 0; | ||
} | ||
|
||
template <typename T> | ||
void log_out(T out, unsigned long current_millis, unsigned long period=100) { | ||
if((current_millis - last_out_time_) > period) | ||
{ | ||
logger_println<T>(out); | ||
last_out_time_ = current_millis; | ||
} | ||
} | ||
}; | ||
#endif // __PRINTLOGGER_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.