| 
    upm
    0.3.2
    
   Sensor/Actuator repository for libmraa (v0.7.2) 
   | 
 
API support for the Grove CO2 sensor. More...
This class implements support for the Grove CO2 sensor.
Its CO2 detection range is 0-2,000 ppm. It requires a 2-3 minute warm-up time before reporting valid data.
Public Member Functions | |
| MHZ16 (int uart) | |
| ~MHZ16 () | |
| bool | dataAvailable (unsigned int millis) | 
| int | readData (char *buffer, size_t len) | 
| int | writeData (char *buffer, size_t len) | 
| bool | setupTty (speed_t baud=B9600) | 
| bool | verifyPacket (unsigned char *pkt) | 
| bool | getData (int *gas, int *temp) | 
| void | calibrateZeroPoint () | 
Protected Member Functions | |
| int | ttyFd () | 
| int | setTtyFd (int fd) | 
| bool dataAvailable | ( | unsigned int | millis | ) | 
Checks to see if there is data available for reading
| millis | Number of milliseconds to wait; 0 means no waiting. | 
| int readData | ( | char * | buffer, | 
| size_t | len | ||
| ) | 
Reads any available data in a user-supplied buffer. Note: the call blocks until data is available to be read. Use dataAvailable() to determine whether there is data available beforehand, to avoid blocking.
| buffer | Buffer to hold the data read | 
| len | Length of the buffer | 
| int writeData | ( | char * | buffer, | 
| size_t | len | ||
| ) | 
Writes the data in the buffer to the device
| buffer | Buffer to hold the data read | 
| len | Length of the buffer | 
| bool setupTty | ( | speed_t | baud = B9600 | ) | 
Sets up proper tty I/O modes and the baud rate. The default baud rate is 9,600 (B9600).
| baud | Desired baud rate. | 
| bool verifyPacket | ( | unsigned char * | pkt | ) | 
Verifies the packet header and indicates its validity
| pkt | Packet to check | 
| bool getData | ( | int * | gas, | 
| int * | temp | ||
| ) | 
Queries the sensor and returns gas (CO2) concentration and temperature data.
| gas | Returned gas concentration | 
| temp | Returned temperature in Celsius | 
| void calibrateZeroPoint | ( | ) | 
Sets the zero point of the sensor
 1.8.9.1