ethan
2023-04-08 f5e277c240b9211a1f047b88788f34f3dd5a97c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
 * @file dev_pwm.h
 * @author your name (you@domain.com)
 * @brief 
 * @version 0.1
 * @date 2023-04-05
 * 
 * @copyright Copyright (c) 2023
 * 
 */
 
#ifndef EMS_PWM_H
#define EMS_PWM_H
 
#include "ems_object.h"
 
#ifdef __cplusplus
extern "C" {
#endif
 
typedef struct ems_pwm
{
    ems_object_t super;
 
    const struct ems_pwm_ops *ops;
    uint8_t duty_ratio;
} ems_pwm_t;
 
typedef struct ems_pwm_ops
{
    void (* init)(ems_pwm_t * const me);
    void (* set_duty)(ems_pwm_t * const me, uint8_t duty_ratio);
} ems_pwm_ops_t;
 
 
void ems_pwm_register(ems_pwm_t * const me,
                        const char *name,
                        const ems_pwm_ops_t *ops,
                        void *user_data);
 
void ems_pwm_set_duty(ems_object_t * const me, uint8_t duty_ratio);
 
#ifdef __cplusplus
}
#endif
 
#endif