AM2321 library

Dependents:   mbed_AM2321_copy mbed_AM2321

See http://developer.mbed.org/users/yasuyuki/notebook/AM2321/

AM2321.h

Committer:
yasuyuki
Date:
2015-07-10
Revision:
1:39f20504d5c5
Parent:
0:3656aea4e6f6

File content as of revision 1:39f20504d5c5:

//**********************
// AM2321.h for mbed
//
// (C)Copyright 2014 All rights reserved by Y.Onodera
// http://einstlab.web.fc2.com
//**********************
#ifndef AM2321_H_
#define AM2321_H_

#define AM2321_ADDR    0xB8
#define AM2321_HUM_H  0x00
#define AM2321_HUM_L  0x01
#define AM2321_TEMP_H  0x02
#define AM2321_TEMP_L  0x03

#include "mbed.h"
#include "typedef.h"

class AM2321{
public:
    AM2321 (PinName sda, PinName scl);
    AM2321 (I2C& p_i2c);

    void get();
    unsigned short humidity();
    signed short temperature();

protected:
    
    I2C _i2c;

    WORD_VAL hum;
    WORD_VAL temp;
    char buf[8];

};

#endif /* AM2321_H_ */