I2C hang recover function added
Dependencies: UniGraphic mbed vt100
In this version, check_i2c_pins function was added in edge_mgr.cpp.
プログラムの起動時、I2Cモジュールを初期化する前に、I2Cに使用するピンの電位を確認し
もし一方でも Low に張り付いていた場合、SCL を GPIO 出力に設定して
所定回数 (I2C_UNLOCK_TRIAL_CYCLE) 反転させることにより、疑似リセットクロックを生成します。
その後は、通常の起動手順に復帰し、以降はこれまでと同様の動作をします。
edge_sensor/edge_temp.h@0:d895cd1cd897, 2018-04-03 (annotated)
- Committer:
- Rhyme
- Date:
- Tue Apr 03 08:30:29 2018 +0000
- Revision:
- 0:d895cd1cd897
Initial I2C Pin force reset function added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:d895cd1cd897 | 1 | #ifndef _EDGE_TEMP_H_ |
Rhyme | 0:d895cd1cd897 | 2 | #define _EDGE_TEMP_H_ |
Rhyme | 0:d895cd1cd897 | 3 | #include "mbed.h" |
Rhyme | 0:d895cd1cd897 | 4 | #include "edge_sensor.h" |
Rhyme | 0:d895cd1cd897 | 5 | #include "LM75B.h" |
Rhyme | 0:d895cd1cd897 | 6 | #include "SMTC502AT.h" |
Rhyme | 0:d895cd1cd897 | 7 | |
Rhyme | 0:d895cd1cd897 | 8 | /** |
Rhyme | 0:d895cd1cd897 | 9 | * edge_temp edge_sensor to measre temperature sensors |
Rhyme | 0:d895cd1cd897 | 10 | */ |
Rhyme | 0:d895cd1cd897 | 11 | |
Rhyme | 0:d895cd1cd897 | 12 | class edge_temp : public edge_sensor { |
Rhyme | 0:d895cd1cd897 | 13 | public: |
Rhyme | 0:d895cd1cd897 | 14 | /** |
Rhyme | 0:d895cd1cd897 | 15 | * constructor |
Rhyme | 0:d895cd1cd897 | 16 | * @param *temp1 LM75B temperature sensor object (with Color1) |
Rhyme | 0:d895cd1cd897 | 17 | * @param *temp2 SMTC502AT temperature sensor object (befor) |
Rhyme | 0:d895cd1cd897 | 18 | * @param *temp3 SMTC502AT temperature sensor object (after) |
Rhyme | 0:d895cd1cd897 | 19 | * @param *temp4 LM75B temperature sensor object (with Color2) |
Rhyme | 0:d895cd1cd897 | 20 | */ |
Rhyme | 0:d895cd1cd897 | 21 | edge_temp(LM75B *temp1, SMTC502AT *temp2, SMTC502AT *temp3, LM75B *temp4) ; |
Rhyme | 0:d895cd1cd897 | 22 | |
Rhyme | 0:d895cd1cd897 | 23 | /** |
Rhyme | 0:d895cd1cd897 | 24 | * destructor |
Rhyme | 0:d895cd1cd897 | 25 | */ |
Rhyme | 0:d895cd1cd897 | 26 | ~edge_temp(void) ; |
Rhyme | 0:d895cd1cd897 | 27 | |
Rhyme | 0:d895cd1cd897 | 28 | /** |
Rhyme | 0:d895cd1cd897 | 29 | * reset and clear the internal values |
Rhyme | 0:d895cd1cd897 | 30 | */ |
Rhyme | 0:d895cd1cd897 | 31 | virtual void reset(void) ; |
Rhyme | 0:d895cd1cd897 | 32 | |
Rhyme | 0:d895cd1cd897 | 33 | /** |
Rhyme | 0:d895cd1cd897 | 34 | * prepare for sampling |
Rhyme | 0:d895cd1cd897 | 35 | */ |
Rhyme | 0:d895cd1cd897 | 36 | virtual void prepare(void) ; |
Rhyme | 0:d895cd1cd897 | 37 | |
Rhyme | 0:d895cd1cd897 | 38 | /** |
Rhyme | 0:d895cd1cd897 | 39 | * sample measure and store sensor values |
Rhyme | 0:d895cd1cd897 | 40 | * @return 0: success non-0: failure |
Rhyme | 0:d895cd1cd897 | 41 | */ |
Rhyme | 0:d895cd1cd897 | 42 | virtual int sample(void) ; |
Rhyme | 0:d895cd1cd897 | 43 | |
Rhyme | 0:d895cd1cd897 | 44 | /** |
Rhyme | 0:d895cd1cd897 | 45 | * deliver the values to the afero cloud |
Rhyme | 0:d895cd1cd897 | 46 | */ |
Rhyme | 0:d895cd1cd897 | 47 | virtual int deliver(void) ; |
Rhyme | 0:d895cd1cd897 | 48 | |
Rhyme | 0:d895cd1cd897 | 49 | /** |
Rhyme | 0:d895cd1cd897 | 50 | * Show the value(s) in the display (TFT) |
Rhyme | 0:d895cd1cd897 | 51 | */ |
Rhyme | 0:d895cd1cd897 | 52 | virtual void show(void) ; |
Rhyme | 0:d895cd1cd897 | 53 | |
Rhyme | 0:d895cd1cd897 | 54 | private: |
Rhyme | 0:d895cd1cd897 | 55 | LM75B *_temp1 ; |
Rhyme | 0:d895cd1cd897 | 56 | SMTC502AT *_temp2 ; |
Rhyme | 0:d895cd1cd897 | 57 | SMTC502AT *_temp3 ; |
Rhyme | 0:d895cd1cd897 | 58 | LM75B *_temp4 ; |
Rhyme | 0:d895cd1cd897 | 59 | float _ftemp[4] ; |
Rhyme | 0:d895cd1cd897 | 60 | } ; |
Rhyme | 0:d895cd1cd897 | 61 | |
Rhyme | 0:d895cd1cd897 | 62 | extern float *current_temp ; |
Rhyme | 0:d895cd1cd897 | 63 | #endif /* _EDGE_TEMP_H_ */ |