Fixed sht11 driver, now ensures the i2c bus is disabled when initializing

This commit is contained in:
Antonio Lignan 2012-08-16 13:38:11 +02:00
parent 73e7f25cbc
commit c5e9d688a5
4 changed files with 14 additions and 1 deletions

View file

@ -212,6 +212,17 @@ sht11_init(void)
#ifdef SHT11_INIT
SHT11_INIT();
#else
/* As this driver is bit-bang based, disable the I2C first
This assumes the SDA/SCL pins passed in the -arch.h file are
actually the same used for I2C operation, else comment out the following
*/
#warning SHT11: DISABLING I2C BUS
SHT11_PxSEL &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL));
#if defined(__MSP430_HAS_MSP430X_CPU__) || defined(__MSP430_HAS_MSP430XV2_CPU__)
SHT11_PxREN &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL));
#endif
/* Configure SDA/SCL as GPIOs */
SHT11_PxOUT |= BV(SHT11_ARCH_PWR);
SHT11_PxOUT &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL));
SHT11_PxDIR |= BV(SHT11_ARCH_PWR) | BV(SHT11_ARCH_SCL);

View file

@ -3,7 +3,7 @@ TARGET=z1
endif
CONTIKI_PROJECT = test-phidgets blink test-adxl345 test-tmp102 test-light-ziglet test-battery test-sht11 test-relay-phidget #test-potent
CONTIKI_SOURCEFILES += sht11.c potentiometer-sensor.c
CONTIKI_SOURCEFILES += sht11.c# potentiometer-sensor.c
APPS=serial-shell

View file

@ -48,5 +48,6 @@
#define SHT11_PxIN P1IN
#define SHT11_PxOUT P1OUT
#define SHT11_PxSEL P1SEL
#define SHT11_PxREN P1REN
#endif

View file

@ -56,5 +56,6 @@
#define SHT11_PxIN P5IN
#define SHT11_PxOUT P5OUT
#define SHT11_PxSEL P5SEL
#define SHT11_PxREN P5REN
#endif