Dave Van Wagner / SPIDebug

Dependents:   SST25VF064C

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SPIDebug.h Source File

SPIDebug.h

00001 ///////////////////////////////////////////////////////////////////////////////
00002 // SPIDebug.h
00003 //
00004 // COPYRIGHT (c) 2012 by David Van Wagner
00005 //
00006 // dave@vanwagner.org
00007 // http://techwithdave.blogspot.com
00008 //
00009 // License: Creative Commons Attribution-ShareAlike 3.0 Unported License
00010 // http://creativecommons.org/licenses/by-sa/3.0/
00011 ///////////////////////////////////////////////////////////////////////////////
00012 
00013 #include <mbed.h>
00014 
00015 class SPIDebug
00016 {
00017 private:
00018     SPI* spi;
00019     
00020 public:
00021     SPIDebug(PinName mosi, PinName miso, PinName sclk, const char *name = NULL);
00022     virtual ~SPIDebug();
00023     void format(int bits, int mode = 0);
00024     void frequency(int hz = 10000000);
00025     virtual int write(int value);
00026     static bool debug; // allow to be changed to control whether there are debug messages
00027 };
00028 
00029 class CSDebug
00030 {
00031 private:
00032     DigitalOut* cs;
00033 
00034 public:
00035     CSDebug(PinName pin);
00036     ~CSDebug();
00037     void write(bool state);
00038 };