Electrochemical Gas Sensor Library 1.0.0
A library for the Electrochemical Gas Sensor breakout board
Loading...
Searching...
No Matches
LMP91000.h
Go to the documentation of this file.
1// https://github.com/WickedDevice/LMP91000 library by WickedDevice
2
3#ifndef LMP91000_H
4#define LMP91000_H
5
6#if defined(ARDUINO) && ARDUINO >= 100
7#include <Arduino.h>
8#else
9#include <WProgram.h>
10#endif
11
12#include <Wire.h>
13
14#define LMP91000_I2C_ADDRESS (0x48) /* Device Address */
15#define LMP91000_STATUS_REG (0x00) /* Read only status register */
16#define LMP91000_LOCK_REG (0x01) /* Protection Register */
17#define LMP91000_TIACN_REG (0x10) /* TIA Control Register */
18#define LMP91000_REFCN_REG (0x11) /* Reference Control Register*/
19#define LMP91000_MODECN_REG (0x12) /* Mode Control Register */
20
21// LOCK register bitfield definition
22#define LMP91000_WRITE_LOCK (0x01) // default
23#define LMP91000_WRITE_UNLOCK (0x00)
24
25// STATUS register bitfield definition
26#define LMP91000_READY (0x01)
27#define LMP91000_NOT_READY (0x00)
28
29// TIACN register bitfield definition
30#define LMP91000_TIA_GAIN_EXT (0x00) // default
31#define LMP91000_TIA_GAIN_2P75K (0x04)
32#define LMP91000_TIA_GAIN_3P5K (0x08)
33#define LMP91000_TIA_GAIN_7K (0x0C)
34#define LMP91000_TIA_GAIN_14K (0x10)
35#define LMP91000_TIA_GAIN_35K (0x14)
36#define LMP91000_TIA_GAIN_120K (0x18)
37#define LMP91000_TIA_GAIN_350K (0x1C)
38#define LMP91000_RLOAD_10OHM (0X00)
39#define LMP91000_RLOAD_33OHM (0X01)
40#define LMP91000_RLOAD_50OHM (0X02)
41#define LMP91000_RLOAD_100OHM (0X03) // default
42
43// REFCN register bitfield definition
44#define LMP91000_REF_SOURCE_INT (0x00) // default
45#define LMP91000_REF_SOURCE_EXT (0x80)
46#define LMP91000_INT_Z_20PCT (0x00)
47#define LMP91000_INT_Z_50PCT (0x20) // default
48#define LMP91000_INT_Z_67PCT (0x40)
49#define LMP91000_INT_Z_BYPASS (0x60)
50#define LMP91000_BIAS_SIGN_NEG (0x00) // default
51#define LMP91000_BIAS_SIGN_POS (0x10)
52#define LMP91000_BIAS_0PCT (0x00) // default
53#define LMP91000_BIAS_1PCT (0x01)
54#define LMP91000_BIAS_2PCT (0x02)
55#define LMP91000_BIAS_4PCT (0x03)
56#define LMP91000_BIAS_6PCT (0x04)
57#define LMP91000_BIAS_8PCT (0x05)
58#define LMP91000_BIAS_10PCT (0x06)
59#define LMP91000_BIAS_12PCT (0x07)
60#define LMP91000_BIAS_14PCT (0x08)
61#define LMP91000_BIAS_16PCT (0x09)
62#define LMP91000_BIAS_18PCT (0x0A)
63#define LMP91000_BIAS_20PCT (0x0B)
64#define LMP91000_BIAS_22PCT (0x0C)
65#define LMP91000_BIAS_24PCT (0x0D)
66
67// MODECN register bitfield definition
68#define LMP91000_FET_SHORT_DISABLED (0x00) // default
69#define LMP91000_FET_SHORT_ENABLED (0x80)
70#define LMP91000_OP_MODE_DEEP_SLEEP (0x00) // default
71#define LMP91000_OP_MODE_GALVANIC (0x01)
72#define LMP91000_OP_MODE_STANDBY (0x02)
73#define LMP91000_OP_MODE_AMPEROMETRIC (0x03)
74#define LMP91000_OP_MODE_TIA_OFF (0x06)
75#define LMP91000_OP_MODE_TIA_ON (0x07)
76
77
78#define LMP91000_NOT_PRESENT (0xA8) // arbitrary library status code
79
80
82{
83
84 public:
85 LMP91000();
86 uint8_t status(void);
87 uint8_t lock();
88 uint8_t unlock();
89 uint8_t configure(uint8_t _tiacn, uint8_t _refcn, uint8_t _modecn);
90 uint8_t write(uint8_t reg, uint8_t data);
91 uint8_t read(uint8_t reg);
92
93 private:
94};
95
96#endif
uint8_t unlock()
Definition LMP91000.cpp:39
LMP91000()
Definition LMP91000.cpp:3
uint8_t read(uint8_t reg)
Definition LMP91000.cpp:18
uint8_t lock()
Definition LMP91000.cpp:35
uint8_t write(uint8_t reg, uint8_t data)
Definition LMP91000.cpp:7
uint8_t configure(uint8_t _tiacn, uint8_t _refcn, uint8_t _modecn)
Definition LMP91000.cpp:43
uint8_t status(void)
Definition LMP91000.cpp:31