Beispiel #1
0
void dht11responseStatus(){
	switch(step){
	case CHECKIFRESPONSEISOKSTEP:
		status1 = HWREG(GPIO_PORTB | GPIO_OFFSET_DATA) & 0x02;
		responseStatusOk1 = (status1) ? 1:0; //if a high on pin 1

		if(responseStatusOk0 == 1 && responseStatusOk1 ==  1){
			; //DO NOTHING
		}
		else{
			lcdClear();
			lcdWriteLine("Bad Response.");
			SysCtlDelay(1000000);
			dht11init();
		}

		TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet()/16666);	//Wait 40us
		TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
		TimerEnable(TIMER0_BASE, TIMER_A);

		process++;
		step = 0;
		break;
	};
}
Beispiel #2
0
int dht11dataValidationStatus(){
	if(sum == sumDataCheck){
		return 1;
	}
	else{
		dht11init();
		return 0;
	};
}
Beispiel #3
0
/* SensorServer Refresh Function for DHT.
 * Takes a new measurement  and stores it in the buffer.
 */
void ABSSRefreshDHT(){

	//Refresh Sequence.
	if(dht11CanRefresh()){
		dht11init();
		dht11getData();
		while(dhtIsActive());
	}

	//Buffer Storage:

	//DHT Humidity
	ABSSBufferRefresh(&ABSSBufferDHTHumidity, dht22GetHumidity());

	//DHT Temperature
	ABSSBufferRefresh(&ABSSBufferDHTTemperature, dht22GetTemperature());
}
Beispiel #4
0
void dhtSetup(){

	dht11ClockSetup();

	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
	GPIOPinConfigure(GPIO_PORTB_BASE);
	GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE,GPIO_PIN_1);

	IntMasterEnable();

	//Timer 0
	SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
	TimerConfigure(TIMER0_BASE, TIMER_CFG_ONE_SHOT);
	TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet());
	IntEnable(INT_TIMER0A);

	//Timer 1
	SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
	TimerConfigure(TIMER1_BASE, TIMER_CFG_PERIODIC);
	TimerLoadSet(TIMER1_BASE, TIMER_A, SysCtlClockGet()/1000000);
	IntEnable(INT_TIMER1A);

	dht11init();
}