IHS1.1-STM32F303K8

Dependents:   Nucleo_IHS11a

Committer:
maro
Date:
Fri Oct 23 06:36:45 2020 +0000
Revision:
1:ace656587248
Parent:
0:cf6cdf2e5565
Blinking indicator added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maro 0:cf6cdf2e5565 1 #ifndef SENSOR_H
maro 0:cf6cdf2e5565 2 #define SENSOR_H
maro 0:cf6cdf2e5565 3 #include "mbed.h"
maro 0:cf6cdf2e5565 4 // ******************* Manual settings ******************************
maro 0:cf6cdf2e5565 5 #define EVERY // *** every -> ss:D8 ***
maro 0:cf6cdf2e5565 6 const int ROW_LEN = 1; // *** set row length 1,8,16***
maro 0:cf6cdf2e5565 7 // ******************************************************************
maro 0:cf6cdf2e5565 8 // ******************************************************************
maro 0:cf6cdf2e5565 9 const int COL_LEN = 8;
maro 0:cf6cdf2e5565 10 const int CRI_LEN = 12;
maro 0:cf6cdf2e5565 11 // ************************** typedef ********************
maro 0:cf6cdf2e5565 12 typedef unsigned char byte;
maro 0:cf6cdf2e5565 13 // ********************** global function ****************
maro 0:cf6cdf2e5565 14 void out3bit(DigitalOut ary[], int val);
maro 0:cf6cdf2e5565 15 int noMinus(int n);
maro 0:cf6cdf2e5565 16 // *************************** Sensor *******************
maro 0:cf6cdf2e5565 17 class Sensor {
maro 0:cf6cdf2e5565 18 public:
maro 0:cf6cdf2e5565 19 Sensor(int correction = 0);
maro 0:cf6cdf2e5565 20 void set_adAryInit();
maro 0:cf6cdf2e5565 21 void setAd(bool bAdd = false);
maro 0:cf6cdf2e5565 22 int getColVal(int c);
maro 0:cf6cdf2e5565 23 int getColAd(int c);
maro 0:cf6cdf2e5565 24
maro 0:cf6cdf2e5565 25 private:
maro 0:cf6cdf2e5565 26 unsigned int getAdc(int col);
maro 0:cf6cdf2e5565 27 void setCol(int row, int col, bool bAdd=false);
maro 0:cf6cdf2e5565 28 int ad2val(int ad);
maro 0:cf6cdf2e5565 29 void pCri();
maro 0:cf6cdf2e5565 30 void set_ILED_cycle_1200uS(Timer& t0, const int COL_US);
maro 0:cf6cdf2e5565 31
maro 0:cf6cdf2e5565 32 static int cri[CRI_LEN];// criteria for value:1~12
maro 0:cf6cdf2e5565 33 int adAry[COL_LEN];
maro 0:cf6cdf2e5565 34 byte val12[COL_LEN]; // value 1~12
maro 0:cf6cdf2e5565 35 static int adAryInit[ROW_LEN][COL_LEN];
maro 0:cf6cdf2e5565 36 };
maro 0:cf6cdf2e5565 37
maro 0:cf6cdf2e5565 38 #endif