finish homework2
Revision 0:e8bedeeadd77, committed 2019-09-16
- Comitter:
- micallef25
- Date:
- Mon Sep 16 01:19:04 2019 +0000
- Commit message:
- fin homework 2;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Mon Sep 16 01:19:04 2019 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part1/Car.cpp Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,95 @@
+#include "Car.h"
+#include "signal_wrapper.h"
+
+//
+Car::Car(int id) {
+ this->id = id;
+
+ // Include any other necessary initialization
+ this->tick = 0;
+
+ thread = NULL; // Initialize thread to null, since the starting of the simulation is done in reset(-)
+}
+
+
+// gets new speed sets tick to 0
+void Car::new_speed()
+{
+ int temp_speed = 0;
+ // get a valid speed 5-15
+ while( temp_speed < 5 )
+ {
+ temp_speed = rand() %16;
+ }
+ this->speed = temp_speed;
+
+ this->tick = 0;
+}
+
+void Car::update_pos()
+{
+ // update speed every 5 ticks
+ if(this->tick == 5)
+ {
+ new_speed();
+ }
+
+ // update position based on speed
+ this->position += this->speed;
+ this->tick++;
+}
+
+void Car::update() {
+ while (true) {
+ // wait for the predefined cycle time
+ uint32_t flags = wait_for_signal( CAR_SIGNAL );
+
+ // update position of car
+ if( flags == CAR_SIGNAL )
+ {
+ update_pos();
+ }
+ // unknown signal
+ else
+ {
+ assert(0);
+ }
+
+
+ if(this->position >= ROADLENGTH)
+ {
+ // notify to end simulation and terminate yourself
+ simulation = 0;
+ send_signal( CAR_UPDATE_MAIN_SIGNAL );
+ thread->terminate();
+ }
+
+ // signal back saying update compete
+ send_signal( CAR_UPDATE_MAIN_SIGNAL );
+ }
+}
+
+
+int Car::is_simulating()
+{
+ return simulation;
+}
+
+void Car::reset(int speed) {
+ // handle any necessary coordination with main thread
+
+ // reset any other attributes that may be necessary
+ // ...
+ // ...
+
+ if (thread != NULL) { // Clear out the existing thread, if it exists, since we don't know how long it has waited for
+ delete thread;
+ }
+ thread = new Thread(); // Create a new thread for the car
+ thread->start( callback(this, &Car::update) ); // Start the thread with the car's update method
+
+ this->simulation = 1;
+ this->tick = 0;
+ this->position = 0;
+ this->speed = speed;
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part1/Car.h Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,49 @@
+#ifndef _CAR_H_
+#define _CAR_H_
+
+#include "mbed.h"
+
+
+// The road is 100 meters long
+#define ROADLENGTH 100
+
+// Update is running at 1000ms (1 second cycles)
+#define TICK 1000
+
+class Car {
+public:
+ int position; // Position, in meters, of the car
+ int speed; // Speed, in meters, of the car to be used to update the position next Update
+ int tick; // tick to show time passed 5 ticks is an update to speed
+
+ // Add any other needed public attributes
+ // ...
+ // ...
+
+ // Constructor for the Car class
+ // Modify as necessary to provide the Car object with
+ // access additional resources
+ Car(int id);
+
+ // Update the position and speed of the car in a 1 second loop
+ void update();
+
+ // Reset the position of the car to 0 and set the speed to the given speed
+ void reset(int speed);
+
+ //
+ int is_simulating();
+
+
+private:
+ int id; // Identifier so that we can distinguish between cars
+ Thread* thread; // Thread on which to run the car
+ int simulation;
+ void new_speed(void);
+ void update_pos();
+
+ // Add any other needed private attributes
+ // ...
+ // ...
+};
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part1/main.cpp Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,127 @@
+#include "mbed.h"
+#include <cctype>
+#include "Car.h"
+#include "TextLCD.h"
+#include "signal_wrapper.h"
+
+Serial pc(USBTX, USBRX); // The connection to USB
+TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2 ); // rs, e, d4-d7
+
+// define any needed global variables
+// ...
+// ...
+#define MAX_CAR_SPEED 15
+#define MIN_CAR_SPEED 5
+
+// This function present the "prompt" string to the user before accepting
+// an integer back from the Serial connection. If the user enters anything
+// other than a digit (e.g. return key, letters), the currently built number
+// is returned
+int read_int(char* prompt) {
+ int number = 0;
+
+ pc.printf(prompt);
+
+ char input;
+ while(1) {
+ input = pc.getc();
+ pc.putc(input);
+
+ if( std::isdigit(input) ) {
+ number = (number * 10) + (input-'0');
+ } else {
+ pc.putc(input);
+ break;
+ }
+ }
+
+ return number;
+}
+
+void handle_input(int* car_speed)
+{
+ int valid_reading = 0;
+ while( !valid_reading )
+ {
+ *car_speed = read_int("car_speed:");
+ if( *car_speed >= MIN_CAR_SPEED && *car_speed <= MAX_CAR_SPEED )
+ {
+ valid_reading = 1;
+ printf("\r\n");
+ }
+ else
+ {
+ printf("\r\n");
+ printf("invalid input ... range: %d -> %d\r\n", MIN_CAR_SPEED, MAX_CAR_SPEED);
+ }
+
+ }
+}
+
+// The main thread of the program. This runs the main program, accepting user
+// input, creating cars, displaying state of cars, and handling coordination that
+// may be needed. Timing statistics are also presented.
+int main()
+{
+ // ------------------------------------------------------------------------------
+ // The following three variables are used for timing statistics, do not modify them
+ Timer stopwatch; // A timer to keep track of how long the updates take, for statistics purposes
+ int numberCycles = 0;
+ int totalUpdateTime = 0;
+ // ------------------------------------------------------------------------------
+ // prepare screen for input
+ printf("\033[2J");
+ printf("\r\n");
+
+
+
+ Car car(0); // Create a car. This call will need to be modified with any additional parameters you add
+ stopwatch.start(); // Start out stats timer
+
+ while (true) { // Run the simulation indefinitely
+
+ int carspeed =0;
+ // Prompt the user for an initial speed and ensure it is valid
+ handle_input(&carspeed);
+ // Start the car / let the car know its initial speed
+ car.reset(carspeed);
+ lcd.cls();
+ // ----------------------------------------------------------------------
+ // Timing statistics logic, do not modify
+ stopwatch.reset();
+ // ----------------------------------------------------------------------
+
+ do { // Run the simulation until the car exits the road
+;
+ // wait some time before sending signal
+ while(stopwatch.read_ms() < TICK)
+ {
+ // do nothing I guess
+ }
+
+ //signal car it can update
+ send_signal( CAR_SIGNAL );
+
+ // wait for car to update
+ wait_for_signal( CAR_UPDATE_MAIN_SIGNAL );
+
+ // ------------------------------------------------------------------
+ // Timing statistics logic, do not modify
+ totalUpdateTime += stopwatch.read_ms();
+ numberCycles++;
+ stopwatch.reset();
+ // ------------------------------------------------------------------
+ lcd.cls();
+ // Display the state of the car to the LCD
+ lcd.printf( "%d -> %d \n",car.speed,car.position );
+
+ } while (car.is_simulating()); // Modify this condition to stop the simulation when the car exits the road
+ // ----------------------------------------------------------------------
+ // Timing statistics printout, do not modify
+ pc.printf("Resetting...\r\n");
+ pc.printf("Average update cycle took: %fms \r\n", (totalUpdateTime*1.0)/(numberCycles*1.0));
+ totalUpdateTime = 0;
+ numberCycles = 0;
+ // ----------------------------------------------------------------------
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part1/signal_wrapper.cpp Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,14 @@
+#include "mbed.h"
+#include <cctype>
+
+EventFlags event_flags;
+
+uint32_t send_signal( uint32_t flags )
+{
+ return event_flags.set( flags );
+}
+
+uint32_t wait_for_signal( uint32_t flags )
+{
+ return event_flags.wait_any( flags );
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HW2_skeleton/HW2_skeleton/Part1/signal_wrapper.h Mon Sep 16 01:19:04 2019 +0000 @@ -0,0 +1,25 @@ +#ifndef _SIG_H_ +#define _SIG_H_ + +#include "mbed.h" +#include <cctype> + +#define ACC_BIT 0 +#define CAR_BIT 1 +#define ACC_UPDATE_BIT 2 +#define CAR_UPDATE_BIT 3 +#define SIG_TERM_BIT 4 + +#define ACC_SIGNAL (1 << ACC_BIT) +#define CAR_SIGNAL (1 << CAR_BIT) +#define ACC_UPDATE_MAIN_SIGNAL (1 << ACC_UPDATE_BIT) +#define CAR_UPDATE_MAIN_SIGNAL (1 << CAR_UPDATE_BIT) +#define SIG_TERM (1 << SIG_TERM_BIT) + + + +uint32_t send_signal( uint32_t flags ); +uint32_t wait_for_signal( uint32_t flags ); + + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part2/AccCar.cpp Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,114 @@
+//#include "AccCar.h"
+//#include "signal_wrapper.h"
+//
+//// Update is running at 1000ms (1 second cycles)
+//#define TICK 1000
+//
+//// Acc monitors 17 meters ahead
+//#define MONITOR_DIST 17
+//
+//// Acc maintains a safety gap of 2 meters
+//#define SAFETY_GAP 2
+//
+//
+//extern int car_position;
+//
+//AccCar::AccCar(int id) {
+// this->id = id;
+//
+// // Include any other necessary initialization
+// // ...
+// // ...
+//
+// thread = NULL; // Initialize thread to null, since the starting of the simulation is done in reset(-)
+//}
+//
+//int AccCar::acc_is_simulating()
+//{
+// return acc_simulation;
+//}
+//
+//void AccCar::update_pos()
+//{
+// // where should we be? in case we have already been adjusting our speed
+// int assigned_position = this->position+this->assigned_speed;
+//
+// int desired_speed;
+// int desired_position;
+//
+// if( assigned_position >= ( car_position - SAFETY_GAP ) )
+// {
+// // no we can not find the max speed we can go
+// // find the speed we can safely go this will ALWAYS be SAFETY_GAP or more in the negative direction
+// int speed_diff = car_position - (assigned_position + SAFETY_GAP);
+// assert(speed_diff <= SAFETY_GAP);
+// // set desired speed
+// desired_speed = speed_diff + this->assigned_speed;
+// // adjust our speed to not collide
+// desired_position = desired_speed + this->position;
+//
+// //printf(" adjusted max speed to not collide %d -> %d \r\n",desired_position,desired_speed);
+// }
+// // last condition saying we can go assigned speed
+// else if( assigned_position <= (car_position - SAFETY_GAP ) )
+// {
+// desired_position = this->assigned_speed + this->position;
+// desired_speed = this->assigned_speed;
+// //printf("max speed!!! %d -> %d \r\n",desired_position,desired_speed);
+// }
+// // crash, we should not enter
+// else
+// {
+// assert(0);
+// }
+//
+// this->position = desired_position;
+// this->speed = desired_speed;
+//}
+//
+//void AccCar::update() {
+// while (true) {
+//
+// // wait for the signal from the main thread to update
+// uint32_t flags = wait_for_signal( ACC_SIGNAL );
+// if( flags == ACC_SIGNAL )
+// {
+// update_pos();
+// }
+// else
+// {
+// assert(0);
+// }
+//
+// if(this->position >= ROADLENGTH)
+// {
+// // notify to end simulation and terminate yourself
+// acc_simulation = 0;
+// send_signal( ACC_UPDATE_MAIN_SIGNAL );
+// assert( thread->terminate() == MBED_SUCCESS );
+// }
+//
+// // return to car thread he will notify main
+// send_signal( ACC_UPDATE_MAIN_SIGNAL );
+// }
+//}
+//
+//void AccCar::reset(int speed) {
+// // handle any necessary coordination with main thread
+//
+// // reset any other attributes that may be necessary
+// // ...
+// // ...
+//
+// if (thread != NULL) { // Clear out the existing thread, if it exists, since we don't know how long it has waited for
+// delete thread;
+// }
+//
+// thread = new Thread(); // Create a new thread for the car
+// thread->start( callback(this, &AccCar::update) ); // Start the thread with the car's update method
+//
+// acc_simulation = 1;
+// this->position = 0;
+// this->speed = speed;
+// this->assigned_speed = speed;
+//}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part2/AccCar.h Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,44 @@
+//#ifndef _ACC_CAR_H_
+//#define _ACC_CAR_H_
+//
+//#include "mbed.h"
+//
+//// The road is 100 meters long
+//#define ROADLENGTH 100
+//
+//class AccCar {
+//public:
+// int position; // Position, in meters, of the car
+// int speed; // Speed, in meters, of the car to be used to update the position next Update
+//
+// // Add any other needed public attributes
+// // ...
+// // ...
+//
+//
+// // Constructor for the AccCar class
+// // Modify as necessary to provide the AccCar object with
+// // access additional resources (such as a reference to another car...)
+// AccCar(int id);
+//
+// // Update the position and speed of the car in a 1 second loop
+// void update();
+//
+// // Reset the position of the car to 0 and set the target speed to the given speed
+// void reset(int speed);
+//
+// int acc_is_simulating();
+//
+//private:
+// int id; // Identifier so that we can distinguish between cars
+// Thread* thread; // Thread on which to run the car
+// int assigned_speed; // The speed, in meters, the AccCar wants to go, if there are no obstacles
+// int acc_simulation;
+//
+// void update_pos();
+//
+// // Add any other needed private attributes
+// // ...
+// // ...
+//};
+//#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part2/Car.cpp Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,94 @@
+//#include "Car.h"
+//#include "signal_wrapper.h"
+//
+//int car_position;
+//extern int global_sim;
+////
+//Car::Car(int id) {
+// this->id = id;
+//
+// // Include any other necessary initialization
+// this->tick = 0;
+//
+// thread = NULL; // Initialize thread to null, since the starting of the simulation is done in reset(-)
+//}
+//
+//// gets new speed sets tick to 0
+//void Car::new_speed()
+//{
+// int temp_speed = 0;
+// // get a valid speed 5-15
+// while( temp_speed < 5 )
+// {
+// temp_speed = rand() %16;
+// }
+// this->speed = temp_speed;
+//
+// this->tick = 0;
+//}
+//
+//void Car::update_pos()
+//{
+// // update speed every 5 ticks
+// if(this->tick == 5)
+// {
+// new_speed();
+// }
+//
+// // update position based on speed
+// this->position += this->speed;
+// this->tick++;
+//
+// // globally shared between car and ACC
+// car_position = this->position;
+//}
+//
+//void Car::update() {
+// while (true) {
+// // wait for a signal from main thread
+// uint32_t flags = wait_for_signal( CAR_SIGNAL | SIG_TERM );
+//
+// if(flags == SIG_TERM)
+// {
+// // clean up
+// thread->terminate();
+// }
+// else if( flags == CAR_SIGNAL )
+// {
+// update_pos();
+// }
+// // unknown signal
+// else
+// {
+// assert(0);
+// }
+//
+// send_signal( CAR_UPDATE_MAIN_SIGNAL );
+// }
+//}
+//
+//int Car::is_simulating()
+//{
+// return simulation;
+//}
+//
+//void Car::reset(int speed, int position) {
+// // handle any necessary coordination with main thread
+//
+// // reset any other attributes that may be necessary
+// // ...
+// // ...
+//
+// if (thread != NULL) { // Clear out the existing thread, if it exists, since we don't know how long it has waited for
+// delete thread;
+// }
+//
+// thread = new Thread();
+// // Create a new thread for the car
+// thread->start( callback(this, &Car::update) ); // Start the thread with the car's update method
+//
+// this->simulation = 1;
+// this->tick = 0;
+// this->position = position;
+// this->speed = speed;
+//}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part2/Car.h Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,51 @@
+//#ifndef _CAR_H_
+//#define _CAR_H_
+//
+//#include "mbed.h"
+//
+//
+//// The road is 100 meters long
+//#define ROADLENGTH 100
+//
+//// Update is running at 1000ms (1 second cycles)
+//#define TICK 1000
+//
+//class Car {
+//public:
+// int position; // Position, in meters, of the car
+// int speed; // Speed, in meters, of the car to be used to update the position next Update
+// int tick; // tick to show time passed 5 ticks is an update to speed
+//
+// // Add any other needed public attributes
+// // ...
+// // ...
+//
+// // Constructor for the Car class
+// // Modify as necessary to provide the Car object with
+// // access additional resources
+// Car(int id);
+//
+// // Update the position and speed of the car in a 1 second loop
+// void update();
+//
+// // Reset the position of the car to 0 and set the speed to the given speed
+// void reset(int speed, int position);
+//
+// //
+// int is_simulating();
+//
+//
+//private:
+// int id; // Identifier so that we can distinguish between cars
+// Thread* thread; // Thread on which to run the car
+// int simulation;
+//
+// void new_speed(void);
+// void update_pos();
+//
+//
+// // Add any other needed private attributes
+// // ...
+// // ...
+//};
+//#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part2/main.cpp Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,159 @@
+//#include "mbed.h"
+//#include <cctype>
+//#include "Car.h"
+//#include "AccCar.h"
+//#include "TextLCD.h"
+//#include "signal_wrapper.h"
+//
+//Serial pc(USBTX, USBRX); // The connection to USB
+//TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2 ); // rs, e, d4-d7
+//
+//#define MIN_CAR_POSITION 20
+//#define MAX_CAR_POSITION 40
+//#define MAX_CAR_SPEED 15
+//#define MIN_CAR_SPEED 5
+//#define MAX_ACC_SPEED MAX_CAR_SPEED
+//#define MIN_ACC_SPEED MIN_CAR_SPEED
+//
+//// define any needed global variables
+//// ...
+//// ...
+//
+//
+//// This function present the "prompt" string to the user before accepting
+//// an integer back from the Serial connection. If the user enters anything
+//// other than a digit (e.g. return key, letters), the currently built number
+//// is returned
+//int read_int(char* prompt) {
+// int number = 0;
+//
+// pc.printf(prompt);
+//
+// char input;
+// while(1) {
+// input = pc.getc();
+// pc.putc(input);
+//
+// if( std::isdigit(input) ) {
+// number = (number * 10) + (input-'0');
+// } else {
+// pc.putc(input);
+// break;
+// }
+// }
+//
+// return number;
+//}
+//
+// void get_valid_input(char* str, int* data, int max, int min)
+// {
+// int valid_reading = 0;
+// while( !valid_reading )
+// {
+// *data = read_int(str);
+// if( *data >= min && *data <= max )
+// {
+// valid_reading = 1;
+// }
+// else
+// {
+// printf("\r\n");
+// printf("invalid input ... range: %d -> %d\r\n", min, max);
+// }
+// }
+// printf("\r\n");
+//}
+//
+//void handle_input(int* car_pos,int* car_speed,int* acc_speed)
+//{
+// get_valid_input("car position: ",car_pos,MAX_CAR_POSITION,MIN_CAR_POSITION);
+// get_valid_input("car_speed: ",car_speed,MAX_CAR_SPEED,MIN_CAR_SPEED);
+// get_valid_input("acc_speed: ",acc_speed,MAX_ACC_SPEED,MIN_ACC_SPEED);
+// return;
+//}
+//
+//// The main thread of the program. This runs the main program, accepting user
+//// input, creating cars, displaying state of cars, and handling coordination that
+//// may be needed. Timing statistics are also presented.
+//int main()
+//{
+// // ------------------------------------------------------------------------------
+// // The following three variables are used for timing statistics, do not modify them
+// Timer stopwatch; // A timer to keep track of how long the updates take, for statistics purposes
+// int numberCycles = 0;
+// int totalUpdateTime = 0;
+// // ------------------------------------------------------------------------------
+//
+// // prepare serial monitor and make it look nice
+// printf("\033[2J");
+// printf("\r\n");
+//
+//
+// Car car(0); // Create a car. This call will need to be modified with any additional parameters you add
+// AccCar acc_car(0);
+//
+// stopwatch.start(); // Start out stats timer
+//
+// while (true) { // Run the simulation indefinitely
+//
+// int carspeed,carposition,acctarget;
+//
+// // get the input
+// handle_input(&carposition,&carspeed,&acctarget);
+//
+// // clear LCD
+// lcd.cls();
+//
+// // create acc and car threads based off user input
+// car.reset(carspeed,carposition);
+// acc_car.reset(acctarget);
+//
+// // ----------------------------------------------------------------------
+// // Timing statistics logic, do not modify
+// stopwatch.reset();
+// // ----------------------------------------------------------------------
+// do { // Run the simulation until the car exits the road
+//;
+// // wait some time before sending signal
+// while(stopwatch.read_ms() < TICK)
+// {
+// // do nothing I guess
+// }
+//
+// // signal car it can update
+// send_signal( CAR_SIGNAL );
+//
+// // wait for car to update
+// wait_for_signal( CAR_UPDATE_MAIN_SIGNAL );
+//
+// // update the ACC car
+// send_signal( ACC_SIGNAL );
+//
+// // wait for the update to complete
+// wait_for_signal( ACC_UPDATE_MAIN_SIGNAL );
+//
+// // ------------------------------------------------------------------
+// // Timing statistics logic, do not modify
+// totalUpdateTime += stopwatch.read_ms();
+// numberCycles++;
+// stopwatch.reset();
+// // ------------------------------------------------------------------
+// lcd.cls();
+// // Display the state of the car to the LCD
+// lcd.printf( "Car: %d -> %d\n",car.speed,car.position );
+// lcd.printf( "Acc: %d -> %d\n",acc_car.speed,acc_car.position );
+//
+// } while (acc_car.acc_is_simulating()); // Modify this condition to stop the simulation when the car exits the road
+//
+// // terminate any threads waiting for a signal
+// send_signal( SIG_TERM );
+//
+// // ----------------------------------------------------------------------
+// // Timing statistics printout, do not modify
+// pc.printf("Resetting...\r\n");
+// pc.printf("Average update cycle took: %fms \r\n", (totalUpdateTime*1.0)/(numberCycles*1.0));
+// totalUpdateTime = 0;
+// numberCycles = 0;
+// // ----------------------------------------------------------------------
+// }
+//}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HW2_skeleton/HW2_skeleton/Part2/signal_wrapper.cpp Mon Sep 16 01:19:04 2019 +0000
@@ -0,0 +1,14 @@
+//#include "mbed.h"
+//#include <cctype>
+//
+//EventFlags event_flags;
+//
+//uint32_t send_signal( uint32_t flags )
+//{
+// return event_flags.set( flags );
+//}
+//
+//uint32_t wait_for_signal( uint32_t flags )
+//{
+// return event_flags.wait_any( flags );
+//}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HW2_skeleton/HW2_skeleton/Part2/signal_wrapper.h Mon Sep 16 01:19:04 2019 +0000 @@ -0,0 +1,25 @@ +//#ifndef _SIG_H_ +//#define _SIG_H_ +// +//#include "mbed.h" +//#include <cctype> +// +//#define ACC_BIT 0 +//#define CAR_BIT 1 +//#define ACC_UPDATE_BIT 2 +//#define CAR_UPDATE_BIT 3 +//#define SIG_TERM_BIT 4 +// +//#define ACC_SIGNAL (1 << ACC_BIT) +//#define CAR_SIGNAL (1 << CAR_BIT) +//#define ACC_UPDATE_MAIN_SIGNAL (1 << ACC_UPDATE_BIT) +//#define CAR_UPDATE_MAIN_SIGNAL (1 << CAR_UPDATE_BIT) +//#define SIG_TERM (1 << SIG_TERM_BIT) +// +// +// +//uint32_t send_signal( uint32_t flags ); +//uint32_t wait_for_signal( uint32_t flags ); +// +// +//#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Mon Sep 16 01:19:04 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Mon Sep 16 01:19:04 2019 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#5941d1718339116cd12914238ec331c84da3d08f