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) 反転させることにより、疑似リセットクロックを生成します。

その後は、通常の起動手順に復帰し、以降はこれまでと同様の動作をします。

Files at this revision

API Documentation at this revision

Comitter:
gaku_miyagawa
Date:
Mon Jun 18 02:55:38 2018 +0000
Parent:
1:1af1fd910340
Commit message:
SBU SPECIAL

Changed in this revision

edge_sensor/edge_pressure.cpp Show annotated file Show diff for this revision Revisions of this file
sensors/PSE530.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1af1fd910340 -r de22987be9ba edge_sensor/edge_pressure.cpp
--- 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 ) ;
diff -r 1af1fd910340 -r de22987be9ba sensors/PSE530.cpp
--- a/sensors/PSE530.cpp	Fri Apr 06 04:17:34 2018 +0000
+++ b/sensors/PSE530.cpp	Mon Jun 18 02:55:38 2018 +0000
@@ -48,8 +48,8 @@
  */
 float PSE530::getPressure(void)
 {
-    float coef_A = 1.277 ;
-    float coef_B = -0.250 ;
+    float coef_A = 1.356 ;
+    float coef_B = -0.272 ;
     float av = 0.0 ;
     float value = 0.0 ;
     av = coef_A * _ain->read() + coef_B ;