HWA
Bare metal programming with style
oca_2.h
Go to the documentation of this file.
1
2
/* This file is part of the HWA project.
3
* Copyright (c) 2012,2015 Christophe Duparquet.
4
* All rights reserved. Read LICENSE.TXT for details.
5
*/
6
35
#define hw_configure__oca , _hw_cfoca
36
37
/* Mandatory parameter `output`
38
*/
39
#define _hw_oca_output_disconnected , 0, 0
/* code, COM */
/* Non-PWM */
40
#define _hw_oca_output_toggle_after_match , 1, 1
/* Non-PWM */
41
#define _hw_oca_output_clear_after_match , 2, 2
/* Non-PWM */
42
#define _hw_oca_output_set_after_match , 3, 3
/* Non-PWM */
43
44
#define _hw_oca_output_set_at_bottom_clear_after_match , 4, 2
/* Fast PWM */
45
#define _hw_oca_output_clear_at_bottom_set_after_match , 5, 3
46
47
#define _hw_oca_output_clear_after_match_up_set_after_match_down , 6, 2
/* Phase correct PWM */
48
#define _hw_oca_output_set_after_match_up_clear_after_match_down , 7, 3
49
50
#define _hw_cfoca(o,ct,oc,k,...) \
51
do { \
52
HW_B(_hw_cfoca_koutput_,_hw_is_output_##k)(ct,oc,k,__VA_ARGS__,,); \
53
}while(0)
54
55
#define _hw_cfoca_koutput_0(ct,oc,k,...) \
56
HW_E(HW_EM_AN(k,output))
57
#define _hw_cfoca_koutput_1(ct,oc,k,v,...) \
58
HW_B(_hw_cfoca_voutput_,_hw_oca_output_##v)(ct,oc,v,__VA_ARGS__)
59
#define _hw_cfoca_voutput_0(ct,oc,v,...) \
60
HW_E(HW_EM_VAL(v,output,(disconnected,toggle_after_match,clear_after_match,set_after_match,set_at_bottom_clear_after_match,clear_at_bottom_set_after_match,clear_after_match_up_set_after_match_down,set_after_match_up_clear_after_match_down)))
61
#define _hw_cfoca_voutput_1(ct,oc,v,...) \
62
_hw_write(ct, com##oc, HW_A2(_hw_oca_output_##v)) HW_EOL(__VA_ARGS__)
63
64
95
#define hwa_configure__oca , _hwa_cfoca
96
97
/* Optionnal parameter `update`
98
*/
99
#define _hw_oca_update_immediately , 0
100
#define _hw_oca_update_after_bottom , 1
101
#define _hw_oca_update_after_top , 2
102
103
#define _hwa_cfoca(o,ct,oc,k,...) \
104
do { \
105
HW_B(_hwa_cfoca_kupdate_,_hw_is_update_##k)(ct,oc,k,__VA_ARGS__,); \
106
}while(0)
107
108
#define _hwa_cfoca_kupdate_0(ct,oc,k,...) \
109
HW_B(_hwa_cfoca_koutput_,_hw_is_output_##k)(ct,oc,k,__VA_ARGS__)
110
111
#define _hwa_cfoca_kupdate_1(ct,oc,k,v,...) \
112
HW_B(_hwa_cfoca_vupdate_,_hw_oca_update_##v)(ct,oc,v,__VA_ARGS__)
113
#define _hwa_cfoca_vupdate_0(ct,oc,v,...) \
114
HW_E(HW_EM_VAL(v,update,(immediately,after_bottom,after_top)))
115
116
#define _hwa_cfoca_vupdate_1(ct,oc,v,k,...) \
117
hwa->ct.compare##oc.config.update = HW_A1(_hw_oca_update_##v); \
118
HW_B(_hwa_cfoca_koutput_,_hw_is_output_##k)(ct,oc,k,__VA_ARGS__)
119
120
/* Optionnal parameter `output`
121
*/
122
#define _hwa_cfoca_koutput_0(ct,oc,...) \
123
HW_EOL(__VA_ARGS__)
124
125
#define _hwa_cfoca_koutput_1(ct,oc,k,v,...) \
126
HW_B(_hwa_cfoca_voutput_,_hw_oca_output_##v)(ct,oc,v,__VA_ARGS__)
127
128
#define _hwa_cfoca_voutput_0(ct,oc,v,...) \
129
HW_E(HW_EM_VAL(v,output,(disconnected,toggle_after_match,clear_after_match,set_after_match,set_at_bottom_clear_after_match,clear_at_bottom_set_after_match,clear_after_match_up_set_after_match_down,set_after_match_up_clear_after_match_down)))
130
#define _hwa_cfoca_voutput_1(ct,oc,v,...) \
131
hwa->ct.compare##oc.config.output = HW_A1(_hw_oca_output_##v) HW_EOL(__VA_ARGS__)
132
133
153
#define hw_read__oca , _hw_read_oca
154
#define _hw_read_oca(o,ct,oc,...) _hw_read(ct,ocr##oc) HW_EOL(__VA_ARGS__)
155
156
#define hw_write__oca , _hw_write_oca
157
#define _hw_write_oca(o,ct,oc,v,...) _hw_write(ct,ocr##oc,v) HW_EOL(__VA_ARGS__)
158
159
#define hwa_write__oca , _hwa_write_oca
160
#define _hwa_write_oca(o,ct,oc,v,...) _hwa_write(ct,ocr##oc,v) HW_EOL(__VA_ARGS__)
161
162
176
#define hw_trigger__oca , _hw_trigger_oca
177
#define _hw_trigger_oca(o,ct,oc) _hw_write(ct,foc##oc,1)
178
179
#define hwa_trigger__oca , _hwa_trigger_oca
180
#define _hwa_trigger_oca(o,ct,oc) _hwa_write(ct,foc##oc,1)
181
182
Generated for HWA by
1.8.6