Exemple #1
0
//--------------------------------------------------------------------
void sht_switch_heating_element(unsigned char onoff, unsigned char pin)
//--------------------------------------------------------------------
// shwitches the internal heating element
// input onoff 0:off 1:on 
{
	unsigned char status;
	unsigned char checksum;
	sht_read_statusreg(&status, &checksum, pin);
	if (onoff==0) status &= ~(HEATER_BIT);
	else status |= (HEATER_BIT);
	sht_write_statusreg(&status, pin);
}
Exemple #2
0
unsigned char sht_scan(void)
{
    unsigned char i,tmp;

    NrSensorsAvailable = 0;

    for (i=0x80;i>0;i/=2) // Shift true mask
    {
        CurrentSensorMask = i & ScanMask;
        if (CurrentSensorMask) {   // Check if this bit needs to be checked?
            tmp = sht_read_statusreg();
            if(tmp == 0){ // Check for a responce of the sensor 0 means no crc errors
               NrSensorsAvailable++;  // Aha, the sensor responded
               SHTdevice_table[NrSensorsAvailable-1].mask = CurrentSensorMask; // Store the mask for later use
            }
        }
    
    }
    return NrSensorsAvailable;
}