Collections of BERTL libraries
class_software.cpp
- Committer:
- DongExpander
- Date:
- 2016-04-18
- Revision:
- 3:1708f20fd55b
- Parent:
- 2:4a9ed5ca8a9a
File content as of revision 3:1708f20fd55b:
#include "mbed.h" #include "class_software.h" Logfile::Logfile() { array_lenght = MAX_LOG; for ( int i = 0; i < array_lenght; i++ ) array[i]=0; } Logfile::Logfile(int lenght) { if ( lenght < array_lenght ) array_lenght = lenght; else array_lenght = MAX_LOG; for (int i = 0; i < array_lenght; i++) array[i]=0; } void Logfile::push(unsigned char input) { if (input != array[0]) { for (int i = array_lenght; i > 0; i--) array[i]=array[i-1]; array[0]=input; } } unsigned char Logfile::last() { return array[0]; } unsigned char Logfile::at(int pos) { if( pos < MAX_LOG ) return array[pos]; return 0; }