SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
SWCommon.h
- Committer:
- hazheng
- Date:
- 2017-04-09
- Revision:
- 62:bc5caf59fe39
- Parent:
- 57:0d8a155d511d
- Child:
- 94:32712e603a5f
File content as of revision 62:bc5caf59fe39:
#pragma once #ifndef SW_COMMON_H #define SW_COMMON_H #include "ArduUTFT.h" #include <mbed.h> #ifdef SW_DEBUG #define LOGI(...) char sw_common_buf_v87t790[100];\ sprintf(sw_common_buf_v87t790, __VA_ARGS__);\ ardu_utft_print(sw_common_buf_v87t790, 230, 100); #else #define LOGI(...) #endif class DebugCounter { public: DebugCounter(uint16_t maxCount, PinName pin) : m_output(DigitalOut(pin, 0)), m_maxCount(maxCount), m_counter(0) { } void Update() { ++m_counter; if(m_counter >= m_maxCount) { m_output.write(!(m_output.read())); m_counter = 0; } } private: DigitalOut m_output; const uint16_t m_maxCount; uint16_t m_counter; }; #endif //SW_COMMON_H