-
Notifications
You must be signed in to change notification settings - Fork 1
Pull in branch "Feature/16 bit data support" changes into develop - next step is a release #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ec4aaad
added methods to send 16bit works on the bus - using BIG endian byte …
gigapod e5fa8c1
add logic to detect system byte order at runtime; used this logic on …
gigapod a7e74d6
tweak var name
gigapod a81aefa
removing leading bit on transfer
lewispg228 c1e9004
bus type method
gigapod ec20fa5
moved the byte order function to an implementation file - the constex…
gigapod 9846401
created a overloaded set of methods for reading and writing to registers
gigapod 3a7adea
cleanup, re-org of byte order logic -move helpers into a namespace, m…
gigapod f1d7ac6
move to a byte swap method in the toolkit
gigapod 66611b0
the template/constexpr was a cool/dynamic swap version, but not neede…
gigapod 4cf2fb2
fix issue with outout of count - make sure it is words, not bytes
gigapod 6542241
added abstract for millis and delay(); add include of the bus interfa…
gigapod 749c052
move to c header files and rmeove type_traits include - helps support…
gigapod e42d0fb
moved/changed how to handle core platform functions - define funcs in…
gigapod 453d46b
moved from using a namespace to simple C functions - cleaner
gigapod dc0f0ca
change function prefix to *sftk_* - which follows common patterns - 3…
gigapod 6e53aae
add getter for byte order
gigapod b3c91be
remove include - not needed
gigapod 9d0f0f7
fix issue with not checking endianess
gigapod 89652af
moved the byte order logic to the core bus interface; #include cleanup
gigapod 9aba53f
added banner image
gigapod 8b20d91
fix comment issues, move to using toolkit functions for swaping - not…
gigapod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// File: sfeToolkit.cpp | ||
// | ||
// General impl file for the SparkFun Toolkit | ||
/* | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2024 SparkFun Electronics | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a | ||
copy of this software and associated documentation files (the "Software"), | ||
to deal in the Software without restriction, including without limitation | ||
the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following conditions: The | ||
above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED | ||
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT | ||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
#include "sfeToolkit.h" | ||
|
||
// THIS IS A PLACEHOLDER FILE for now | ||
#ifdef ARDUINO | ||
#include <Arduino.h> | ||
#endif | ||
//--------------------------------------------------------------------------------- | ||
/** | ||
* @brief C function - Runtime check for system byte order | ||
*/ | ||
sfeTKByteOrder sftk_system_byteorder(void) | ||
{ | ||
uint16_t i = 1; | ||
return *((uint8_t *)&i) == 0 ? sfeTKByteOrder::BigEndian : sfeTKByteOrder::LittleEndian; | ||
} | ||
|
||
//--------------------------------------------------------------------------------- | ||
/** | ||
* @brief to catch 8 bit calls for byte swap | ||
* | ||
*/ | ||
uint8_t sftk_byte_swap(uint8_t i) | ||
{ | ||
return i; | ||
} | ||
//--------------------------------------------------------------------------------- | ||
/** | ||
* @brief function - Byte swap a 16 bit value | ||
*/ | ||
uint16_t sftk_byte_swap(uint16_t i) | ||
{ | ||
// Use the fast intrinsic if available | ||
#if defined(__clang__) || defined(__GNUC__) | ||
return __builtin_bswap16(i); | ||
#else | ||
return (i << 8) | (i >> 8); | ||
#endif | ||
} | ||
|
||
//--------------------------------------------------------------------------------- | ||
/** | ||
* @brief function - Byte swap a 32 bit value | ||
*/ | ||
uint32_t sftk_byte_swap(uint32_t i) | ||
{ | ||
#if defined(__clang__) || defined(__GNUC__) | ||
return __builtin_bswap32(i); | ||
#else | ||
return ((i << 24) & 0xff000000) | ((i << 8) & 0x00ff0000) | ((i >> 8) & 0x0000ff00) | ((i >> 24) & 0x000000ff); | ||
#endif | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.