Skip to content

Commit e8d3f14

Browse files
committed
Add and edit doc comment blocks
1 parent 2e65cd4 commit e8d3f14

File tree

4 files changed

+55
-23
lines changed

4 files changed

+55
-23
lines changed

src/sfeTk/sfeTkIBus.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3030
#include "sfeTkError.h"
3131
#include <stddef.h>
3232

33-
// Define our error codes for the bus. Note Errors are negative, warnings/info positive
34-
// BUT keep the same increment on the base
35-
33+
/**
34+
* @brief Define our error codes for the bus. Note Errors are negative, warnings/info positive,
35+
* but keep the same increment on the base.
36+
*
37+
*/
3638
const sfeTkError_t kSTkErrBusNotInit = kSTkErrFail * (kSTkErrBaseBus + 1);
3739
const sfeTkError_t kSTkErrBusTimeout = kSTkErrFail * (kSTkErrBaseBus + 2);
3840
const sfeTkError_t kSTkErrBusNoResponse = kSTkErrFail * (kSTkErrBaseBus + 3);
@@ -42,8 +44,13 @@ const sfeTkError_t kSTkErrBusNullBuffer = kSTkErrFail * (kSTkErrBaseBus + 6);
4244
const sfeTkError_t kSTkErrBusUnderRead = kSTkErrBaseBus + 7;
4345
const sfeTkError_t kSTkErrBusNotEnabled = kSTkErrBaseBus + 8;
4446

45-
// Define the bus interface.
46-
47+
/**
48+
* @brief Interface that defines the communication bus for the SparkFun Electronics Toolkit.
49+
*
50+
* The bus interface defines the basic methods for reading and writing data to a device. Specific
51+
* bus implementations will extend this interface to provide the necessary functionality for the
52+
* desired bus type.
53+
*/
4754
class sfeTkIBus
4855
{
4956
public:

src/sfeTk/sfeTkISPI.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,28 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2929

3030
#include "sfeTkIBus.h"
3131

32+
/**
33+
* @brief Interface that defines the SPI communication bus for the SparkFun Electronics Toolkit.
34+
*
35+
* The SPI bus interface extends the IBus interface and adds the ability to set and get the CS pin.
36+
*/
3237
class sfeTkISPI : public sfeTkIBus
3338
{
3439
public:
40+
/*--------------------------------------------------------------------------
41+
@brief Constructor for the SPI bus
42+
43+
*/
3544
sfeTkISPI() : _cs{kNoCSPin}
3645
{
3746
}
3847

48+
/*--------------------------------------------------------------------------
49+
@brief Constructor for the SPI bus
50+
51+
@param csPin The CS Pin for the device
52+
53+
*/
3954
sfeTkISPI(uint8_t csPin) : _cs{csPin}
4055
{
4156
}
@@ -53,15 +68,18 @@ class sfeTkISPI : public sfeTkIBus
5368

5469
/*--------------------------------------------------------------------------
5570
@brief getter for the cs pin
56-
71+
5772
@retval uint8_t returns the CS pin for the device
58-
73+
5974
*/
6075
virtual uint8_t cs(void)
6176
{
6277
return _cs;
6378
}
6479

80+
/*--------------------------------------------------------------------------
81+
@brief A constant for no CS pin
82+
*/
6583
static constexpr uint8_t kNoCSPin = 0;
6684

6785
private:

src/sfeTk/sfeToolkit.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2626

2727
#pragma once
2828

29-
// Include key things that are core to the toolkit
30-
29+
/*
30+
@brief Common include file for the core of the SparkFun Electronics Toolkit
31+
*/
3132
#include "sfeTkError.h"

src/sfeTkArdI2C.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,15 @@ sfeTkError_t sfeTkArdI2C::writeRegisterWord(uint8_t devReg, uint16_t dataToWrite
136136
return writeRegisterRegion(devReg, (uint8_t *)&dataToWrite, sizeof(uint16_t));
137137
}
138138

139-
//---------------------------------------------------------------------------------
140-
// writeRegisterRegionAddress()
141-
//
142-
// Writes an array of bytes of specified length to a given register on the
143-
// target address
144-
//
145-
// Returns the number of bytes written, < 0 is an error
146-
//
139+
/**
140+
* @brief Writes an array of bytes to a register on the target address. Supports any address size
141+
*
142+
* @param devReg The device's register's address - can be any size
143+
* @param regLength The length of the register address
144+
* @param data The data to write
145+
* @param length The length of the data buffer
146+
* @return sfeTkError_t Returns kSTkErrOk on success, or kSTkErrFail code
147+
*/
147148
sfeTkError_t sfeTkArdI2C::writeRegisterRegionAddress(uint8_t *devReg, size_t regLength, const uint8_t *data,
148149
size_t length)
149150
{
@@ -183,12 +184,17 @@ sfeTkError_t sfeTkArdI2C::writeRegister16Region(uint16_t devReg, const uint8_t *
183184
}
184185

185186
//---------------------------------------------------------------------------------
186-
// readRegisterRegionAnyAddress()
187-
//
188-
// Reads an array of bytes to a register on the target address
189-
//
190-
// Returns the number of bytes written, < 0 is an error
191-
//
187+
188+
/**
189+
* @brief Reads an array of bytes to a register on the target address. Supports any address size
190+
*
191+
* @param devReg The device's register's address - can be any size
192+
* @param regLength The length of the register address
193+
* @param data The data to buffer to read into
194+
* @param numBytes The length of the data buffer
195+
* @param readBytes[out] The number of bytes read
196+
* @return sfeTkError_t Returns kSTkErrOk on success, or kSTkErrFail code
197+
*/
192198
sfeTkError_t sfeTkArdI2C::readRegisterRegionAnyAddress(uint8_t *devReg, size_t regLength, uint8_t *data,
193199
size_t numBytes, size_t &readBytes)
194200
{

0 commit comments

Comments
 (0)