![](/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_pressure.cpp
- Revision:
- 2:de22987be9ba
- Parent:
- 0:d895cd1cd897
--- a/edge_sensor/edge_pressure.cpp Fri Apr 06 04:17:34 2018 +0000 +++ b/edge_sensor/edge_pressure.cpp Mon Jun 18 02:55:38 2018 +0000 @@ -30,7 +30,7 @@ float temp2expected(float temp) { - const float coef_A = 0.089 ; + const float coef_A = 0.088 ; const float coef_B = 0.831 ; float pressure ; @@ -188,8 +188,8 @@ // printf(str_buf) ; // printf("\n") ; sprintf(_str_buf, - "{\"DEVICE\":\"PRESS\",\"PN\":\"PSE530\",\"VAL\":\"%.3f\",\"UNIT\":\"kgf/cm2\",\"T\":\"%s\",\"E\":\"%d\"}", - _value, timestr, _error_count) ; + "{\"DEVICE\":\"PRESS\",\"PN\":\"PSE530\",\"VAL\":\"%.3f\",\"VAL_PA\":\"%E\",\"VAL_PL\":\"%F\",\"VAL_PH\":\"%G\",\"UNIT\":\"kgf/cm2\",\"T\":\"%s\",\"E\":\"%d\"}", + _value, _expected, _lower, _higher, timestr, _error_count) ; reset_watch_dog() ; result = afero->setAttribute(1, _str_buf) ; return( result == afSUCCESS ) ;