Coder Social home page Coder Social logo

Customizable LED_BUILTIN about megacore HOT 4 CLOSED

marshfolx avatar marshfolx commented on July 29, 2024
Customizable LED_BUILTIN

from megacore.

Comments (4)

MCUdude avatar MCUdude commented on July 29, 2024 1

You can't override pre-defined macros in the sketch, and expect the compiler to pick it up and re-compile the libraries.

This means that the only viable way to override the LED_BUILTIN macro would either to add -DLED_BUILTIN=13 as a compiler build flag (difficult with Arduino IDE, possible with PlatformIO), or modify the source code in the MCUdude_corefiles folder. I'm happy to add your suggestion to the code base (only defined LED_BUILTIN if not already defined), but it won't solve your issue. The compiler would still not pick this up as long as the macro is overridden in the sketch.

from megacore.

MCUdude avatar MCUdude commented on July 29, 2024

LED_BUILTIN is just a constant, and isn't "tied" to a specific pin at all. You don't have to use the constant if you don't want to. However, you should be able to deal with it in your code like so:

#ifdef LED_BUILTIN
#undef LED_BUILTIN
#define LED_BUILTIN PIN_PG3
#endif

from megacore.

marshfolx avatar marshfolx commented on July 29, 2024

@MCUdude
Some libraries and example code use LED_BUILTIN to show simple notifications, I have to directly change the source code if i can't use build flag. Or I must place #undef LED_BUILTIN before including the library.

from megacore.

marshfolx avatar marshfolx commented on July 29, 2024

Thanks for that, and of course I'm using PlatformIO. I realized that #undef can't affect library code just after I sent the comment. No problem about it.

from megacore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.