Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Sensor.h
- Revision:
- 0:cf6cdf2e5565
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Sensor.h Thu Jul 16 08:18:34 2020 +0000
@@ -0,0 +1,38 @@
+#ifndef SENSOR_H
+#define SENSOR_H
+#include "mbed.h"
+// ******************* Manual settings ******************************
+#define EVERY // *** every -> ss:D8 ***
+const int ROW_LEN = 1; // *** set row length 1,8,16***
+// ******************************************************************
+// ******************************************************************
+const int COL_LEN = 8;
+const int CRI_LEN = 12;
+// ************************** typedef ********************
+typedef unsigned char byte;
+// ********************** global function ****************
+void out3bit(DigitalOut ary[], int val);
+int noMinus(int n);
+// *************************** Sensor *******************
+class Sensor {
+ public:
+ Sensor(int correction = 0);
+ void set_adAryInit();
+ void setAd(bool bAdd = false);
+ int getColVal(int c);
+ int getColAd(int c);
+
+ private:
+ unsigned int getAdc(int col);
+ void setCol(int row, int col, bool bAdd=false);
+ int ad2val(int ad);
+ void pCri();
+ void set_ILED_cycle_1200uS(Timer& t0, const int COL_US);
+
+ static int cri[CRI_LEN];// criteria for value:1~12
+ int adAry[COL_LEN];
+ byte val12[COL_LEN]; // value 1~12
+ static int adAryInit[ROW_LEN][COL_LEN];
+};
+
+#endif