![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Log data to a micro SD card.
Dependencies: SDFileSystem mbed
Diff: Log.h
- Revision:
- 1:c5e56e2580bf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Log.h Mon May 04 07:10:55 2015 +0000 @@ -0,0 +1,37 @@ +//**** Log.h **** +//ログをリングバッファを用いて、 +//シリアル送信、SDカード出力を行う +//*************** + +#ifndef LOG_H_ +#define LOG_H_ + +#include "mbed.h" +#include "SDFileSystem.h" +#include "RingBuffer.h" + +class Log{ +public: + Log(PinName rx, PinName tx, PinName mosi, PinName miso, PinName sck, PinName cs, const char* name); + int initialize_sdlog(const char* str); + void close(); + int find_last(); + void puts(const char *str); + void putc(char ch); + void write_data(uint8_t* buf, int16_t size); + bool is_empty(); + int16_t recieve_buffer_size(); + int16_t getc(); + int16_t read_data(uint8_t* buf, int16_t size); + char int_tx(); + void int_serial_tx(); + +protected: + SDFileSystem _sd; + FILE *fp; + Serial _device; + RingBuffer buf_send; + RingBuffer buf_recieve; +}; + +#endif /* LOG_H_ */ \ No newline at end of file