SHT3x driver - minor correction
- number of ticks for measurement duration takes now into account portTICK_PERIOD_MS
This commit is contained in:
parent
994d667a8c
commit
3649ab6270
1 changed files with 8 additions and 10 deletions
|
|
@ -63,18 +63,16 @@
|
|||
|
||||
const uint16_t SHT3x_MEASURE_CMD[6][3] = { {0x2c06,0x2c0d,0x2c10}, // [SINGLE_SHOT][H,M,L]
|
||||
{0x2032,0x2024,0x202f}, // [PERIODIC_05][H,M,L]
|
||||
{0x2130,0x2126,0x212d}, // [PERIODIC_05][H,M,L]
|
||||
{0x2236,0x2220,0x222b}, // [PERIODIC_05][H,M,L]
|
||||
{0x2234,0x2322,0x2329}, // [PERIODIC_05][H,M,L]
|
||||
{0x2737,0x2721,0x272a} }; // [PERIODIC_05][H,M,L]
|
||||
|
||||
#define max(a,b) (a) > (b) ? a : b
|
||||
{0x2130,0x2126,0x212d}, // [PERIODIC_1 ][H,M,L]
|
||||
{0x2236,0x2220,0x222b}, // [PERIODIC_2 ][H,M,L]
|
||||
{0x2234,0x2322,0x2329}, // [PERIODIC_4 ][H,M,L]
|
||||
{0x2737,0x2721,0x272a} }; // [PERIODIC_10][H,M,L]
|
||||
|
||||
// tick counts [High, Medium, Low]
|
||||
// minimum is one tick if portTICK_PERIOD_MS is greater than 20 or 30 ms
|
||||
const int32_t SHT3x_MEASURE_DURATION[3] = { max(30/portTICK_PERIOD_MS,1),
|
||||
max(20/portTICK_PERIOD_MS,1),
|
||||
max(20/portTICK_PERIOD_MS,1) };
|
||||
const int32_t SHT3x_MEASURE_DURATION[3] = { (30 + portTICK_PERIOD_MS-1)/portTICK_PERIOD_MS,
|
||||
(20 + portTICK_PERIOD_MS-1)/portTICK_PERIOD_MS,
|
||||
(20 + portTICK_PERIOD_MS-1)/portTICK_PERIOD_MS };
|
||||
|
||||
#ifdef SHT3x_DEBUG
|
||||
#define debug(s, f, ...) printf("%s %s: " s "\n", "SHT3x", f, ## __VA_ARGS__)
|
||||
|
|
@ -107,7 +105,7 @@ bool sht3x_init_driver()
|
|||
sht3x_sensor_t* sht3x_init_sensor(uint8_t bus, uint8_t addr)
|
||||
{
|
||||
sht3x_sensor_t* dev;
|
||||
|
||||
|
||||
if ((dev = malloc (sizeof(sht3x_sensor_t))) == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue