LAURUS / Mbed 2 deprecated Datalogger

Dependencies:   SDFileSystem mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Log.h Source File

Log.h

00001 //**** Log.h ****
00002 //ログをリングバッファを用いて、
00003 //シリアル送信、SDカード出力を行う
00004 //***************
00005 
00006 #ifndef LOG_H_ 
00007 #define LOG_H_ 
00008 
00009 #include "mbed.h"
00010 #include "SDFileSystem.h"
00011 #include "RingBuffer.h"
00012 
00013 class Log{
00014 public:
00015     Log(PinName rx, PinName tx, PinName mosi, PinName miso, PinName sck, PinName cs, const char* name);
00016     int initialize_sdlog(const char* str);
00017     void close();
00018     int find_last();
00019     void puts(const char *str);
00020     void putc(char ch);
00021     void write_data(uint8_t* buf, int16_t size);
00022     bool is_empty();
00023     int16_t recieve_buffer_size();
00024     int16_t getc();
00025     int16_t read_data(uint8_t* buf, int16_t size);
00026     char int_tx();
00027     void int_serial_tx();
00028 
00029 protected:
00030     SDFileSystem _sd;
00031     FILE *fp;
00032     Serial _device;
00033     RingBuffer buf_send;
00034     RingBuffer buf_recieve;
00035 };
00036 
00037 #endif /* LOG_H_ */