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

Committer:
Rhyme
Date:
Fri Mar 02 07:56:09 2018 +0000
Revision:
0:774324cbc5a6
Release candidate version. GAS Pressure pointer is now a triangle.; Some source file clean-up was done.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:774324cbc5a6 1 #ifndef _LM75B_H_
Rhyme 0:774324cbc5a6 2 #define _LM75B_H_
Rhyme 0:774324cbc5a6 3
Rhyme 0:774324cbc5a6 4 #include "mbed.h"
Rhyme 0:774324cbc5a6 5
Rhyme 0:774324cbc5a6 6 /**
Rhyme 0:774324cbc5a6 7 * NXP LM75B Digital temperature sensor and thermal watchdog
Rhyme 0:774324cbc5a6 8 *
Rhyme 0:774324cbc5a6 9 * @code
Rhyme 0:774324cbc5a6 10 #include "mbed.h"
Rhyme 0:774324cbc5a6 11 #include "LM75B.h"
Rhyme 0:774324cbc5a6 12 #define LM75B_I2C_ADDRESS (0x48)
Rhyme 0:774324cbc5a6 13
Rhyme 0:774324cbc5a6 14 #if defined (TARGET_KL25Z)
Rhyme 0:774324cbc5a6 15 #define PIN_SCL PTE1
Rhyme 0:774324cbc5a6 16 #define PIN_SDA PTE0
Rhyme 0:774324cbc5a6 17 #elif defined (TARGET_KL46Z)
Rhyme 0:774324cbc5a6 18 #define PIN_SCL PTE1
Rhyme 0:774324cbc5a6 19 #define PIN_SDA PTE0
Rhyme 0:774324cbc5a6 20 #elif defined (TARGET_K64F)
Rhyme 0:774324cbc5a6 21 #define PIN_SCL PTE24
Rhyme 0:774324cbc5a6 22 #define PIN_SDA PTE25
Rhyme 0:774324cbc5a6 23 #elif defined (TARGET_K22F)
Rhyme 0:774324cbc5a6 24 #define PIN_SCL PTE1
Rhyme 0:774324cbc5a6 25 #define PIN_SDA PTE0
Rhyme 0:774324cbc5a6 26 #elif defined (TARGET_KL05Z)
Rhyme 0:774324cbc5a6 27 #define PIN_SCL PTB3
Rhyme 0:774324cbc5a6 28 #define PIN_SDA PTB4
Rhyme 0:774324cbc5a6 29 #elif defined (TARGET_NUCLEO_F411RE)
Rhyme 0:774324cbc5a6 30 #define PIN_SCL PB_8
Rhyme 0:774324cbc5a6 31 #define PIN_SDA PB_9
Rhyme 0:774324cbc5a6 32 #else
Rhyme 0:774324cbc5a6 33 #error TARGET NOT DEFINED
Rhyme 0:774324cbc5a6 34 #endif
Rhyme 0:774324cbc5a6 35
Rhyme 0:774324cbc5a6 36 int main() {
Rhyme 0:774324cbc5a6 37 int8_t itemp = 0 ;
Rhyme 0:774324cbc5a6 38 float ftemp = 0.0 ;
Rhyme 0:774324cbc5a6 39 LM75B lm75b(PIN_SDA, PIN_SCL, LM75B_I2C_ADDRESS) ;
Rhyme 0:774324cbc5a6 40
Rhyme 0:774324cbc5a6 41 while(1) {
Rhyme 0:774324cbc5a6 42 itemp = lm75b.temp() ;
Rhyme 0:774324cbc5a6 43 lm75b.getTemp(&ftemp) ;
Rhyme 0:774324cbc5a6 44 printf("Temp = %d C degree, %.3f C degree\n", itemp, ftemp) ;
Rhyme 0:774324cbc5a6 45 wait(1) ;
Rhyme 0:774324cbc5a6 46 }
Rhyme 0:774324cbc5a6 47 }
Rhyme 0:774324cbc5a6 48 * @endcode
Rhyme 0:774324cbc5a6 49 */
Rhyme 0:774324cbc5a6 50 class LM75B
Rhyme 0:774324cbc5a6 51 {
Rhyme 0:774324cbc5a6 52 public:
Rhyme 0:774324cbc5a6 53 /**
Rhyme 0:774324cbc5a6 54 * LM75B constructor
Rhyme 0:774324cbc5a6 55 *
Rhyme 0:774324cbc5a6 56 * @param i2c pointer to the I2C object
Rhyme 0:774324cbc5a6 57 * @param addr addr of the I2C peripheral
Rhyme 0:774324cbc5a6 58 */
Rhyme 0:774324cbc5a6 59 LM75B(I2C *i2c, int addr);
Rhyme 0:774324cbc5a6 60
Rhyme 0:774324cbc5a6 61 /**
Rhyme 0:774324cbc5a6 62 * LM75B destructor
Rhyme 0:774324cbc5a6 63 */
Rhyme 0:774324cbc5a6 64 ~LM75B();
Rhyme 0:774324cbc5a6 65
Rhyme 0:774324cbc5a6 66 /**
Rhyme 0:774324cbc5a6 67 * get temperature as one byte (signed)
Rhyme 0:774324cbc5a6 68 * @param *temp int8_t returns integer part of the temperature
Rhyme 0:774324cbc5a6 69 * @return 0: success not-0: failure
Rhyme 0:774324cbc5a6 70 */
Rhyme 0:774324cbc5a6 71 int temp(int8_t *temp) ;
Rhyme 0:774324cbc5a6 72
Rhyme 0:774324cbc5a6 73 /**
Rhyme 0:774324cbc5a6 74 * get temperature as 11 bit (float)
Rhyme 0:774324cbc5a6 75 * @param *temp float returns the temperature as float
Rhyme 0:774324cbc5a6 76 * @return 0: success not-0: failure
Rhyme 0:774324cbc5a6 77 */
Rhyme 0:774324cbc5a6 78 int getTemp(float *temp) ;
Rhyme 0:774324cbc5a6 79
Rhyme 0:774324cbc5a6 80 /**
Rhyme 0:774324cbc5a6 81 * get configuration register
Rhyme 0:774324cbc5a6 82 * @param ptr_byte uint8_t pointer value for the register
Rhyme 0:774324cbc5a6 83 * @param *config_data uint8_t value of the config register
Rhyme 0:774324cbc5a6 84 * @return 0: success non-0: failure
Rhyme 0:774324cbc5a6 85 */
Rhyme 0:774324cbc5a6 86 int getConfig(uint8_t ptr_byte, uint8_t *config_data) ;
Rhyme 0:774324cbc5a6 87
Rhyme 0:774324cbc5a6 88 /**
Rhyme 0:774324cbc5a6 89 * set configuration register
Rhyme 0:774324cbc5a6 90 * @param ptr_byte uint8_t pointer value for the register
Rhyme 0:774324cbc5a6 91 * @param config_data uint8_t value to set in the config register
Rhyme 0:774324cbc5a6 92 * @return 0: success non-0: failure
Rhyme 0:774324cbc5a6 93 */
Rhyme 0:774324cbc5a6 94 int setConfig(uint8_t ptr_byte, uint8_t config_data) ;
Rhyme 0:774324cbc5a6 95
Rhyme 0:774324cbc5a6 96 private:
Rhyme 0:774324cbc5a6 97 I2C *p_i2c;
Rhyme 0:774324cbc5a6 98 int m_addr;
Rhyme 0:774324cbc5a6 99 int readRegs(int addr, uint8_t * data, int len);
Rhyme 0:774324cbc5a6 100 int writeRegs(uint8_t * data, int len);
Rhyme 0:774324cbc5a6 101
Rhyme 0:774324cbc5a6 102 };
Rhyme 0:774324cbc5a6 103
Rhyme 0:774324cbc5a6 104 #endif