|
5 | 5 | * @author Noah (@BobSaidHi <https://github.com/bobsaidhi>) for |
6 | 6 | * @CalPolyWindPower <https://github.com/calpolywindpower> |
7 | 7 | * @since 20260207 (@07507a) |
8 | | - * @version 0.2.0 |
| 8 | + * @version 0.3.0 |
9 | 9 | */ |
10 | 10 | #pragma once |
11 | 11 |
|
12 | 12 | // MARK: Includes |
13 | 13 | #include <Adafruit_BusIO_Register.h> |
14 | 14 | #include <Adafruit_I2CDevice.h> |
15 | 15 | #include <cstdint> |
16 | | -#include <etl/format_spec.h> |
17 | | -#include <etl/string.h> |
18 | | -#include <etl/to_string.h> |
| 16 | +// #include <etl/format_spec.h> |
| 17 | +// #include <etl/string.h> |
| 18 | +// #include <etl/to_string.h> |
19 | 19 |
|
20 | 20 | /** |
21 | 21 | * @brief Class to interface with the MCP23008T I2C 8-Bit I/O Expander |
@@ -251,26 +251,35 @@ class MCP23008T { |
251 | 251 | return device.address(); |
252 | 252 | } |
253 | 253 |
|
254 | | - static constexpr uint_fast8_t LOG_STRING_SIZE = 3 + 5 + 2 + (3 * 2) + 1; |
255 | 254 | /** |
256 | | - * @brief Get at string that describes the current state of the actuator |
257 | | - * @returns the current state of the actuator as a string |
| 255 | + * @details The GPIO register reflects the value on the port. Reading from |
| 256 | + * this register reads the port. Writing to this register modifies the |
| 257 | + * Output Latch (OLAT) register. |
| 258 | + * |
| 259 | + * @returns Returns the value of the GPIO register, or 0xFFFFFFFF on failure |
258 | 260 | */ |
259 | | - etl::string<LOG_STRING_SIZE> getLogString() { |
260 | | - etl::string<LOG_STRING_SIZE> logString(TAG); // 3 chars |
261 | | - logString.append(": @ox"); // 5 chars |
| 261 | + inline uint32_t readGPIO() { return regGPIO.read(); } |
262 | 262 |
|
263 | | - etl::format_spec format2; |
264 | | - format2.hex().width(2).fill('0'); // [2 chars] |
265 | | - etl::to_string(getAddress(), logString, format2, true); // 2 chars |
| 263 | + // static constexpr uint_fast8_t LOG_STRING_SIZE = 3 + 5 + 2 + (3 * 2) + 1; |
| 264 | + // /** |
| 265 | + // * @brief Get at string that describes the current state of the actuator |
| 266 | + // * @returns the current state of the actuator as a string |
| 267 | + // */ |
| 268 | + // etl::string<LOG_STRING_SIZE> getLogString() { |
| 269 | + // etl::string<LOG_STRING_SIZE> logString(TAG); // 3 chars |
| 270 | + // logString.append(": @ox"); // 5 chars |
266 | 271 |
|
267 | | - etl::format_spec format3; |
268 | | - format3.hex().width(3).fill('0'); // [3 chars] |
269 | | - etl::to_string(readIntCap(), logString, format3, true); // 3 chars |
270 | | - etl::to_string(readIntFlag(), logString, format3, true); // 3 chars |
| 272 | + // etl::format_spec format2; |
| 273 | + // format2.hex().width(2).fill('0'); // [2 chars] |
| 274 | + // etl::to_string(getAddress(), logString, format2, true); // 2 chars |
271 | 275 |
|
272 | | - return logString; |
273 | | - } |
| 276 | + // etl::format_spec format3; |
| 277 | + // format3.hex().width(3).fill('0'); // [3 chars] |
| 278 | + // etl::to_string(readIntCap(), logString, format3, true); // 3 chars |
| 279 | + // etl::to_string(readIntFlag(), logString, format3, true); // 3 chars |
| 280 | + |
| 281 | + // return logString; |
| 282 | + // } |
274 | 283 |
|
275 | 284 | private: // MARK: Private |
276 | 285 | Adafruit_I2CDevice device; |
|
0 commit comments