aboutsummaryrefslogtreecommitdiff
path: root/src/examples/pwm/pwm.c
blob: a40da17e732e38f9c11721265bd7c639f2c623d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <nuttx/config.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdbool.h>

#include <drivers/drv_pwm_output.h>

__EXPORT int pwm_main(int argc, char *argv[]);

int pwm_main(int args, char *argv[]) {
  printf("set pwm0 to %d us\n", atoi(argv[1]));

  up_pwm_servo_init(1);
  up_pwm_servo_arm(true);
  up_pwm_servo_set(0, atoi(argv[1]));
  return 0;
}