FRDM-KL46Z_Pasos Es un programa que permite controlar un Motor a Pasos en sus diferntes modos de operación y tampbien permite controlar un Motor de CD en Modo ON-OFF Adelante y Atrás

Dependencies:   mbed Debounced tsi_sensor TSI TextLCD MMA8451Q USBDevice

DHT/dht22.h

Committer:
Antulius
Date:
2019-06-28
Revision:
1:e7f73d96ddde
Parent:
dht22.h@ 0:a935d23434d9

File content as of revision 1:e7f73d96ddde:

/*
 * (C) The University of Kent and Simon Cooksey 2015.
 */
 
#ifndef __DHT22_h_
#define __DHT22_h_
 
// We'll pick a point to decide if a signal is 1 or 0 from. 
#define DHT22_SIGNAL_HIGH_LOW_BOUNDARY      50   // uS
#define DHT22_START_BIT_TIME                500  // uS
#define DHT22_START_BIT_RESPONSE            80   // uS
 
typedef enum {
    EDGE_TYPE_FALLING,
    EDGE_TYPE_RISING,
} edge_type_t;
 
typedef struct {
    int temp;
    int humidity;
    uint8_t checksum;
} DHT22_data_t;
 
class DHT22 {
public:
    DHT22(PinName pin)  : dht22_s(pin) { }
    void read(DHT22_data_t * data);
private:
    DigitalInOut dht22_s;
 
    int wait_for_edge(edge_type_t type);
    void send_start();
    void await_start_response();
    int16_t read_word();
    uint8_t read_checksum();
};
 
#endif // __DHT22_h_