void car_movement(void) { volatile int throttle_cm; volatile int target = 1; //if we havnt reached our target speed while (target) { if((abs((currentspeed/targetspeed)-1)<0.5) && (currentspeed <102) && (currentspeed > 99)) {target = 0;} //send the current speed send_wait(mbf, (void *)¤tspeed); //communicating with the cruise controll //recieve instructions for the trottle receive_no_wait(mbi, (void *)&throttle_cm); //if throttle is positive incr the speed if (throttle_cm > 0) { currentspeed = currentspeed + throttle_cm + friction_drag_etc; } //if throttle decr the speed else currentspeed = currentspeed + throttle_cm + friction_drag_etc; } target_reached =1; terminate(); }
int okl4_message_call(okl4_kcap_t dest, void * buff, okl4_word_t buff_size, void * recv_buff, okl4_word_t recv_buff_size, okl4_word_t * recv_bytes) { return send_wait(dest, dest, buff, buff_size, recv_buff, recv_buff_size, recv_bytes, 1); }