-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change NodeAddr to NodeNumber for more consistent API
- Loading branch information
Showing
17 changed files
with
230 additions
and
86 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
set( | ||
SOURCES | ||
${SOURCES} | ||
${CMAKE_CURRENT_LIST_DIR}/node_new_addr.c | ||
${CMAKE_CURRENT_LIST_DIR}/node_new_addr_from_bytes.c | ||
${CMAKE_CURRENT_LIST_DIR}/node_new_addr_unchecked.c | ||
${CMAKE_CURRENT_LIST_DIR}/node_new_number.c | ||
${CMAKE_CURRENT_LIST_DIR}/node_new_number_from_bytes.c | ||
${CMAKE_CURRENT_LIST_DIR}/node_new_number_unchecked.c | ||
PARENT_SCOPE | ||
) | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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,28 @@ | ||
#include "vlcb/common/node.h" | ||
|
||
#include <assert.h> | ||
#include <stdbool.h> | ||
#include <stddef.h> | ||
|
||
bool IsNodeNumberValid(const VlcbNodeNumber addr) { return addr > 0; } | ||
|
||
int vlcb_defs_NewNodeNumber(const uint16_t val, VlcbNodeNumber *const addr) { | ||
assert(addr != NULL); | ||
const VlcbNodeNumber _addr = val; | ||
if (IsNodeNumberValid(_addr)) { | ||
*addr = _addr; | ||
return 0; | ||
} | ||
return 1; | ||
} | ||
|
||
int vlcb_defs_NewNodeNumberFromBytes(const uint8_t hi, const uint8_t lo, | ||
VlcbNodeNumber *const addr) { | ||
const VlcbNodeNumber _addr = | ||
vlcb_defs_NewNodeNumberFromBytesUnchecked(hi, lo); | ||
if (IsNodeNumberValid(_addr)) { | ||
*addr = _addr; | ||
return 0; | ||
} | ||
return 1; | ||
} |
This file contains 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,9 @@ | ||
#include "vlcb/common/node.h" | ||
|
||
#include <stdint.h> | ||
|
||
int vlcb_defs_NewNodeNumberFromBytes(const uint8_t hi, const uint8_t lo, | ||
VlcbNodeNumber *const addr) { | ||
const uint16_t _addr = vlcb_defs_NewNodeNumberFromBytesUnchecked(hi, lo); | ||
return vlcb_defs_NewNodeNumber(_addr, addr); | ||
} |
This file contains 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,7 @@ | ||
#include "vlcb/common/node.h" | ||
|
||
VlcbNodeNumber vlcb_defs_NewNodeNumberFromBytesUnchecked(const uint8_t hi, | ||
const uint8_t lo) { | ||
const VlcbNodeNumber addr = (hi << 8) | lo; | ||
return addr; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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.