11/* *
22 * @file sfTkISerialBus.h
33 * @brief Header file for the SparkFun Toolkit Base Serial Bus Interface Definition.
4- *
4+ *
55 * This file contains the interface declaration for connecting sfTkISerial to the sfTkIBus.
6- *
6+ *
77 * @author SparkFun Electronics
88 * @date 2025
99 * @copyright Copyright (c) 2025, SparkFun Electronics Inc. This project is released under the MIT License.
1010 *
11- * SPDX-License-Identifier: MIT
11+ * SPDX-License-Identifier: MIT
1212 */
1313
1414#pragma once
15+
16+ // clang-format off
1517#include " sfTkError.h"
1618#include " sfTkIBus.h"
1719#include " sfTkISerial.h"
1820#include < cstdint>
21+ // clang-format on
1922
2023const uint8_t ksfTkBusTypeSerialBus = 0x03 ;
2124
@@ -24,26 +27,26 @@ class sfTkISerialBus : sfTkIBus
2427 public:
2528 /* *
2629 * @brief Constructor for the serial bus
27- *
30+ *
2831 */
2932 sfTkISerialBus ()
3033 {
3134 }
32-
35+
3336 virtual ~sfTkISerialBus () = default ;
3437
3538 /* *
3639 * @brief Writes an array of bytes to the serial interface.
37- *
40+ *
3841 * @param data The data to write
3942 * @param length The length of the data buffer
4043 * @return sfTkError_t Returns ksfTkErrOk on success, or ksfTkErrFail code
4144 */
4245 virtual sfTkError_t write (const uint8_t *data, size_t length) = 0;
43-
46+
4447 /* *
4548 * @brief Writes an array of bytes to a register on the target address. Supports any address size
46- *
49+ *
4750 * @param devReg The device's register's address - can be any size, If nullptr, address is not sent
4851 * @param regLength The length of the register address. If 0, address is not sent
4952 * @param data The data to write
@@ -63,7 +66,7 @@ class sfTkISerialBus : sfTkIBus
6366
6467 /* *
6568 * @brief Read an array of bytes from the serial interface
66- *
69+ *
6770 * @param data The data buffer to read into
6871 * @param length The length of the data buffer
6972 * @param readBytes[out] The number of bytes read
@@ -73,15 +76,16 @@ class sfTkISerialBus : sfTkIBus
7376
7477 /* *
7578 * @brief Reads an array of bytes to a register on the target address. Supports any address size
76- *
79+ *
7780 * @param devReg The device's register's address - can be any size
7881 * @param regLength The length of the register address
7982 * @param data The data to buffer to read into
8083 * @param numBytes The length of the data buffer
8184 * @param readBytes[out] The number of bytes read
8285 * @return sfTkError_t Returns ksfTkErrOk on success, or ksfTkErrFail code
8386 */
84- virtual sfTkError_t readRegister (uint8_t *devReg, size_t regLength, uint8_t *data, size_t numBytes, size_t &readBytes) override
87+ virtual sfTkError_t readRegister (uint8_t *devReg, size_t regLength, uint8_t *data, size_t numBytes,
88+ size_t &readBytes) override
8589 {
8690 // Buffer valid?
8791 if (!data)
@@ -93,7 +97,7 @@ class sfTkISerialBus : sfTkIBus
9397 if (devReg != nullptr && regLength > 0 )
9498 retVal = write (devReg, regLength);
9599
96- if (retVal != ksfTkErrOk)
100+ if (retVal != ksfTkErrOk)
97101 return retVal;
98102
99103 // Read the data.
@@ -104,7 +108,7 @@ class sfTkISerialBus : sfTkIBus
104108
105109 /* *
106110 * @brief Get the type of the object
107- *
111+ *
108112 * @return uint8_t The type of the object
109113 */
110114 virtual uint8_t type (void ) override
0 commit comments