takahiro maeda / Sensor

Dependents:   Nucleo_IHS11a

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Sensor.h Source File

Sensor.h

00001 #ifndef SENSOR_H
00002 #define SENSOR_H
00003 #include "mbed.h"
00004 // ******************* Manual settings ******************************
00005 #define EVERY               // *** every -> ss:D8 ***      
00006 const int ROW_LEN = 1;      // *** set row length 1,8,16***
00007 // ******************************************************************
00008 // ******************************************************************
00009 const int COL_LEN = 8;
00010 const int CRI_LEN = 12;
00011 // ************************** typedef ********************
00012 typedef unsigned char byte;
00013 // ********************** global function ****************
00014 void out3bit(DigitalOut ary[], int val);
00015 int noMinus(int n);
00016 // *************************** Sensor *******************
00017 class Sensor {
00018   public:
00019     Sensor(int correction = 0);
00020     void set_adAryInit();    
00021     void setAd(bool bAdd = false);
00022     int getColVal(int c);
00023     int getColAd(int c);
00024 
00025   private:
00026     unsigned int getAdc(int col);
00027     void setCol(int row, int col, bool bAdd=false);
00028     int ad2val(int ad);
00029     void pCri();
00030     void set_ILED_cycle_1200uS(Timer& t0, const int COL_US);
00031 
00032     static int cri[CRI_LEN];// criteria for value:1~12
00033     int adAry[COL_LEN];
00034     byte val12[COL_LEN];    // value 1~12
00035     static int adAryInit[ROW_LEN][COL_LEN];
00036 };
00037 
00038 #endif