Skip to content

Instantly share code, notes, and snippets.

View dcerisano's full-sized avatar
🎯
Focusing

Dominic Cerisano dcerisano

🎯
Focusing
View GitHub Profile
@mbinna
mbinna / effective_modern_cmake.md
Last active May 6, 2024 17:19
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

1. Mark device as boot device in configuration descriptor:
#define USB_CFG_DEVICE_CLASS 0 /* set to 0 if deferred to interface */
#define USB_CFG_DEVICE_SUBCLASS 0
/* See USB specification if you want to conform to an existing device class.
* Class 0xff is "vendor specific".
*/
#define USB_CFG_INTERFACE_CLASS 3 /* define class here if not at device level */
#define USB_CFG_INTERFACE_SUBCLASS 1
@dougalcampbell
dougalcampbell / ds-duino.ino
Created September 10, 2013 17:37
Digispark and nodejs - talking to the Digispark Arduino-compatible microcontroller via USB with the node-hid library
/*
* Accept control commands via USB.
*
* Commands start with '!' and end with '.'
* Commands have three parts: action, pin, value: !AAPPVV.
*
* E.g. '!01p101.' is DigitalWrite, Pin1, value = 1
*
* Note: This is currently *very* crude. Much improvement could be made.
* I think the use of strncpy is eating a lot of memory. Refactor?