Rev 1910 | Rev 1978 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1910 | Rev 1955 | ||
|---|---|---|---|
| Line 19... | Line 19... | ||
| 19 | #endif |
19 | #endif |
| 20 | 20 | ||
| 21 | void ConvertTemperature2_callback(uint8_t timer) |
21 | void ConvertTemperature2_callback(uint8_t timer) |
| 22 | { |
22 | { |
| 23 | uint8_t word[5]; |
23 | uint8_t word[5]; |
| 24 | if (dht11_readData( |
24 | if (dht11_readData((uint8_t*) word)) { |
| 25 | sendNewTemp = 1; |
25 | sendNewTemp = 1; |
| 26 | temperature = word[2]; |
26 | temperature = word[2]; |
| 27 | humidity = word[0]; |
27 | humidity = word[0]; |
| 28 | } |
28 | } |
| 29 | } |
29 | } |
| 30 | 30 | ||
| 31 | void |
31 | void ConvertTemperature_callback_DHT11(uint8_t timer) |
| 32 | { |
32 | { |
| 33 | dht11_start(); |
33 | dht11_start(); |
| 34 | Timer_SetTimeout(sns_DHT11_18MS_TIMER, 18, TimerTypeOneShot, &ConvertTemperature2_callback); |
34 | Timer_SetTimeout(sns_DHT11_18MS_TIMER, 18, TimerTypeOneShot, &ConvertTemperature2_callback); |
| 35 | } |
35 | } |
| 36 | 36 | ||
| Line 53... | Line 53... | ||
| 53 | #endif |
53 | #endif |
| 54 | ///TODO: Initialize hardware etc here |
54 | ///TODO: Initialize hardware etc here |
| 55 | 55 | ||
| 56 | // to use PCINt lib, call this function: (the callback function look as a timer callback function) |
56 | // to use PCINt lib, call this function: (the callback function look as a timer callback function) |
| 57 | // Pcint_SetCallbackPin(sns_DHT11_PCINT, EXP_C , &sns_DHT11_pcint_callback); |
57 | // Pcint_SetCallbackPin(sns_DHT11_PCINT, EXP_C , &sns_DHT11_pcint_callback); |
| 58 | Timer_SetTimeout(sns_DHT11_TIMER, 5000, TimerTypeFreeRunning, & |
58 | Timer_SetTimeout(sns_DHT11_TIMER, 5000, TimerTypeFreeRunning, &ConvertTemperature_callback_DHT11); |
| 59 | } |
59 | } |
| 60 | 60 | ||
| 61 | void sns_DHT11_Process(void) |
61 | void sns_DHT11_Process(void) |
| 62 | { |
62 | { |
| 63 | if (sendNewTemp) { |
63 | if (sendNewTemp) { |