Using a custom usb_desc.h per-project with platformio?

Status
Not open for further replies.

phizz

New member
Hi there,

I'm working on a project where I've changed some code in the USB joystick class, which means that I've got modified versions of usb_desc.h, usb_desc.c, and usb_joystick.h in /cores/teensy3/. I switched from the Arduino IDE to PlatformIO recently, and am wondering if there's a way that I can include these three modified files in my project folder and have them override the default ones in the PlatformIO framework, so that they go along with the project. Is that possible?

As an extension of that idea, is it possible to include an entire specific version of the Teensy package with the project? That way if I were to come back to this project in the future, I wouldn't have to worry about future updates to Teensy breaking it.

Thanks for any tips!
 
I tried that tip and it doesn't seem to work. boards_dir is actually pointing at some json files, not the cores directory, and when I do put a local copy of the cores into boards_dir it still just pulls from the global installation. The boards json files don't have any place to put a cores directory that I can tell.
 
As an extension of that idea, is it possible to include an entire specific version of the Teensy package with the project? That way if I were to come back to this project in the future, I wouldn't have to worry about future updates to Teensy breaking it.

Your statement above is exactly why I developed VisualTeensy a couple of years ago. I had some bad experiences with maintaining old code which was not compatible to current versions of IDEs and libraries. Of course this stuff always happens if you need to fix things under emergency conditions.

So, if you are not bound to PIO and work under Windows you might give VisualTeensy a quick try. Nothing to install, just unzip the binaries and run it.

Like PIO it uses vsCode as IDE. The only thing it does is setting up your project by generating a few json files which vsCode needs for intellisense and the build process. It then uses the native vsCode capabilities to build and upload. It was important to me that, after setting up your project you don't need VisualTeensy anymore. So, no long term dependency on third party code (well in my case its first party but you get the idea :) ). Actually, since it uses standard make behind the scene you don't even need vsCode to compile. In case of emergency you can always type 'make all' in the project folder and it compiles :)

And, it has this nice little button which copies the core library to your project...

Anmerkung 2020-08-06 220549.jpg

It also copies used libraries to the project and you can set the path to the compiler per project.

Here the WIKI with a quick start guide https://github.com/luni64/VisualTeensy/wiki

Remark: By default it sets up a standard c++ development environment, i.e. you need to manually include Aduino.h and forward declare your stuff. But, I think this is the same with PIO? Anyway, if you really want to use the Arduino builder you can choose to do so in the settings tab. You then get the same build behaviour as with the Arduino IDE. But, of course, you'll have another dependency which might break your code in 5 years.
 
Status
Not open for further replies.
Back
Top