-
Notifications
You must be signed in to change notification settings - Fork 4
/
AmbaSatSI1132.h
66 lines (58 loc) · 2.14 KB
/
AmbaSatSI1132.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*******************************************************************************
* AmbaSat-1
* Filename: AmbaSatSI1132.h
*
* This library is designed specifically for AmbaSat-1 and the
* SI1132 sensor
* with contributions by Michael F. Kamprath, https://github.com/michaelkamprath
*
* AmbaSat opensource code available on GitHub at:
* https://github.com/ambasat
* Copyright (c) 2021 AmbaSat Ltd
* https://ambasat.com
*
* licensed under Creative Commons Attribution-ShareAlike 3.0
* ******************************************************************************/
#ifndef __AmbaSatSI1132__
#define __AmbaSatSI1132__
#define SI1132_RESULTS_BUFFER_SIZE 9
#include <Arduino.h>
#include <Wire.h>
#include <Debugging.h>
class AmbaSatSI1132
{
private:
uint8_t measureRate0;
uint8_t measureRate1;
uint8_t adcGainVisible;
uint8_t adcGainInfraRed;
bool highSignalVisible;
bool highSignalInfraRed;
bool begin(void);
void reset(void);
bool waitUntilSleep(void);
bool sendCommand(uint8_t cmd_value);
bool setParameter(uint8_t param, uint8_t value);
uint8_t readParameter(uint8_t param);
uint8_t readResponseRegister(void);
bool writeRegister(uint8_t address, uint8_t value);
bool readRegister(uint8_t address, uint8_t& register_value);
bool readRegisters(uint8_t address, uint8_t* data, size_t length) ;
protected:
public:
uint16_t uv;
uint16_t vis;
uint16_t ir;
AmbaSatSI1132();
void setup(void);
bool readSensor(void);
uint8_t getVisibleADCGain(void) const { return adcGainVisible; }
void setVisibleADCGain(uint8_t setting);
uint8_t getInfraRedADCGain(void) const { return adcGainInfraRed; }
void setInfraRedADCGain(uint8_t setting);
bool isVisibleHighSignalRange(void) const { return highSignalVisible; }
void setIsVisibleHighSignalRange(bool setting);
bool isInfraRedHighSignalRange(void) const { return highSignalInfraRed; }
void setIsInfraRedHighSignalRange(bool setting);
};
#endif //__AmbaSatSI1132__