c7segrgb  2.0.0.0
c7segrgb_delays.h
Go to the documentation of this file.
1 
16 #ifndef C7SEGRGB_DELAYS_H
17 #define C7SEGRGB_DELAYS_H
18 
19 // Delay adjustment for specific systems.
20 // Adjusted specifically for NECTO v6.1.0 and mikroSDK v2.11.0.
21 #ifdef __MIKROC_AI__
22  #ifdef STM32F407ZG
23  /*< Adjusted for STM32F407ZG */
24  #define DELAY_TOH Delay_Cyc( 4 ); // ~400ns
25  #define DELAY_TOL Delay_Cyc( 7 ); // ~850ns
26  #define DELAY_T1H Delay_Cyc( 12 ); // ~820ns
27  #define DELAY_T1L // ~390ns
28  #elif MK64FN1M0VDC12
29  /*< Adjusted for MK64FN1M0VDC12 */
30  #define DELAY_TOH Delay_Cyc( 3 ); // ~380ns
31  #define DELAY_TOL Delay_Cyc( 5 ); // ~870ns
32  #define DELAY_T1H Delay_Cyc( 8 ); // ~800ns
33  #define DELAY_T1L // ~470ns
34  #elif TM4C129XNCZAD
35  /*< Adjusted for TM4C129XNCZAD */
36  #define DELAY_TOH // ~400ns
37  #define DELAY_TOL // ~860ns
38  #define DELAY_T1H Delay_Cyc( 4 ); // ~800ns
39  #define DELAY_T1L // ~910ns
40  #elif PIC32MX795F512L
41  /*< Adjusted for PIC32MX795F512L */
42  #define DELAY_TOH \
43  asm nop; \
44  asm nop; \
45  asm nop; \
46  asm nop; \
47  asm nop; \
48  asm nop; \
49  asm nop; \
50  asm nop; \
51  asm nop; \
52  asm nop; // ~430ns
53  #define DELAY_TOL // ~900ns
54  #define DELAY_T1H Delay_Cyc( 4 ); // ~870ns
55  #define DELAY_T1L // ~1000ns
56  #else
57  #error "Logic delays are not defined for the selected MCU"
58  #endif
59 #elif __clang__
60  #ifdef STM32F407ZG
61  /*< Adjusted for STM32F407ZG */
62  #define DELAY_TOH Delay_Cyc( 3 ); // ~420ns
63  #define DELAY_TOL Delay_Cyc( 6 ); // ~840ns
64  #define DELAY_T1H Delay_Cyc( 12 ); // ~840ns
65  #define DELAY_T1L asm("nop"); // ~410ns
66  #elif MK64
67  /*< Adjusted for MK64FN1M0VDC12 */
68  #define DELAY_TOH Delay_Cyc( 2 ); // ~360ns
69  #define DELAY_TOL Delay_Cyc( 4 ); // ~770ns
70  #define DELAY_T1H Delay_Cyc( 16 ); // ~830ns
71  #define DELAY_T1L // ~500ns
72  #elif TM4C129
73  /*< Adjusted for TM4C129XNCZAD */
74  #define DELAY_TOH \
75  asm("nop"); \
76  asm("nop"); \
77  asm("nop"); \
78  asm("nop"); \
79  asm("nop"); \
80  asm("nop"); \
81  asm("nop"); \
82  asm("nop"); \
83  asm("nop"); \
84  asm("nop"); \
85  asm("nop"); \
86  asm("nop"); \
87  asm("nop"); \
88  asm("nop"); \
89  asm("nop"); \
90  asm("nop"); \
91  asm("nop"); \
92  asm("nop"); \
93  asm("nop"); \
94  asm("nop"); \
95  asm("nop"); \
96  asm("nop"); \
97  asm("nop"); \
98  asm("nop"); // ~380ns
99  #define DELAY_TOL \
100  asm("nop"); \
101  asm("nop"); \
102  asm("nop"); \
103  asm("nop"); \
104  asm("nop"); \
105  asm("nop"); \
106  asm("nop"); \
107  asm("nop"); \
108  asm("nop"); \
109  asm("nop"); \
110  asm("nop"); \
111  asm("nop"); \
112  asm("nop"); \
113  asm("nop"); \
114  asm("nop"); \
115  asm("nop"); \
116  asm("nop"); \
117  asm("nop"); \
118  asm("nop"); \
119  asm("nop"); \
120  asm("nop"); \
121  asm("nop"); \
122  asm("nop"); \
123  asm("nop"); // ~800ns
124  #define DELAY_T1H Delay_Cyc( 6 ); // ~840ns
125  #define DELAY_T1L // ~700ns
126  #elif GD32VF103VBT6
127  /*< Adjusted for GD32VF103VBT6 */
128  #define DELAY_TOH \
129  asm("nop"); \
130  asm("nop"); \
131  asm("nop"); \
132  asm("nop"); \
133  asm("nop"); \
134  asm("nop"); \
135  asm("nop"); \
136  asm("nop"); \
137  asm("nop"); \
138  asm("nop"); \
139  asm("nop"); \
140  asm("nop"); \
141  asm("nop"); \
142  asm("nop"); \
143  asm("nop"); \
144  asm("nop"); \
145  asm("nop"); \
146  asm("nop"); \
147  asm("nop"); \
148  asm("nop"); \
149  asm("nop"); \
150  asm("nop"); \
151  asm("nop"); \
152  asm("nop"); // ~390ns
153  #define DELAY_TOL \
154  asm("nop"); \
155  asm("nop"); \
156  asm("nop"); \
157  asm("nop"); \
158  asm("nop"); \
159  asm("nop"); \
160  asm("nop"); \
161  asm("nop"); \
162  asm("nop"); \
163  asm("nop"); \
164  asm("nop"); \
165  asm("nop"); \
166  asm("nop"); \
167  asm("nop"); \
168  asm("nop"); \
169  asm("nop"); \
170  asm("nop"); \
171  asm("nop"); \
172  asm("nop"); \
173  asm("nop"); \
174  asm("nop"); \
175  asm("nop"); \
176  asm("nop"); \
177  asm("nop"); \
178  asm("nop"); \
179  asm("nop"); \
180  asm("nop"); \
181  asm("nop"); \
182  asm("nop"); \
183  asm("nop"); \
184  asm("nop"); \
185  asm("nop"); // ~800ns
186  #define DELAY_T1H Delay_Cyc( 3 ); // ~790ns
187  #define DELAY_T1L // ~560ns
188  #else
189  #error "Logic delays are not defined for the selected MCU"
190  #endif
191 #elif __GNUC__
192  #ifdef STM32F407ZG
193  /*< Adjusted for STM32F407ZG */
194  #define DELAY_TOH Delay_Cyc( 2 ); // ~470ns
195  #define DELAY_TOL Delay_Cyc( 5 ); // ~860ns
196  #define DELAY_T1H Delay_Cyc( 10 ); // ~850ns
197  #define DELAY_T1L asm("nop"); // ~410ns
198  #elif MK64
199  /*< Adjusted for MK64FN1M0VDC12 */
200  #define DELAY_TOH \
201  asm("nop"); \
202  asm("nop"); \
203  asm("nop"); \
204  asm("nop"); \
205  asm("nop"); \
206  asm("nop"); \
207  asm("nop"); \
208  asm("nop"); \
209  asm("nop"); \
210  asm("nop"); \
211  asm("nop"); \
212  asm("nop"); \
213  asm("nop"); \
214  asm("nop"); \
215  asm("nop"); \
216  asm("nop"); \
217  asm("nop"); \
218  asm("nop"); \
219  asm("nop"); \
220  asm("nop"); \
221  asm("nop"); \
222  asm("nop"); \
223  asm("nop"); \
224  asm("nop"); \
225  asm("nop"); \
226  asm("nop"); \
227  asm("nop"); \
228  asm("nop"); \
229  asm("nop"); \
230  asm("nop"); \
231  asm("nop"); \
232  asm("nop"); // ~380ns
233  #define DELAY_TOL Delay_Cyc( 2 ); // ~830ns
234  #define DELAY_T1H Delay_Cyc( 16 ); // ~850ns
235  #define DELAY_T1L // ~430ns
236  #elif TM4C129
237  /*< Adjusted for TM4C129XNCZAD */
238  #define DELAY_TOH // ~440ns
239  #define DELAY_TOL // ~990ns
240  #define DELAY_T1H Delay_Cyc( 2 ); // ~970ns
241  #define DELAY_T1L // ~950ns
242  #elif GD32VF103VBT6
243  /*< Adjusted for GD32VF103VBT6 */
244  #define DELAY_TOH \
245  asm("nop"); \
246  asm("nop"); \
247  asm("nop"); \
248  asm("nop"); \
249  asm("nop"); \
250  asm("nop"); \
251  asm("nop"); \
252  asm("nop"); \
253  asm("nop"); \
254  asm("nop"); \
255  asm("nop"); \
256  asm("nop"); \
257  asm("nop"); \
258  asm("nop"); \
259  asm("nop"); \
260  asm("nop"); \
261  asm("nop"); \
262  asm("nop"); \
263  asm("nop"); \
264  asm("nop"); \
265  asm("nop"); \
266  asm("nop"); \
267  asm("nop"); \
268  asm("nop"); \
269  asm("nop"); \
270  asm("nop"); \
271  asm("nop"); \
272  asm("nop"); \
273  asm("nop"); \
274  asm("nop"); \
275  asm("nop"); \
276  asm("nop"); // ~420ns
277  #define DELAY_TOL Delay_Cyc( 2 ); // ~830ns
278  #define DELAY_T1H Delay_Cyc( 5 ); // ~850ns
279  #define DELAY_T1L // ~460ns
280  #else
281  #error "Logic delays are not defined for the selected MCU"
282  #endif
283 #else
284  #error "Logic delays are not defined for the selected toolchain"
285 #endif
286 
287 #endif // C7SEGRGB_DELAYS_H