Skip to content

Commit 2123cc1

Browse files
committed
Class info, address info
1 parent 312b841 commit 2123cc1

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

include/CommonConfig.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ namespace RUN {
4848

4949
// MARK: Load
5050
namespace LOAD {
51+
constexpr uint8_t I2C_ADDRESS = 0x4E; // A0-A2 all high
52+
5153
/**
5254
* @brief Bitmask for the load control pins.
5355
* @details Only the first 6 pins (0-5) are used for load control.

lib/MCP23008T/MCP23008T.hpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
#include <Adafruit_I2CDevice.h>
55
#include <cstdint>
66

7+
/**
8+
* @brief Class to interface with the MCP23008T I2C 8-Bit I/O Expander
9+
* @see
10+
* https://www.digikey.com/en/products/detail/microchip-technology/MCP23008T-E-SS/736037
11+
*/
712
class MCP23008T {
813
public:
914
static constexpr uint16_t REG_IODIR_ADDR = 0x00;
@@ -20,7 +25,21 @@ class MCP23008T {
2025

2126
static constexpr uint8_t ONE_BYTE = 1;
2227

23-
MCP23008T(uint8_t address, TwoWire *wire = &Wire) : device(address, wire) {}
28+
/**
29+
* Valid addresses are 0x40, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4C, & 0x4E
30+
*/
31+
enum I2C_ADDRESS: uint8_t {
32+
I2C_ADDR_0x40 = 0x40,
33+
I2C_ADDR_0x42 = 0x42,
34+
I2C_ADDR_0x44 = 0x44,
35+
I2C_ADDR_0x46 = 0x46,
36+
I2C_ADDR_0x48 = 0x48,
37+
I2C_ADDR_0x4A = 0x4A,
38+
I2C_ADDR_0x4C = 0x4C,
39+
I2C_ADDR_0x4E = 0x4E
40+
};
41+
42+
MCP23008T(I2C_ADDRESS address = I2C_ADDR_0x40, TwoWire *wire = &Wire) : device(address, wire) {}
2443

2544
bool begin() {
2645
if (!device.begin()) {

0 commit comments

Comments
 (0)