Program to control an accelerometer, motors and a rangefinder using the ScmRTOS ported to mbed. (Work in progress and buggy)
Diff: Hexacopter/serial_out.h
- Revision:
- 0:9b057566f9ee
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hexacopter/serial_out.h Mon Nov 01 20:39:01 2010 +0000 @@ -0,0 +1,60 @@ +#pragma once +#ifndef SERIAL_OUT_H +#define SERIAL_OUT_H +#include <processes.h> +#include <Mutexes.h> +#include <channels.h> +#include <serial.h> +//DigitalOut led3(LED3); +extern BusOut leds; +template<> OS_PROCESS void Serial_Out::Exec() //Output stream handling process +{ + + + char temp1 = 0; + //led3 = 0; + //char buf[50] = "output process working.\n"; + for(;;) + { + //Sleep(500); + TX_channel.pop(temp1); + leds = 0x8; + //wait_ms(200); //simulate delays + //Sleep(10); + //led3 = !led3; + //OUT->printf(buf); + //if(OUT == &USB) + //{ + //Serial_Mutex.Lock(); + //XB_Mutex.Lock(); + if(OUT->writeable()) + { + OUT->putc(temp1); + + + + + + //XB_Mutex.Unlock(); + } + else + { + //TX_channel.push_front(temp1); + //OUT->printf("output is not writeable!\n"); + //Sleep(0.5); //sleep + } + //Serial_Mutex.Unlock(); + //} + + + + leds = 0x8; + + } +} + + + #endif + + +