#include "libs/RingBuffer.h"
#include "libs/SerialMessage.h"
#include "libs/StreamOutput.h"
+#include "libs/StreamOutputPool.h"
// Serial reading module
// Treats every received line as a command and passes it ( via event call ) to the command dispatcher.
this->register_for_event(ON_MAIN_LOOP);
// Add to the pack of streams kernel can call to, for example for broadcasting
- this->kernel->streams->append_stream(this);
+ THEKERNEL->streams->append_stream(this);
}
// Called on Serial::RxIrq interrupt, meaning we have received a char
struct SerialMessage message;
message.message = received;
message.stream = this;
- this->kernel->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
+ THEKERNEL->call_event(ON_CONSOLE_LINE_RECEIVED, &message );
return;
}else{
received += c;
int SerialConsole::puts(const char* s)
{
- return fwrite(s, strlen(s), 1, this->serial->_file);
+ return fwrite(s, strlen(s), 1, (FILE*)(*this->serial));
}
int SerialConsole::_putc(int c)
return this->serial->getc();
}
+// Does the queue have a given char ?
bool SerialConsole::has_char(char letter){
- int index = this->buffer.head;
- while( index != this->buffer.tail ){
+ int index = this->buffer.tail;
+ while( index != this->buffer.head ){
if( this->buffer.buffer[index] == letter ){
return true;
}