-
Notifications
You must be signed in to change notification settings - Fork 2
/
cec.c
78 lines (71 loc) · 1.98 KB
/
cec.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright (C) 2016 Russ Dill <[email protected]>
*
* 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.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "cec.h"
#if CEC_MONITOR
static void cec_transmit_receive_ack(bool bit) {}
static void cec_transmit_on_error(void) {}
static void cec_check_tx_bit(bool bit) {}
static void cec_transmit_periodic(unsigned int delta) {}
static void cec_transmit_halt(void) {}
static inline void cec_transmit_init(void) {}
#else
#include "cec_transmit.c"
#endif
#include "cec_receive.c"
#ifdef CEC_USI
#include "cec_usi.c"
#else
#include "cec_receive_min.c"
#if CEC_MONITOR
/* No transmit capability */
#elif defined(CEC_TRANSMIT_PWM)
#include "cec_transmit_pwm.c"
#else
#include "cec_transmit_raw.c"
#endif
#endif
#ifdef CEC_DEV_TYPE
#include "cec_addr_dev_type.c"
#elif defined(CEC_LOGICAL_ADDRESS_BITFIELD)
#include "cec_addr_bitfield.c"
#elif defined(CEC_FIXED_LOGICAL_ADDRESS)
#include "cec_addr_fixed.c"
#else
#include "cec_addr_none.c"
#endif
CEC_PUBLIC void cec_init(void)
{
cec_pin_config();
cec_receive_init();
cec_transmit_init();
cec_addr_init();
}
CEC_PUBLIC void cec_periodic(unsigned int delta)
{
cec_receive_periodic(delta);
cec_transmit_periodic(delta);
cec_addr_periodic();
}
CEC_PUBLIC void cec_halt(void)
{
cec_receive_error(CEC_ERR_HALT);
cec_receive_halt();
cec_transmit_halt();
cec_addr_init();
}