Skip to content

Commit dc0f0ca

Browse files
committed
change function prefix to *sftk_* - which follows common patterns - 3 to 4 chars, all lowercase
1 parent 453d46b commit dc0f0ca

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/sfeTk/sfeToolkit.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3232
/**
3333
* @brief C function - Runtime check for system byte order
3434
*/
35-
sfeTKByteOrder sfeTk_system_byteorder(void)
35+
sfeTKByteOrder sftk_system_byteorder(void)
3636
{
3737
uint16_t i = 1;
3838
return *((uint8_t *)&i) == 0 ? sfeTKByteOrder::BigEndian : sfeTKByteOrder::LittleEndian;
@@ -43,15 +43,15 @@ sfeTKByteOrder sfeTk_system_byteorder(void)
4343
* @brief to catch 8 bit calls for byte swap
4444
*
4545
*/
46-
uint8_t sfeTk_byte_swap(uint8_t i)
46+
uint8_t sftk_byte_swap(uint8_t i)
4747
{
4848
return i;
4949
}
5050
//---------------------------------------------------------------------------------
5151
/**
5252
* @brief function - Byte swap a 16 bit value
5353
*/
54-
uint16_t sfeTk_byte_swap(uint16_t i)
54+
uint16_t sftk_byte_swap(uint16_t i)
5555
{
5656
// Use the fast intrinsic if available
5757
#if defined(__clang__) || defined(__GNUC__)
@@ -65,7 +65,7 @@ uint16_t sfeTk_byte_swap(uint16_t i)
6565
/**
6666
* @brief function - Byte swap a 32 bit value
6767
*/
68-
uint32_t sfeTk_byte_swap(uint32_t i)
68+
uint32_t sftk_byte_swap(uint32_t i)
6969
{
7070
#if defined(__clang__) || defined(__GNUC__)
7171
return __builtin_bswap32(i);

src/sfeTk/sfeToolkit.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ enum class sfeTKByteOrder : uint8_t
4242
LittleEndian = 0x02
4343
};
4444

45-
// Use a namespace for the toolkit "utilities and helpers"
45+
// Note - toolkit *functions* start with sftk_ to avoid name collisions
4646

4747
// Function to determine the byte order of the system
48-
sfeTKByteOrder sfeTk_system_byteorder(void);
48+
sfeTKByteOrder sftk_system_byteorder(void);
4949

50-
uint8_t sfeTk_byte_swap(uint8_t i);
51-
uint16_t sfeTk_byte_swap(uint16_t i);
52-
uint32_t sfeTk_byte_swap(uint32_t i);
50+
uint8_t sftk_byte_swap(uint8_t i);
51+
uint16_t sftk_byte_swap(uint16_t i);
52+
uint32_t sftk_byte_swap(uint32_t i);
5353

5454

5555
// Area for platform specific implementations. The interface/functions are
5656
// defined here, with the expectation that the platform provides the implementation.
5757

5858
// delay in milliseconds
59-
void sfeTk_delay_ms(uint32_t ms);
59+
void sftk_delay_ms(uint32_t ms);
6060

6161
// ticks in milliseconds
62-
uint32_t sfeTk_ticks_ms(void);
62+
uint32_t sftk_ticks_ms(void);

src/sfeTkArdI2C.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ sfeTkError_t sfeTkArdI2C::writeRegisterRegion(uint8_t devReg, const uint8_t *dat
210210
sfeTkError_t sfeTkArdI2C::writeRegister16Region(uint16_t devReg, const uint8_t *data, size_t length)
211211
{
212212
// devReg = ((devReg << 8) & 0xff00) | ((devReg >> 8) & 0x00ff);
213-
devReg = sfeTk_byte_swap(devReg);
213+
devReg = sftk_byte_swap(devReg);
214214
return writeRegisterRegionAddress((uint8_t *)&devReg, 2, data, length);
215215
}
216216

@@ -224,11 +224,11 @@ sfeTkError_t sfeTkArdI2C::writeRegister16Region(uint16_t devReg, const uint8_t *
224224
sfeTkError_t sfeTkArdI2C::writeRegister16Region16(uint16_t devReg, const uint16_t *data, size_t length)
225225
{
226226
// if the system byte order is the same as the desired order, just send the buffer
227-
if (sfeTk_system_byteorder() == _byteOrder)
227+
if (sftk_system_byteorder() == _byteOrder)
228228
return writeRegisterRegionAddress((uint8_t *)&devReg, 2, (uint8_t *)data, length * 2);
229229

230230
// okay, we need to swap
231-
devReg = sfeTk_byte_swap(devReg);
231+
devReg = sftk_byte_swap(devReg);
232232
// devReg = ((devReg << 8) & 0xff00) | ((devReg >> 8) & 0x00ff);
233233
uint16_t data16[length];
234234
for (size_t i = 0; i < length; i++)
@@ -391,13 +391,13 @@ sfeTkError_t sfeTkArdI2C::readRegister16Region(uint16_t devReg, uint8_t *data, s
391391
sfeTkError_t sfeTkArdI2C::readRegister16Region16(uint16_t devReg, uint16_t *data, size_t numBytes, size_t &readWords)
392392
{
393393
// if the system byte order is the same as the desired order, flip the address
394-
if (sfeTk_system_byteorder() != _byteOrder)
394+
if (sftk_system_byteorder() != _byteOrder)
395395
devReg = ((devReg << 8) & 0xff00) | ((devReg >> 8) & 0x00ff);
396396

397397
sfeTkError_t status = readRegisterRegionAnyAddress((uint8_t *)&devReg, 2, (uint8_t *)data, numBytes * 2, readWords);
398398

399399
// Do we need to flip the byte order?
400-
if (status == kSTkErrOk && sfeTk_system_byteorder() != _byteOrder)
400+
if (status == kSTkErrOk && sftk_system_byteorder() != _byteOrder)
401401
{
402402
for (size_t i = 0; i < numBytes; i++)
403403
data[i] = ((data[i] << 8) & 0xff00) | ((data[i] >> 8) & 0x00ff);

src/sfeTkArduino.cpp

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

2727
// Implements the sfeToolkit functions for the Arduino platform
2828

29-
void sfeTk_delay_ms(uint32_t ms)
29+
void sftk_delay_ms(uint32_t ms)
3030
{
3131
delay(ms);
3232
}
3333

34-
uint32_t sfeTk_ticks_ms(void)
34+
uint32_t sftk_ticks_ms(void)
3535
{
3636
return millis();
3737
}

0 commit comments

Comments
 (0)