Release candidate version. The pointer in GAS Pressure display is changed to a triangle.

Dependencies:   UniGraphic mbed vt100

Please note, at 2-Mar-2018 the current version of mbed-lib has a defect in Ticker.
https://os.mbed.com/forum/bugs-suggestions/topic/29287/

So, mbed lib version 157 is intentionally being used.
Please do not update mbed library until the problem in the above URL is fixed.

In this version, format of GAS Pressure Display has been changed.
/media/uploads/Rhyme/low.jpg

/media/uploads/Rhyme/good.jpg

/media/uploads/Rhyme/high.jpg

moto

Revision:
0:774324cbc5a6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sensors/LM75B.cpp	Fri Mar 02 07:56:09 2018 +0000
@@ -0,0 +1,122 @@
+#include "mbed.h"
+#include "LM75B.h"
+#include "af_mgr.h"
+
+/* Register list */
+#define PTR_CONF    0x01
+#define PTR_TEMP    0x00
+#define PTR_TOS     0x03
+#define PTR_THYST   0x02
+
+/* Configuration register */
+/* B[7:5] : Reserved */
+/* B[4:3] : OS_F_QUE[1:0] OS fault queue value */
+#define CONFIG_QUE_1    0x00
+#define CONFIG_QUE_2    (0x01 << 3)
+#define CONFIG_QUE_4    (0x10 << 3)
+#define CONFIG_QUE_6    (0x11 << 3) 
+/* B[2] : OS_POL  0 = OS active LOW,  1 = OS active HIGH */
+#define CONFIG_OS_POL_L 0x00
+#define CONFIG_OS_POL_H (0x01 << 2)
+/* B[1] : OS_COMP_INT 0 = OS comparator, 1 = OS interrupt */
+#define CONFIG_OS_COMP  0x00
+#define CONFIG_OS_INT   (0x01 << 1)
+/* B[0] : SHUTDOWN    0 = normal, 1 = shutdown */
+#define CONFIG_NORMARL  0x00
+#define CONFIG_SHUTDOWN 0x01
+
+/* Temperature register */
+/* D[15:5] = 11 bit data 0.125 * temp data */
+/* D[4:0] : reserved */
+
+/* Tos register */
+/* D[15:7] = 9 bit data */
+/* D[6:0] : reserved */
+
+/* Thyst register */
+/* D[15:7] = 9 ibt data */
+/* D[6:0] : reserved */
+
+LM75B::LM75B(I2C *i2c, int addr) : m_addr(addr<<1) {
+    p_i2c = i2c ;
+    p_i2c->frequency(100000); /* 100kHz */
+    // activate the peripheral
+}
+
+LM75B::~LM75B() { }
+
+int LM75B::temp(int8_t *temp)
+{
+    int result ;
+    char t[1] = { 0x00 } ;
+    result = p_i2c->write(m_addr, t, 1, true) ;
+    if (result == 0) {
+        result = p_i2c->read(m_addr, t, 1) ;
+    }
+    if (result == 0) {
+        *temp = (int8_t)t[0] ;
+    }
+    return( result ) ;
+}
+
+int LM75B::getTemp(float *temp)
+{
+    int result ;
+    char t[2] = { 0, 0 } ;
+    int16_t iTemp = 0 ;
+    result = p_i2c->write(m_addr, t, 1) ; /* write pointer byte 0x00 */
+    if (result == 0) {
+        result = p_i2c->read(m_addr, t, 2) ; /* read MSB, LSB */
+    }
+    if (result == 0) {
+        iTemp = (t[0] << 8) | t[1] ;
+        iTemp >>= 5 ;
+        *temp = 0.125 * iTemp ;
+    }
+    return( result ) ;
+}
+
+int LM75B::getConfig(uint8_t ptr_byte, uint8_t *config_data) 
+{
+    int result ;
+    char config = 0x00 ; /* default value */
+    result = p_i2c->write(m_addr, (char*)(&ptr_byte), 1, true) ;
+    if (result == 0) {
+        result = p_i2c->read(m_addr, &config, 1) ;
+    }
+    if (result == 0) {
+        *config_data = config ;
+    }
+    return( result ) ;
+}
+
+int LM75B::setConfig(uint8_t ptr_byte, uint8_t config_data) 
+{
+    int result ;
+    char t[2] ;
+    t[0] = ptr_byte ;
+    t[1] = config_data ;
+    result = p_i2c->write(m_addr, t, 2, true) ;
+    return( result ) ;
+}
+
+int LM75B::readRegs(int addr, uint8_t * data, int len) 
+{
+    int result ;
+    char t[1] = {addr};
+    __disable_irq() ; // Disable Interrupts
+    result = p_i2c->write(m_addr, t, 1, true);
+    if (result == 0) {
+        result = p_i2c->read(m_addr, (char *)data, len);
+    }
+    __enable_irq() ; // Enable Interrupts
+    return( result ) ;
+}
+
+int LM75B::writeRegs(uint8_t * data, int len) {
+    int result ;
+    __disable_irq() ; // Disable Interrupts
+    result = p_i2c->write(m_addr, (char *)data, len);
+    __enable_irq() ; // Enable Interrupts
+    return( result ) ;
+}
\ No newline at end of file