Library to use the Kaji-Lab's Electrical Simulator

Dependents:   Interference_Simple

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers KajiLabES.h Source File

KajiLabES.h

00001 #ifndef KAJIMOTO_LAB_ELECTRIC_STIMULATION_H
00002 #define KAJIMOTO_LAB_ELECTRIC_STIMULATION_H
00003 #include "mbed.h"
00004 /** \Class  KajiLabES nyaan
00005  *  The class which make the electrical stimulator device made by Ph.D Kajimoto
00006  *  out put sotimulation current and get impedance among electrodes.
00007  *
00008  */
00009 class KajiLabES
00010 {
00011 private:
00012     //DAAD
00013     SPI         _spiDAAD;//(p5, p6, p7);   // mosi(master output slave input, miso(not connected), clock signal
00014     DigitalOut  _DA_sync;//(p8);           //chip select for AD5452
00015     DigitalOut  _AD_cs;//(p9);             //chip select for AD7276
00016 
00017 public:
00018     //KajiLabES();
00019     KajiLabES(
00020         PinName mosi = p5,
00021         PinName miso = p6,
00022         PinName clk  = p7,
00023         PinName DA_sync = p8,
00024         PinName AD_cs   = p9);
00025     //~KajiLabES();
00026 
00027     /** Execute DA&AD at the same time
00028      *  \par    About DA & AD
00029      *  -   DA output electrical current using AD5452(SPI)
00030      *  -   AD input impedance using AD7276(SPI)
00031      */
00032     short DAAD(short DA);
00033     
00034     /// Initialize SPI setting
00035     /**
00036      *  DA & AD devices are controlled by SPI.
00037      *  In this procedure, SPI are configurated as following
00038      *  -   buffer bit: 16 bit
00039      *  -   SPI Mode:   2
00040      *  -   Frequency:  48000000 Hz
00041      *
00042      *  \par About SPI Mode
00043      *  SPI has 4 modes
00044      *      \verbatim
00045      *      |Mode       |Polarity   |Phase      |
00046      *      |:---------:|:---------:|:---------:|
00047      *      |0          |0          |0          |
00048      *      |1          |0          |1          |
00049      *      |2          |1          |0          |
00050      *      |3          |1          |1          |
00051      *      \endverbatim
00052      *  .
00053      */
00054     void init();
00055 };
00056 #endif