/
pwm.c
53 lines (43 loc) · 1.33 KB
/
pwm.c
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
48
49
50
51
52
53
/**
* @file pwm.c
*
* @section License
* Copyright (C) 2014-2016, Erik Moqvist
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* This file is part of the Simba project.
*/
#include "simba.h"
#include "pwm_port.i"
int pwm_init(struct pwm_driver_t *self_p,
struct pwm_device_t *dev_p)
{
ASSERTN(self_p != NULL, -EINVAL);
ASSERTN(dev_p != NULL, -EINVAL);
return (pwm_port_init(self_p, dev_p));
}
int pwm_set_duty(struct pwm_driver_t *self_p,
uint8_t value)
{
ASSERTN(self_p != NULL, -EINVAL);
return (pwm_port_set_duty(self_p, value));
}
int pwm_get_duty(struct pwm_driver_t *self_p)
{
ASSERTN(self_p != NULL, -EINVAL);
return (pwm_port_get_duty(self_p));
}
struct pwm_device_t *pwm_pin_to_device(struct pin_device_t *pin_p)
{
ASSERTN(pin_p != NULL, -EINVAL);
return (pwm_port_pin_to_device(pin_p));
}