Skip to content

Instantly share code, notes, and snippets.

View gamazeps's full-sized avatar

Félix Raimundo gamazeps

View GitHub Profile
#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);
#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 */