Loading include/msp430fr5969lp/driver/uptime.h +8 −2 Original line number Diff line number Diff line Loading @@ -7,12 +7,18 @@ class Uptime { private: Uptime(const Uptime ©); #ifdef TIMER_S uint16_t seconds; #endif public: Uptime () {} Uptime () : seconds(0) {} inline uint16_t get_us() { return TA0R; } inline uint16_t get_s() { return 0; } inline uint16_t get_cycles() { return TA2R; } #ifdef TIMER_S inline uint16_t get_s() { return seconds; } inline void tick_s() { seconds++; } #endif }; extern Uptime uptime; Loading src/app/ledblink/main.cc +12 −5 Original line number Diff line number Diff line Loading @@ -3,6 +3,13 @@ #include "driver/stdout.h" #include "driver/uptime.h" #ifndef TIMER_CYCLES #error makeflag timer_cycles=1 required #endif #ifndef TIMER_S #error makeflag timer_s=1 required #endif /* void check_command(unsigned char argc, char** argv) { Loading Loading @@ -89,7 +96,7 @@ void check_command(unsigned char argc, char** argv) void loop(void) { gpio.led_toggle(1); kout << dec << uptime.get() << endl; kout << dec << uptime.get_s() << endl; } int main(void) Loading @@ -101,10 +108,10 @@ int main(void) gpio.led_on(0); kout << "Hello, World!" << endl; kout << "Test, World!" << endl; kout << dec << uptime.get() << endl; kout << dec << uptime.get() << endl; kout << dec << uptime.get() << endl; kout << dec << uptime.get() << endl; kout << dec << uptime.get_cycles() << endl; kout << dec << uptime.get_cycles() << endl; kout << dec << uptime.get_cycles() << endl; kout << dec << uptime.get_cycles() << endl; arch.idle_loop(); Loading Loading
include/msp430fr5969lp/driver/uptime.h +8 −2 Original line number Diff line number Diff line Loading @@ -7,12 +7,18 @@ class Uptime { private: Uptime(const Uptime ©); #ifdef TIMER_S uint16_t seconds; #endif public: Uptime () {} Uptime () : seconds(0) {} inline uint16_t get_us() { return TA0R; } inline uint16_t get_s() { return 0; } inline uint16_t get_cycles() { return TA2R; } #ifdef TIMER_S inline uint16_t get_s() { return seconds; } inline void tick_s() { seconds++; } #endif }; extern Uptime uptime; Loading
src/app/ledblink/main.cc +12 −5 Original line number Diff line number Diff line Loading @@ -3,6 +3,13 @@ #include "driver/stdout.h" #include "driver/uptime.h" #ifndef TIMER_CYCLES #error makeflag timer_cycles=1 required #endif #ifndef TIMER_S #error makeflag timer_s=1 required #endif /* void check_command(unsigned char argc, char** argv) { Loading Loading @@ -89,7 +96,7 @@ void check_command(unsigned char argc, char** argv) void loop(void) { gpio.led_toggle(1); kout << dec << uptime.get() << endl; kout << dec << uptime.get_s() << endl; } int main(void) Loading @@ -101,10 +108,10 @@ int main(void) gpio.led_on(0); kout << "Hello, World!" << endl; kout << "Test, World!" << endl; kout << dec << uptime.get() << endl; kout << dec << uptime.get() << endl; kout << dec << uptime.get() << endl; kout << dec << uptime.get() << endl; kout << dec << uptime.get_cycles() << endl; kout << dec << uptime.get_cycles() << endl; kout << dec << uptime.get_cycles() << endl; kout << dec << uptime.get_cycles() << endl; arch.idle_loop(); Loading