Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Servo mbed-rtos mbed
clock.cpp
00001 #include "car_config.hpp" 00002 #include "net.hpp" 00003 #include "can.hpp" 00004 #include "mbed.h" 00005 #include "rtos.h" 00006 00007 void init_clock() 00008 { 00009 set_time(0); 00010 } 00011 00012 void thread_clock (void const *args) 00013 { 00014 while(1) { 00015 //if a time update has been received 00016 if (can_cmd_time.flag == CAN_FLAG_RECEIVED) { 00017 //update time 00018 set_time(can_cmd_time.payload.msg.time); 00019 // time_t seconds = time(NULL); 00020 // printf("time: %s\r\n", ctime(&seconds)); 00021 //set the message as read 00022 can_cmd_time.flag = CAN_FLAG_EMPTY; 00023 } 00024 Thread::wait(CLOCK_THREAD_PERIOD); 00025 } 00026 }
Generated on Wed Aug 3 2022 13:20:54 by
1.7.2