Skip to content

Instantly share code, notes, and snippets.

@gamazeps
Created June 16, 2014 14:56
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/3cc4581653f7dc61fbfa to your computer and use it in GitHub Desktop.
Save gamazeps/3cc4581653f7dc61fbfa to your computer and use it in GitHub Desktop.
#include “hal.h”
#include “ch.h”
int main(void) {
halInit(); // initializes hardware abstraction layer
chSysInit(); // initializes ChibiOS kernel
// configures GPIOC pin 1 as output pushpull
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
while(1) {
palSetPad(GPIOC, 1); // sets GPIOC 1 high
chThdSleepMilliseconds(500); // sleeps for 500ms
palClearPad(GPIOC, 1); // sets GPIOC 1 low
chThdSleepMilliseconds(500); // sleeps for 500ms
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment