Temporary Connector Reversed Version

Dependencies:   UniGraphic mbed vt100

afero_poc15_180403R , J1 のピン配置を反転させたヴァージョンです。

Color2系を使用するためには以下のピンをジャンパで接続してください。
J1-D7 <-> J1-D0
J1-D6 <-> J1-D1

(調査中) また、こちらでテストした範囲では、
FRDM-KL25Z の V3.3 を、Modulo2 の VCC_3V3 ピンに接続してやる必要がありました。

尚、J1-D1, D0 を使用するために UART を無効にしているため
ログは表示されません。

TFTモジュールについて 
aitendoのTFTモジュールはデフォルトでは8bit bus モードになっています。
/media/uploads/Rhyme/img_2364.jpg

半田のジャンパを変えて、SPIの設定にしてください。
/media/uploads/Rhyme/img_2363.jpg

サーミスタについて
POC1.5 では サーミスタは 25℃の時に抵抗値が 50.0kΩになる502AT-11 が
4.95kΩのプルアップ(実際は10kΩx2の並列)で使用されていました。

今回の試作では抵抗値が 10.0kΩの 103AT-11 が
5.1kΩのプルアップで使用されていますので、係数を合わせるために
SMTC502AT-11 のコンストラクタを 
R0 = 10.0
R1 = 5.1
B = 3435
T0 = 298.15
で呼ぶように変更しました。

