This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "ch.h" | |
| #include "hal.h" | |
| #include "servo.h" | |
| #define SERVO_PWM PWMD3 | |
| static PWMConfig pwm_servo = { | |
| 100000, /* 100Khz PWM clock frequency*/ | |
| 2000, /* PWM period of 2000 ticks ~ 20ms */ | |
| NULL, /* No callback at the end of the timer count */ |
NewerOlder