Merge pull request #505 from ianno/develop
Fixed driver for DHT22 sensor in zoul platform
This commit is contained in:
commit
d3aa0dcf6d
@ -72,7 +72,7 @@ dht22_read(void)
|
||||
{
|
||||
uint8_t i;
|
||||
uint8_t j = 0;
|
||||
uint8_t last_state;
|
||||
uint8_t last_state = 0xFF;
|
||||
uint8_t counter = 0;
|
||||
uint8_t checksum = 0;
|
||||
|
||||
@ -95,7 +95,6 @@ dht22_read(void)
|
||||
* if the line is high between 70-74us the bit sent will be "1" (one).
|
||||
*/
|
||||
GPIO_SET_INPUT(DHT22_PORT_BASE, DHT22_PIN_MASK);
|
||||
last_state = GPIO_READ_PIN(DHT22_PORT_BASE, DHT22_PIN_MASK);
|
||||
|
||||
for(i = 0; i < DHT22_MAX_TIMMING; i++) {
|
||||
counter = 0;
|
||||
@ -208,8 +207,8 @@ value(int type)
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
dht22_read_all(int *temperature, int *humidity)
|
||||
int16_t
|
||||
dht22_read_all(int16_t *temperature, int16_t *humidity)
|
||||
{
|
||||
if((temperature == NULL) || (humidity == NULL)) {
|
||||
PRINTF("DHT22: Invalid arguments\n");
|
||||
|
@ -90,7 +90,7 @@
|
||||
#define DHT22_COUNT 8 /**< Minimum ticks to detect a "1" bit */
|
||||
#define DHT22_MAX_TIMMING 85 /**< Maximum ticks in a single operation */
|
||||
#define DHT22_READING_DELAY 1 /**< 1 us */
|
||||
#define DHT22_READY_TIME 20 /**< 40 us */
|
||||
#define DHT22_READY_TIME 40 /**< 40 us */
|
||||
#define DHT22_START_TIME (RTIMER_SECOND / 50) /**< 20 ms */
|
||||
#define DHT22_AWAKE_TIME (RTIMER_SECOND / 4) /**< 250 ms */
|
||||
/** @} */
|
||||
@ -99,7 +99,7 @@
|
||||
* \name DHT22 auxiliary functions
|
||||
* @{
|
||||
*/
|
||||
int dht22_read_all(int *temperature, int *humidity);
|
||||
int16_t dht22_read_all(int16_t *temperature, int16_t *humidity);
|
||||
/** @} */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#define DHT22_SENSOR "DHT22 sensor"
|
||||
|
@ -1,9 +1,9 @@
|
||||
CONTIKI_PROJECT = test-tsl256x test-sht25 test-servo.c
|
||||
CONTIKI_PROJECT = test-tsl256x test-sht25 test-servo
|
||||
CONTIKI_PROJECT += test-bmp085-bmp180 test-motion test-rotation-sensor
|
||||
CONTIKI_PROJECT += test-grove-light-sensor test-grove-loudness-sensor
|
||||
CONTIKI_PROJECT += test-weather-meter test-grove-gyro test-lcd test-iaq
|
||||
CONTIKI_PROJECT += test-pm10-sensor test-vac-sensor test-aac-sensor
|
||||
CONTIKI_PROJECT += test-zonik test-dht22.c test-ac-dimmer.c
|
||||
CONTIKI_PROJECT += test-zonik test-dht22 test-ac-dimmer
|
||||
CONTIKI_PROJECT += test-bme280
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += tsl256x.c sht25.c bmpx8x.c motion-sensor.c
|
||||
|
Loading…
Reference in New Issue
Block a user