summaryrefslogtreecommitdiff
path: root/include/driver/ccs811.h
blob: 8be0e6e45bd837a9f59264b01d5c3bb1fb9fd6b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright 2020 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
#ifndef CCS811_H
#define CCS811_H

class CCS811 {
	private:
		CCS811(const CCS811 &copy);
		unsigned char const address = 0x5a;
		unsigned char txbuf[5];
		unsigned char rxbuf[8];

	public:
		CCS811() {}

		unsigned short eco2;
		unsigned short tvoc;
		unsigned char status;
		unsigned char error_id;
		unsigned char raw_current;
		unsigned short raw_voltage;

		void init();
		unsigned char getStatus();
		unsigned char getError();
		unsigned char getManufacturerID();
		void startFirmware();
		void setMode(unsigned char mode);
		void read();
		void setEnv(unsigned char humi, unsigned char humi_fraction, unsigned char temp, unsigned char temp_fraction);
		void reset();
};

extern CCS811 ccs811;

#endif