On this page
Blink_Led
Note: These examples are mainly for the type-c
imports all the libraries that will be used
#include "tap/board/board.hpp" // import board specific settings
#include "drivers_singleton.hpp" // import taproot
The drivers object in taproot is king and basically controls all aspects of the type-c.
To get it we call src::DoNotUse_getDrivers()
.
it says not to use it but what it means is only to use it once.
src::Drivers *drivers = src::DoNotUse_getDrivers(); // gets the driver object
initialization
Board::initialize(); // initialize the whole board
drivers->leds.init(); // initialize the led
Turn On LED to red
drivers->leds.set(tap::gpio::Leds::Red, true); // Turn On LED
Turn Off LED
drivers->leds.set(tap::gpio::Leds::Red, false); // Turn Off LED
sleep for 500 ms
modm::delay_ms(500);
Code:
#include "tap/board/board.hpp" // import board specific settings
#include "drivers_singleton.hpp" // import taproot
int main(){
src::Drivers *drivers = src::DoNotUse_getDrivers(); // get the driver object
Board::initialize(); // intalize the whole board
drivers->leds.init(); // initalize the led
while(true){
drivers->leds.set(tap::gpio::Leds::Red, true); // Turn On LED
modm::delay_ms(500);
drivers->leds.set(tap::gpio::Leds::Red, false); // Turn On LED
modm::delay_ms(500);
}
}
to upload to the type-c press
ctrl+shift+B