![](/media/cache/group/1711.jpg.50x50_q85.jpg)
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) 反転させることにより、疑似リセットクロックを生成します。
その後は、通常の起動手順に復帰し、以降はこれまでと同様の動作をします。
Diff: edge_sensor/edge_temp.h
- Revision:
- 0:d895cd1cd897
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/edge_sensor/edge_temp.h Tue Apr 03 08:30:29 2018 +0000 @@ -0,0 +1,63 @@ +#ifndef _EDGE_TEMP_H_ +#define _EDGE_TEMP_H_ +#include "mbed.h" +#include "edge_sensor.h" +#include "LM75B.h" +#include "SMTC502AT.h" + +/** + * edge_temp edge_sensor to measre temperature sensors + */ + +class edge_temp : public edge_sensor { +public: +/** + * constructor + * @param *temp1 LM75B temperature sensor object (with Color1) + * @param *temp2 SMTC502AT temperature sensor object (befor) + * @param *temp3 SMTC502AT temperature sensor object (after) + * @param *temp4 LM75B temperature sensor object (with Color2) + */ + edge_temp(LM75B *temp1, SMTC502AT *temp2, SMTC502AT *temp3, LM75B *temp4) ; + +/** + * destructor + */ + ~edge_temp(void) ; + +/** + * reset and clear the internal values + */ + virtual void reset(void) ; + +/** + * prepare for sampling + */ + virtual void prepare(void) ; + +/** + * sample measure and store sensor values + * @return 0: success non-0: failure + */ + virtual int sample(void) ; + +/** + * deliver the values to the afero cloud + */ + virtual int deliver(void) ; + +/** + * Show the value(s) in the display (TFT) + */ + virtual void show(void) ; + +private: + LM75B *_temp1 ; + SMTC502AT *_temp2 ; + SMTC502AT *_temp3 ; + LM75B *_temp4 ; + float _ftemp[4] ; +} ; + +extern float *current_temp ; +#endif /* _EDGE_TEMP_H_ */ \ No newline at end of file