FRDM-IMX93 for NXP CUP
FRDM-IMX93 support for NXP CUP
 
Loading...
Searching...
No Matches
servo.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14#ifndef _SERVO_H_
15#define _SERVO_H_
16
17#include <zephyr/drivers/pwm.h>
18
20#define MSEC_TO_NSEC(x) ((x) * NSEC_PER_MSEC)
21
23#define SERVO_MSEC_LEFT MSEC_TO_NSEC(1.0f)
24
26#define SERVO_MSEC_RIGHT MSEC_TO_NSEC(2.0f)
27
29#define SERVO_MAX_ANGLE 180
30
35struct nxp_servo {
37 const struct device *pwm_dev;
39 uint32_t period;
41 uint32_t channel;
42};
43
53int servo_set_angle(struct nxp_servo *servo, uint32_t angle);
54
55#endif /* _SERVO_H_ */
int servo_set_angle(struct nxp_servo *servo, uint32_t angle)
Set the angle of the servo motor.
Definition servo.c:13
Represents the MG996R servo motor.
Definition servo.h:35
const struct device * pwm_dev
Definition servo.h:37
uint32_t period
Definition servo.h:39
uint32_t channel
Definition servo.h:41