Skip to content

Instantly share code, notes, and snippets.

@gamazeps
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gamazeps/b5b634c2f6a2ca8c9bfb to your computer and use it in GitHub Desktop.
Save gamazeps/b5b634c2f6a2ca8c9bfb to your computer and use it in GitHub Desktop.
#include "ch.h"
#include "hal.h"
int main(void) {
halInit(); // Initializes ChibiOS/RT's Hardware Abstraction Layer (HAL)
chSysInit(); // Initializes ChibiOS/RT kernel
// Configures GPIOD pin 15 as output (the blue LED on the board)
palSetPadMode(GPIOD, 15, PAL_MODE_OUTPUT_PUSHPULL);
// Main loop, simply blinks the blue led we configured before
while(1) {
palSetPad(GPIOD, 15); // Sets GPIOD 15 high
chThdSleepMilliseconds(500); // Sleep for 500ms
palClearPad(GPIOD, 15); // Sets GPIOD 15 low
chThdSleepMilliseconds(500); // Sleeps for 500ms
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment