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.
Road.cpp
00001 #include "Road.h" 00002 00003 Serial pc_road(USBTX, USBRX); 00004 00005 Road::Road(Communication* c) { 00006 active_cars = 0x00; 00007 comm = c; 00008 n = 1; 00009 } 00010 00011 void Road::add_car(Car* car) { 00012 // this->car1 = car; 00013 00014 active_cars = active_cars | car->flag; 00015 } 00016 00017 void Road::add_acc_car(AccCar* car, int id) { 00018 active_cars = active_cars | car->flag; 00019 00020 switch(id) { 00021 case 1: { 00022 this->car1 = car; 00023 break; 00024 } 00025 case 2: { 00026 this->car2 = car; 00027 break; 00028 } 00029 case 3: { 00030 this->car3 = car; 00031 break; 00032 } 00033 case 4: { 00034 this->car4 = car; 00035 break; 00036 } 00037 case 5: { 00038 this->car5 = car; 00039 break; 00040 } 00041 } 00042 } 00043 00044 void Road::let_cars_update() { 00045 go_flags.set(active_cars); 00046 } 00047 00048 void Road::wait_for_car_update() { 00049 done_flags.wait_all(active_cars); 00050 comm->publish_road(n); 00051 Communication::sync_flags.wait_all(0x01); 00052 n = Communication::sync; 00053 pc_road.printf("Update number %d\r\n", n); 00054 }
Generated on Fri Jul 22 2022 13:26:47 by
1.7.2