Program to control an accelerometer, motors and a rangefinder using the ScmRTOS ported to mbed. (Work in progress and buggy)
serial_out.h
00001 #pragma once 00002 #ifndef SERIAL_OUT_H 00003 #define SERIAL_OUT_H 00004 #include <processes.h> 00005 #include <Mutexes.h> 00006 #include <channels.h> 00007 #include <serial.h> 00008 //DigitalOut led3(LED3); 00009 extern BusOut leds; 00010 template<> OS_PROCESS void Serial_Out::Exec() //Output stream handling process 00011 { 00012 00013 00014 char temp1 = 0; 00015 //led3 = 0; 00016 //char buf[50] = "output process working.\n"; 00017 for(;;) 00018 { 00019 //Sleep(500); 00020 TX_channel.pop(temp1); 00021 leds = 0x8; 00022 //wait_ms(200); //simulate delays 00023 //Sleep(10); 00024 //led3 = !led3; 00025 //OUT->printf(buf); 00026 //if(OUT == &USB) 00027 //{ 00028 //Serial_Mutex.Lock(); 00029 //XB_Mutex.Lock(); 00030 if(OUT->writeable()) 00031 { 00032 OUT->putc(temp1); 00033 00034 00035 00036 00037 00038 //XB_Mutex.Unlock(); 00039 } 00040 else 00041 { 00042 //TX_channel.push_front(temp1); 00043 //OUT->printf("output is not writeable!\n"); 00044 //Sleep(0.5); //sleep 00045 } 00046 //Serial_Mutex.Unlock(); 00047 //} 00048 00049 00050 00051 leds = 0x8; 00052 00053 } 00054 } 00055 00056 00057 #endif 00058 00059 00060
Generated on Wed Jul 13 2022 05:20:16 by 1.7.2