Committer:
Rhyme
Date:
Tue Apr 24 12:18:10 2018 +0000
Revision:
1:6c54dc8acf96
Parent:
0:0b6732b53bf4
to adjust with 103AT-11 with 5.1k pull-up, the constructor of 502AT-11 is called with R0=10.0, R1=5.1, B=3435, T0=298.15

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:0b6732b53bf4 1 #ifndef _EDGE_SENSOR_H_
Rhyme 0:0b6732b53bf4 2 #define _EDGE_SENSOR_H_
Rhyme 0:0b6732b53bf4 3 /**
Rhyme 0:0b6732b53bf4 4 * edge_sensor super class of each sensor manager class
Rhyme 0:0b6732b53bf4 5 */
Rhyme 0:0b6732b53bf4 6 #include "edge_time.h"
Rhyme 0:0b6732b53bf4 7 #include "afLib.h"
Rhyme 0:0b6732b53bf4 8 #include "af_mgr.h"
Rhyme 0:0b6732b53bf4 9 #include <ILI9341.h>
Rhyme 0:0b6732b53bf4 10 #include "edge_chart.h"
Rhyme 0:0b6732b53bf4 11
Rhyme 0:0b6732b53bf4 12 class edge_sensor {
Rhyme 0:0b6732b53bf4 13 public:
Rhyme 0:0b6732b53bf4 14 /**
Rhyme 0:0b6732b53bf4 15 * constructor
Rhyme 0:0b6732b53bf4 16 */
Rhyme 0:0b6732b53bf4 17 edge_sensor() ;
Rhyme 0:0b6732b53bf4 18
Rhyme 0:0b6732b53bf4 19 /**
Rhyme 0:0b6732b53bf4 20 * destructor
Rhyme 0:0b6732b53bf4 21 */
Rhyme 0:0b6732b53bf4 22 ~edge_sensor() ;
Rhyme 0:0b6732b53bf4 23
Rhyme 0:0b6732b53bf4 24 /**
Rhyme 0:0b6732b53bf4 25 * reset reset property valuse of edge_sensor
Rhyme 0:0b6732b53bf4 26 */
Rhyme 0:0b6732b53bf4 27 virtual void reset(void) ;
Rhyme 0:0b6732b53bf4 28
Rhyme 0:0b6732b53bf4 29 /**
Rhyme 0:0b6732b53bf4 30 * assign _id manually
Rhyme 0:0b6732b53bf4 31 */
Rhyme 0:0b6732b53bf4 32 virtual void setId(uint16_t id) { _id = id ; }
Rhyme 0:0b6732b53bf4 33
Rhyme 0:0b6732b53bf4 34 virtual uint16_t getId(void) { return _id ; }
Rhyme 0:0b6732b53bf4 35
Rhyme 0:0b6732b53bf4 36 /**
Rhyme 0:0b6732b53bf4 37 * enable the edge_sensor
Rhyme 0:0b6732b53bf4 38 */
Rhyme 0:0b6732b53bf4 39 virtual void enable(void) ;
Rhyme 0:0b6732b53bf4 40
Rhyme 0:0b6732b53bf4 41 /**
Rhyme 0:0b6732b53bf4 42 * disable the edge_sensor
Rhyme 0:0b6732b53bf4 43 */
Rhyme 0:0b6732b53bf4 44 virtual void disable(void) ;
Rhyme 0:0b6732b53bf4 45
Rhyme 0:0b6732b53bf4 46 /**
Rhyme 0:0b6732b53bf4 47 * test if the edge_sensor is enabled (or not)
Rhyme 0:0b6732b53bf4 48 * @returns true: the sensor is enabled false: the sensor is disabled
Rhyme 0:0b6732b53bf4 49 */
Rhyme 0:0b6732b53bf4 50 virtual bool isEnabled(void) ;
Rhyme 0:0b6732b53bf4 51
Rhyme 0:0b6732b53bf4 52 /**
Rhyme 0:0b6732b53bf4 53 * prepare the sensor for sampling
Rhyme 0:0b6732b53bf4 54 */
Rhyme 0:0b6732b53bf4 55 virtual void prepare(void) ;
Rhyme 0:0b6732b53bf4 56
Rhyme 0:0b6732b53bf4 57 /**
Rhyme 0:0b6732b53bf4 58 * sample trigger sampling action of the sensor and acquire the data
Rhyme 0:0b6732b53bf4 59 * @returns 0:success non-0:failure
Rhyme 0:0b6732b53bf4 60 */
Rhyme 0:0b6732b53bf4 61 virtual int sample(void) ;
Rhyme 0:0b6732b53bf4 62
Rhyme 0:0b6732b53bf4 63
Rhyme 0:0b6732b53bf4 64 /**
Rhyme 0:0b6732b53bf4 65 * deliver the sampled data to the afero cloud via setAttributes
Rhyme 0:0b6732b53bf4 66 */
Rhyme 0:0b6732b53bf4 67 virtual int deliver(void) ;
Rhyme 0:0b6732b53bf4 68
Rhyme 0:0b6732b53bf4 69 /**
Rhyme 0:0b6732b53bf4 70 * show the value(s) to the display (TFT)
Rhyme 0:0b6732b53bf4 71 */
Rhyme 0:0b6732b53bf4 72 virtual void show(void) ;
Rhyme 0:0b6732b53bf4 73
Rhyme 0:0b6732b53bf4 74 /**
Rhyme 0:0b6732b53bf4 75 * toJson convert sampled data to json format
Rhyme 0:0b6732b53bf4 76 * @param buf char* string buf to store the json string
Rhyme 0:0b6732b53bf4 77 */
Rhyme 0:0b6732b53bf4 78 virtual void toJson(char *buf) ;
Rhyme 0:0b6732b53bf4 79
Rhyme 0:0b6732b53bf4 80 /**
Rhyme 0:0b6732b53bf4 81 * display timestamp in human readable format
Rhyme 0:0b6732b53bf4 82 * @parm ts int32_t timestamp value to display
Rhyme 0:0b6732b53bf4 83 */
Rhyme 0:0b6732b53bf4 84 virtual void displayTime(int32_t ts) ;
Rhyme 0:0b6732b53bf4 85
Rhyme 0:0b6732b53bf4 86 /**
Rhyme 0:0b6732b53bf4 87 * setInterval assign sampling interval time (in sec)
Rhyme 0:0b6732b53bf4 88 * @param interval uint16_t the value to assign
Rhyme 0:0b6732b53bf4 89 */
Rhyme 0:0b6732b53bf4 90 void setInterval(uint16_t interval) ;
Rhyme 0:0b6732b53bf4 91
Rhyme 0:0b6732b53bf4 92 /**
Rhyme 0:0b6732b53bf4 93 * getInterval get sampling interval time (in sec)
Rhyme 0:0b6732b53bf4 94 * @returns the interval time in uint16_t
Rhyme 0:0b6732b53bf4 95 */
Rhyme 0:0b6732b53bf4 96 uint16_t getInterval(void) ;
Rhyme 0:0b6732b53bf4 97
Rhyme 0:0b6732b53bf4 98 /**
Rhyme 0:0b6732b53bf4 99 * getStatus get current status of the state machine
Rhyme 0:0b6732b53bf4 100 * @returns current status as int
Rhyme 0:0b6732b53bf4 101 */
Rhyme 0:0b6732b53bf4 102 int getStatus(void) ;
Rhyme 0:0b6732b53bf4 103
Rhyme 0:0b6732b53bf4 104 /**
Rhyme 0:0b6732b53bf4 105 * advanceStatus proceed status into the next state
Rhyme 0:0b6732b53bf4 106 * @returns advanced status
Rhyme 0:0b6732b53bf4 107 */
Rhyme 0:0b6732b53bf4 108 int advanceStatus(void) ;
Rhyme 0:0b6732b53bf4 109
Rhyme 0:0b6732b53bf4 110 /**
Rhyme 0:0b6732b53bf4 111 * runStateMachine run the statemachine for single cycle
Rhyme 0:0b6732b53bf4 112 * @returns the result status
Rhyme 0:0b6732b53bf4 113 */
Rhyme 0:0b6732b53bf4 114 virtual int runStateMachine(void) ;
Rhyme 0:0b6732b53bf4 115 protected:
Rhyme 0:0b6732b53bf4 116 uint16_t _id ;
Rhyme 0:0b6732b53bf4 117 bool _enable ;
Rhyme 0:0b6732b53bf4 118 uint32_t _interval ;
Rhyme 0:0b6732b53bf4 119 int _status ;
Rhyme 0:0b6732b53bf4 120 int _error_count ;
Rhyme 0:0b6732b53bf4 121 int _sample_error ;
Rhyme 0:0b6732b53bf4 122 int _prev_status ;
Rhyme 0:0b6732b53bf4 123 uint32_t _end_interval ;
Rhyme 0:0b6732b53bf4 124 uint32_t _sampled_time ;
Rhyme 0:0b6732b53bf4 125 char _str_buf[256] ;
Rhyme 0:0b6732b53bf4 126 } ;
Rhyme 0:0b6732b53bf4 127
Rhyme 0:0b6732b53bf4 128 /* may be, we had better use enum here */
Rhyme 0:0b6732b53bf4 129 #define EDGE_SENSOR_INACTIVE 0
Rhyme 0:0b6732b53bf4 130 #define EDGE_SENSOR_WAIT 1
Rhyme 0:0b6732b53bf4 131 #define EDGE_SENSOR_READY 2
Rhyme 0:0b6732b53bf4 132 #define EDGE_SENSOR_PREPARED 3
Rhyme 0:0b6732b53bf4 133 #define EDGE_SENSOR_SAMPLED 4
Rhyme 0:0b6732b53bf4 134 #define EDGE_SENSOR_DELIVERED 5
Rhyme 0:0b6732b53bf4 135 #define EDGE_SENSOR_DISPLAYED 6
Rhyme 0:0b6732b53bf4 136
Rhyme 0:0b6732b53bf4 137 /* _id numbers for sensors */
Rhyme 0:0b6732b53bf4 138 #define SENSOR_ID_ACCEL 0
Rhyme 0:0b6732b53bf4 139 #define SENSOR_ID_COLOR1 1
Rhyme 0:0b6732b53bf4 140 #define SENSOR_ID_COLOR2 2
Rhyme 0:0b6732b53bf4 141 #define SENSOR_ID_TEMP 3
Rhyme 0:0b6732b53bf4 142 #define SENSOR_ID_PRESS 4
Rhyme 0:0b6732b53bf4 143
Rhyme 0:0b6732b53bf4 144 /* Y position of SUMMARY MODE */
Rhyme 0:0b6732b53bf4 145 #define EDGE_SUMMARY_X 10
Rhyme 0:0b6732b53bf4 146 #define EDGE_SUMMARY_TIME_Y 10
Rhyme 0:0b6732b53bf4 147 #define EDGE_SUMMARY_ACCEL_Y 45
Rhyme 0:0b6732b53bf4 148 #define EDGE_SUMMARY_PRESS_Y 80
Rhyme 0:0b6732b53bf4 149 #define EDGE_SUMMARY_COLOR1_Y 115
Rhyme 0:0b6732b53bf4 150 #define EDGE_SUMMARY_COLOR2_Y 150
Rhyme 0:0b6732b53bf4 151 #define EDGE_SUMMARY_TEMP_Y 185
Rhyme 0:0b6732b53bf4 152
Rhyme 0:0b6732b53bf4 153 #define EDGE_SAMPLE_SUCCESS 0
Rhyme 0:0b6732b53bf4 154 #define SAMPLE_ERROR_TOLERANCE 3
Rhyme 0:0b6732b53bf4 155
Rhyme 0:0b6732b53bf4 156 extern ILI9341 *display ;
Rhyme 0:0b6732b53bf4 157 extern int display_mode ;
Rhyme 0:0b6732b53bf4 158 extern const unsigned char Arial12x12[] ;
Rhyme 0:0b6732b53bf4 159 extern const unsigned char Arial24x23[] ;
Rhyme 0:0b6732b53bf4 160 extern const unsigned char Arial28x28[] ;
Rhyme 0:0b6732b53bf4 161
Rhyme 0:0b6732b53bf4 162 #endif /* _EDGE_SENSOR_H_ */