Skip to content

Commit

Permalink
Fixed AVR build and coverage test.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Starke <[email protected]>
  • Loading branch information
daniel-starke committed Nov 5, 2023
1 parent 78d9e64 commit 4326c08
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}

.codejar-linenumbers {
border-right: 1px solid #CCC;
border-right: 1px #CCC solid;
height: 100%;
text-align: right;

Expand Down Expand Up @@ -178,7 +178,7 @@ <h1>HID Descriptor Compiler</h1>
<textarea class="output" readonly="true" spellcheck="false" autocapitalize="none" autocomplete="off" autocorrect="off" rows="2"></textarea>
<div class="copyright">
<span style="float: left;">&copy;2022 Daniel Starke, credits to <a href="https://github.com/antonmedv/codejar">CodeJar</a> and <a href="https://github.com/PrismJS">PrismJS</a></span>
<span style="float: right;">found on <a href="https://github.com/daniel-starke//HidDescCTC">Github.com</a></span>
<span style="float: right;">found on <a href="https://github.com/daniel-starke/HidDescCTC">Github.com</a></span>
</div>

<script src="assets/prism.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "HidDescCTC",
"version": "1.0.0",
"version": "1.0.1",
"description": "USB HID Descriptor Compile Time Compiler for C++14.",
"keywords": "arduino,usb,hid",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=HidDescCTC
version=1.0.0
version=1.0.1
author=Daniel Starke
maintainer=Daniel Starke
sentence=USB HID Descriptor Compile Time Compiler for C++14.
Expand Down
46 changes: 23 additions & 23 deletions src/HidDescriptor.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* @file HidDescriptor.hpp
* @author Daniel Starke
* @copyright Copyright 2022 Daniel Starke
* @copyright Copyright 2022-2023 Daniel Starke
* @date 2022-04-20
* @version 2022-07-31
* @version 2023-11-05
*
* Helper functions to build a USB HID descriptor. Use `DEF_HID_DESCRIPTOR_AS()`.
*
Expand Down Expand Up @@ -868,29 +868,29 @@ constexpr inline size_t encodeSigned(Writer & out, const int32_t val) noexcept {
*
* @see HID 1.11 ch. 3.4
**/
enum UsageType {
enum UsageType : uint32_t {
UT_NONE = 0,
/* Control, ch. 3.4.1 */
UT_LC = 1 << 0, /**< Linear Control */
UT_OOC = 1 << 1, /**< On/Off Control */
UT_MC = 1 << 2, /**< Momentary Control */
UT_OSC = 1 << 3, /**< One Shot Control */
UT_RTC = 1 << 4, /**< Re-trigger Control */
UT_LC = 1UL << 0, /**< Linear Control */
UT_OOC = 1UL << 1, /**< On/Off Control */
UT_MC = 1UL << 2, /**< Momentary Control */
UT_OSC = 1UL << 3, /**< One Shot Control */
UT_RTC = 1UL << 4, /**< Re-trigger Control */
/* Data, ch. 3.4.2 */
UT_SEL = 1 << 5, /**< Selector */
UT_SV = 1 << 6, /**< Static Value */
UT_SF = 1 << 7, /**< Static Flag */
UT_DV = 1 << 8, /**< Dynamic Value */
UT_DF = 1 << 9, /**< Dynamic Flag */
UT_SEL = 1UL << 5, /**< Selector */
UT_SV = 1UL << 6, /**< Static Value */
UT_SF = 1UL << 7, /**< Static Flag */
UT_DV = 1UL << 8, /**< Dynamic Value */
UT_DF = 1UL << 9, /**< Dynamic Flag */
/* Collection, ch. 3.4.3 */
UT_NARY = 1 << 10, /**< Named Array */
UT_CA = 1 << 11, /**< Application Collection */
UT_CL = 1 << 12, /**< Logical Collection */
UT_CP = 1 << 13, /**< Physical Collection */
UT_US = 1 << 14, /**< Usage Switch */
UT_UM = 1 << 15, /**< Usage Modifier */
UT_NARY = 1UL << 10, /**< Named Array */
UT_CA = 1UL << 11, /**< Application Collection */
UT_CL = 1UL << 12, /**< Logical Collection */
UT_CP = 1UL << 13, /**< Physical Collection */
UT_US = 1UL << 14, /**< Usage Switch */
UT_UM = 1UL << 15, /**< Usage Modifier */
/* others */
UT_BB = 1 << 16 /**< Buffered Bytes */
UT_BB = 1UL << 16 /**< Buffered Bytes */
};


Expand Down Expand Up @@ -4576,7 +4576,7 @@ constexpr bool compile(const Source & source, Writer & out, ::hid::error::Info &
/* end of hex literal */
flags &= ~HID_WITHIN_HEX_LIT;
/* merge multiple arguments via OR */
if (encMap->arg == signedNumArg && lit > 0x7FFFFFFF) {
if (encMap->arg == signedNumArg && lit > 0x7FFFFFFFUL) {
return errorMsg.at(n, E_Number_overflow);
}
arg |= lit;
Expand Down Expand Up @@ -4611,13 +4611,13 @@ constexpr bool compile(const Source & source, Writer & out, ::hid::error::Info &
flags &= ~HID_WITHIN_NUM_LIT;
/* merge multiple arguments via OR */
if ( negLit ) {
if (lit > 0x80000000) {
if (lit > 0x80000000UL) {
return errorMsg.at(n, E_Number_overflow);
}
arg |= uint32_t(-int32_t(lit));
negLit = false;
} else {
if (encMap->arg == signedNumArg && lit > 0x7FFFFFFF) {
if (encMap->arg == signedNumArg && lit > 0x7FFFFFFFUL) {
return errorMsg.at(n, E_Number_overflow);
}
arg |= lit;
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ KFLAGS = --libc=uclibc --posix-runtime --optimize -silent-klee-assume --only-out
cov: unit.cpp ../src/HidDescriptor.hpp
@$(CXX) $(COVCFLAGS) $(CWFLAGS) $(CXXFLAGS) -o cov unit.cpp
@./cov >/dev/null 2>&1
@$(GCOV) $(GCOVFLAGS) unit.cpp | grep -A 1 "File '../src/HidDescriptor.hpp'"
@$(GCOV) $(GCOVFLAGS) cov-* | grep -A 1 "File '../src/HidDescriptor.hpp'"
@gawk '/^function .*::(findEncoding|compile<Source).*blocks executed/ {gsub(/\(anonymous namespace\)::/, ""); sub(/^function /, ""); sub(/ called/, "\n -> called"); print $0;}' HidDescriptor.hpp.gcov
@rm -f exception.h.gcov initializer_list.gcov new.gcov stdio.h.gcov unit.cpp.gcov unit.gcda unit.gcno 2>/dev/null

Expand Down

0 comments on commit 4326c08

Please sign in to comment.