예제 #1
0
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 *)&currentspeed);
        
        //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();
    
}
예제 #2
0
파일: message_call.c 프로젝트: BruceYi/okl4
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);
}