Skip to content

Commit f8d3db4

Browse files
committed
fixed RawHID not displayed in the documentation
added SUPPORT_RAW_HID
1 parent fbcc162 commit f8d3db4

8 files changed

+29
-22
lines changed

extra/doxygen.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ INCLUDE_FILE_PATTERNS =
20992099
# recursively expanded use the := operator instead of the = operator.
21002100
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
21012101

2102-
PREDEFINED = USBCON
2102+
PREDEFINED = USBCON ARDUINO_ARCH_AVR
21032103

21042104
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
21052105
# tag can be used to specify a list of macro names that should be expanded. The

src/CorsairLightingNodePRO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
#include "CorsairLightingNodePRO.h"
1717

18-
#if defined(USBCON)
18+
#if defined(SUPPORT_RAW_HID)
1919

2020
CorsairLightingNodePRO::CorsairLightingNodePRO() : ledController(true), cLP(&ledController, &firmware), connectionAdapter(&cLP)
2121
{

src/CorsairLightingNodePRO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "CorsairLightingProtocolHID.h"
2323
#include <FastLED.h>
2424

25-
#if defined(USBCON)
25+
#if defined(SUPPORT_RAW_HID)
2626

2727
#define CHANNEL_LED_COUNT_DEFAULT 96
2828

src/CorsairLightingProtocolHID.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
limitations under the License.
1515
*/
1616
#include "CorsairLightingProtocolHID.h"
17-
#include "RawHID.h"
1817

19-
#if defined(USBCON)
18+
#if defined(SUPPORT_RAW_HID)
2019

2120
#if (RAWHID_TX_SIZE != RESPONSE_SIZE)
2221
#error "USB endpoint must be the same size as the protocol response"

src/CorsairLightingProtocolHID.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#include "CorsairLightingProtocolResponse.h"
2222
#include "CorsairLightingProtocolConstants.h"
2323

24-
#if defined(USBCON)
24+
#include "RawHID.h"
25+
26+
#if defined(SUPPORT_RAW_HID)
2527

2628
#if defined(DEBUG) && defined(VERBOSE)
2729
extern bool printCommand;

src/FastLEDController.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ bool FastLEDController::updateLEDs()
255255
}
256256
else if (tempGroup < TEMPERATURE_NUM && temperatureController != nullptr) {
257257
currentTemperature = temperatureController->getTemperature(tempGroup);
258+
} else {
259+
break;
258260
}
259261

260262
CRGB color;

src/RawHID.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
THE SOFTWARE.
2323
*/
24-
2524
#include "RawHID.h"
26-
#if defined(USBCON)
27-
#ifndef HID_REPORTID_RAWHID
28-
#define HID_REPORTID_RAWHID 0x00
29-
#endif
25+
26+
#if defined(ARDUINO_ARCH_AVR) && defined(USBCON)
3027

3128
#ifndef HID_ENDPOINT_INTERVAL_RAWHID
3229
#define HID_ENDPOINT_INTERVAL_RAWHID 0x01

src/RawHID.h

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,14 @@ THE SOFTWARE.
2626
#include <Arduino.h>
2727

2828
#if defined(ARDUINO_ARCH_AVR)
29+
#include <HID.h>
30+
#endif
2931

30-
#include "HID.h"
31-
#if defined(USBCON)
32-
33-
#define EPTYPE_DESCRIPTOR_SIZE uint8_t
34-
// HID Functional Characteristics HID1.11 Page 10 4.4 Interfaces
35-
// Interrupt Out Endpoint is optional, contoll endpoint is used by default
36-
#define ENDPOINT_COUNT 1
37-
38-
#define HID_ENDPOINT_IN pluggedEndpoint
39-
#define HID_TX HID_ENDPOINT_IN
32+
#if defined(ARDUINO_ARCH_AVR) && defined(USBCON)
33+
#define SUPPORT_RAW_HID
34+
#endif
4035

36+
#if defined(SUPPORT_RAW_HID)
4137
// RawHID might never work with multireports, because of OS problems
4238
// therefore we have to make it a single report with no idea. No other HID device will be supported then.
4339
#undef RAWHID_USAGE_PAGE
@@ -49,6 +45,18 @@ THE SOFTWARE.
4945
#define RAWHID_TX_SIZE 64
5046
#define RAWHID_RX_SIZE 64
5147

48+
#endif
49+
50+
#if defined(ARDUINO_ARCH_AVR) && defined(USBCON) // Arduino Core
51+
52+
#define EPTYPE_DESCRIPTOR_SIZE uint8_t
53+
// HID Functional Characteristics HID1.11 Page 10 4.4 Interfaces
54+
// Interrupt Out Endpoint is optional, contoll endpoint is used by default
55+
#define ENDPOINT_COUNT 1
56+
57+
#define HID_ENDPOINT_IN pluggedEndpoint
58+
#define HID_TX HID_ENDPOINT_IN
59+
5260
class RawHID_ : public PluggableUSBModule, public Stream
5361
{
5462
public:
@@ -167,4 +175,3 @@ class RawHID_ : public PluggableUSBModule, public Stream
167175
};
168176
extern RawHID_ RawHID;
169177
#endif
170-
#endif

0 commit comments

Comments
 (0)