-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1383 lines (1256 loc) · 69.8 KB
/
index.html
File metadata and controls
1383 lines (1256 loc) · 69.8 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- SEO & Display Meta Tags -->
<title>Team Ignition | Coding Standards & Conventions</title>
<meta name="description" content="Official confidential coding standards for Team Ignition: Embedded C, Python, and Flight Software Algorithms.">
<meta name="author" content="Team Ignition">
<meta name="theme-color" content="#111111">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
/* --- Core Theme & Styles --- */
:root {
--primary: #0a84ff;
--primary-dark: #0077ee;
--bg-dark: #0a0a0a;
--bg-darker: #111111;
--bg-light: #1a1a1a;
--text-primary: #e1e1e3;
--text-secondary: #a0a0a5;
--border: #2a2a2a;
--accent: #ff4d00; /* Ignition Orange */
--accent-dim: rgba(255, 77, 0, 0.15);
--success: #30d158;
--warning: #ffd60a;
--danger: #ff453a;
--c-color: #a9b7c6;
--py-color: #3572A5;
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
--font-mono: 'JetBrains Mono', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 2rem; }
body {
font-family: var(--font-sans);
background-color: var(--bg-dark);
color: var(--text-primary);
line-height: 1.7;
font-size: 16px;
}
/* Custom Scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background-color: var(--border); border-radius: 6px; border: 3px solid var(--bg-dark); }
::-webkit-scrollbar-thumb:hover { background-color: var(--accent); }
/* Typography */
h1, h2, h3, h4 { color: var(--text-primary); line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 2.75rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin: 4rem 0 1.5rem 0; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
h3 { font-size: 1.5rem; margin: 2.5rem 0 1rem 0; color: var(--text-primary); }
h4 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem 0; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
h5 { font-size: 1rem; margin: 1rem 0 0.5rem 0; color: var(--text-primary); font-weight: 600; }
p { margin-bottom: 1rem; color: var(--text-secondary); max-width: 80ch; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #ff6a00; text-decoration: underline; }
strong { font-weight: 600; color: var(--text-primary); }
ul, ol { margin: 1rem 0 1rem 1.5rem; color: var(--text-secondary); }
li { margin-bottom: 0.5rem; }
/* Layout */
.container { display: flex; min-height: 100vh; }
.sidebar {
width: 320px; /* Slightly wider for better readability */
background: var(--bg-darker);
border-right: 1px solid var(--border);
position: fixed;
height: 100vh;
display: flex;
flex-direction: column;
z-index: 1000;
transition: transform 0.3s ease;
}
.content {
margin-left: 320px; /* Match sidebar width */
width: calc(100% - 320px);
display: flex;
flex-direction: column;
min-height: 100vh;
}
.main-body {
flex: 1;
padding: 4rem 6rem; /* More breathing room */
}
/* --- NEW HEADER STYLES --- */
.intro-header {
display: flex;
align-items: center;
gap: 3rem;
margin-bottom: 3rem;
border-bottom: 1px solid var(--border);
padding-bottom: 3rem;
}
.intro-logo {
width: 180px;
height: auto;
flex-shrink: 0;
}
.intro-text h1 {
margin-top: 0;
margin-bottom: 0.75rem;
font-size: 3rem; /* Slightly larger for impact */
}
.intro-text p {
font-size: 1.1rem;
opacity: 0.9;
margin-bottom: 0;
max-width: 60ch;
}
/* Language Badges */
.lang-badge {
font-size: 0.7rem;
padding: 4px 10px;
border-radius: 12px;
background: var(--bg-light);
color: var(--text-secondary);
font-weight: 700;
vertical-align: middle;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.lang-badge.c { background: rgba(169, 183, 198, 0.1); color: var(--c-color); border: 1px solid var(--c-color); }
.lang-badge.py { background: rgba(53, 114, 165, 0.1); color: var(--py-color); border: 1px solid var(--py-color); }
.lang-badge.algo { background: rgba(255, 77, 0, 0.1); color: var(--accent); border: 1px solid var(--accent); }
/* Components */
.callout { background: var(--bg-light); border-left: 4px solid var(--accent); padding: 1.5rem; margin: 2rem 0; border-radius: 0 8px 8px 0; }
.callout.danger { border-color: var(--danger); background: rgba(255, 69, 58, 0.05); }
.callout-title { font-weight: 700; color: var(--text-primary); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 10px; }
/* Drive Link Buttons */
.drive-links {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
flex-wrap: wrap;
}
.drive-btn {
display: inline-flex;
align-items: center;
gap: 8px;
background: var(--bg-light);
color: var(--text-primary);
padding: 0.8rem 1.2rem;
border-radius: 8px;
border: 1px solid var(--border);
font-weight: 600;
text-decoration: none;
transition: all 0.2s ease;
}
.drive-btn:hover {
background: var(--accent);
color: white;
border-color: var(--accent);
text-decoration: none;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(255, 77, 0, 0.2);
}
.drive-btn svg {
width: 20px;
height: 20px;
}
/* Code Blocks */
.code-block-wrapper {
background: #161618; /* Slightly different than bg-light for contrast */
border: 1px solid var(--border);
border-radius: 8px;
margin: 1.5rem 0;
overflow: hidden;
}
.code-header {
display: flex; justify-content: space-between; align-items: center;
background: var(--bg-darker); padding: 0.5rem 1rem;
border-bottom: 1px solid var(--border);
font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary);
}
pre { margin: 0; padding: 1.25rem 1.5rem; overflow-x: auto; }
pre code {
font-family: var(--font-mono);
font-size: 0.9rem;
color: var(--text-primary);
line-height: 1.6;
background: transparent;
padding: 0;
}
/* Inline code */
p code, li code, td code {
background: var(--bg-light);
padding: 0.2em 0.4em;
border-radius: 4px;
font-family: var(--font-mono);
font-size: 0.85em;
color: var(--accent);
}
.copy-btn { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 0.8rem; padding: 4px 8px; border-radius: 4px; transition: all 0.2s; }
.copy-btn:hover { background: var(--border); color: var(--text-primary); }
/* Tables */
.table-wrapper { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; background: var(--bg-darker); text-align: left; }
th, td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
th:last-child, td:last-child { border-right: none; }
th { background: var(--bg-light); color: var(--text-primary); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover { background: var(--bg-light); }
/* Navigation - IMPROVED */
.sidebar-header {
padding: 2rem 1.5rem 1.5rem;
background: var(--bg-darker);
border-bottom: 1px solid var(--border);
}
.nav-container {
flex-grow: 1;
overflow-y: auto;
padding: 1rem 0 3rem 0;
}
.nav-section-title {
padding: 1.5rem 2rem 0.75rem; /* More left padding */
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.12em;
color: var(--text-secondary);
opacity: 0.8;
}
.nav-item {
display: flex;
align-items: center;
gap: 12px;
padding: 0.75rem 2rem; /* More generous padding */
color: var(--text-secondary);
font-size: 0.95rem;
border-left: 4px solid transparent;
transition: all 0.15s ease-in-out;
font-weight: 500;
}
.nav-item:hover {
background: var(--bg-light);
color: var(--text-primary);
}
.nav-item.active {
background: linear-gradient(to right, var(--accent-dim), transparent);
color: var(--accent);
border-left-color: var(--accent);
font-weight: 600;
}
.nav-item svg {
width: 18px;
height: 18px;
opacity: 0.7;
flex-shrink: 0;
}
.nav-item.active svg {
opacity: 1;
}
/* Search - IMPROVED */
.search-container {
position: relative;
}
#search-input {
width: 100%;
background: var(--bg-dark);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.75rem 1rem 0.75rem 2.5rem;
color: var(--text-primary);
font-size: 0.95rem;
transition: border-color 0.2s, box-shadow 0.2s;
}
#search-input:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-dim);
}
.search-icon {
position: absolute;
left: 0.8rem;
top: 50%;
transform: translateY(-50%);
color: var(--text-secondary);
width: 18px;
height: 18px;
opacity: 0.7;
pointer-events: none;
}
.search-clear {
position: absolute;
right: 0.8rem;
top: 50%;
transform: translateY(-50%);
color: var(--text-secondary);
cursor: pointer;
display: none; /* Hidden by default */
}
.search-clear:hover { color: var(--text-primary); }
/* Highlighting - MUCH BETTER VISIBILITY */
.highlight {
background-color: #ffd700; /* Bright yellow for max contrast */
color: #000000; /* Black text on yellow */
padding: 2px 4px;
border-radius: 4px;
font-weight: 700;
box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); /* Glow effect */
}
/* Interactive Practice */
.practice-problem {
background: var(--bg-light);
border: 1px solid var(--border);
border-radius: 8px;
padding: 1.5rem;
margin: 2rem 0;
}
.practice-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.reveal-btn {
background: var(--accent);
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
transition: background 0.2s;
}
.reveal-btn:hover { background: #ff6a00; }
.solution { display: none; margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.solution.visible { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* Footer - FINAL POLISH */
footer {
background: var(--bg-darker);
border-top: 1px solid var(--border);
padding: 4rem 6rem;
margin-top: auto;
}
.footer-grid {
display: grid;
grid-template-columns: 1.5fr 1fr;
gap: 4rem;
margin-bottom: 4rem;
align-items: start;
}
.footer-logo-section {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.footer-logo-img {
height: 40px;
width: auto;
align-self: flex-start;
opacity: 0.9;
transition: opacity 0.2s;
}
.footer-logo-img:hover { opacity: 1; }
.footer-text {
font-size: 0.95rem;
color: var(--text-secondary);
max-width: 450px;
line-height: 1.6;
}
.confidential-box {
background: rgba(255, 69, 58, 0.08); /* Slightly more visible */
border: 1px solid var(--danger);
padding: 2rem;
border-radius: 12px;
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}
.confidential-box h4 {
color: var(--danger);
margin-top: 0;
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 0.75rem;
font-size: 1.1rem;
}
.confidential-box p {
font-size: 0.9rem;
margin-bottom: 0;
color: var(--text-primary);
opacity: 0.9;
}
.copyright {
text-align: center;
padding-top: 2rem;
border-top: 1px solid var(--border);
color: var(--text-secondary);
font-size: 0.9rem;
opacity: 0.7;
}
/* Responsive - IMPROVED */
.mobile-toggle { display: none; position: fixed; top: 1rem; right: 1rem; z-index: 1001; background: var(--bg-darker); border: 1px solid var(--border); padding: 0.6rem; border-radius: 8px; color: var(--text-primary); cursor: pointer; transition: background 0.2s; }
.mobile-toggle:hover { background: var(--bg-light); }
@media (max-width: 1024px) {
.sidebar { transform: translateX(-100%); box-shadow: none; }
.sidebar.open { transform: translateX(0); box-shadow: 0 0 50px rgba(0,0,0,0.7); }
.content { margin-left: 0; width: 100%; }
.main-body { padding: 3rem 2rem; } /* Better mobile padding */
footer { padding: 3rem 2rem; }
.mobile-toggle { display: block; }
/* Responsive Header */
.intro-header {
flex-direction: column;
align-items: flex-start;
gap: 2rem;
}
.intro-logo {
width: 150px;
}
.intro-text h1 {
font-size: 2.5rem;
}
/* Responsive Footer */
.footer-grid { grid-template-columns: 1fr; gap: 3rem; }
}
</style>
</head>
<body>
<!-- Mobile Menu Toggle -->
<button class="mobile-toggle" id="menu-toggle" aria-label="Toggle Menu">
<svg width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M3 12h18M3 6h18M3 18h18"/></svg>
</button>
<div class="container">
<!-- Sidebar -->
<aside class="sidebar" id="sidebar">
<div class="sidebar-header">
<div class="search-container">
<svg class="search-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
<input type="text" id="search-input" placeholder="Search standards...">
<svg class="search-clear" id="search-clear" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</div>
</div>
<nav class="nav-container" id="nav-container">
<div class="nav-section-title">Overview</div>
<a href="#intro" class="nav-item active" data-target="intro"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg> Introduction</a>
<a href="#purpose" class="nav-item" data-target="purpose"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/></svg> Why Standards Matter</a>
<a href="#universal" class="nav-item" data-target="universal"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg> Universal Standards</a>
<div class="nav-section-title" style="color: var(--c-color);">Embedded C Guide</div>
<a href="#c-edu-basics" class="nav-item" data-target="c-edu-basics"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"/></svg> C Basics Explained</a>
<a href="#c-edu-macros" class="nav-item" data-target="c-edu-macros"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"/></svg> Power of Macros</a>
<a href="#c-edu-realtime" class="nav-item" data-target="c-edu-realtime"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg> Real-Time Concepts</a>
<div class="nav-section-title" style="color: var(--accent);">Advanced Algorithms</div>
<a href="#algo-fsm" class="nav-item" data-target="algo-fsm"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg> Finite State Machines</a>
<a href="#algo-pid" class="nav-item" data-target="algo-pid"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/></svg> PID Control</a>
<a href="#algo-kalman" class="nav-item" data-target="algo-kalman"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M7 12l3-3 3 3 4-4M8 21l4-4 4 4M3 4h18M4 4h16v12a1 1 0 01-1 1H5a1 1 0 01-1-1V4z"/></svg> Kalman Filtering</a>
<div class="nav-section-title" style="color: var(--c-color);">Embedded C Standards</div>
<a href="#c-structure" class="nav-item" data-target="c-structure"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M4 6h16M4 10h16M4 14h8"/></svg> File Structure</a>
<a href="#c-naming" class="nav-item" data-target="c-naming"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14"/></svg> Naming & Types</a>
<a href="#c-formatting" class="nav-item" data-target="c-formatting"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M4 6h16M4 12h16m-7 6h7"/></svg> Formatting (Braces)</a>
<a href="#c-functions" class="nav-item" data-target="c-functions"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"/></svg> Functions & Docs</a>
<a href="#c-templates" class="nav-item" data-target="c-templates"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg> C Templates</a>
<div class="nav-section-title" style="color: var(--py-color);">Python</div>
<a href="#py-naming" class="nav-item" data-target="py-naming"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M12 6V3m0 18v-3M5.636 5.636L4.222 4.222m15.556 15.556L18.364 18.364M5.636 18.364L4.222 19.778m15.556-15.556l1.414-1.414"/></svg> Naming Conventions</a>
<a href="#py-docs" class="nav-item" data-target="py-docs"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg> Docstrings & Types</a>
<a href="#py-structure" class="nav-item" data-target="py-structure"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"/></svg> Project Structure</a>
<div class="nav-section-title" style="color: var(--success);">Practice</div>
<a href="#practice" class="nav-item" data-target="practice"><svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"/><path d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg> Practice Arena</a>
</nav>
</aside>
<!-- Main Content -->
<main class="content">
<div class="main-body">
<!-- NEW INTRO HEADER SECTION -->
<section id="intro" class="page-intro">
<div class="intro-header">
<img src="https://glance.teamignition.space/public/ign_logo_wht.svg" alt="Team Ignition Logo" class="intro-logo">
<div class="intro-text">
<h1>Ignition Coding Standards</h1>
<p>As a student rocketry team, Team Ignition develops a wide range of software completely in-house—from flight-critical avionics firmware to ground station telemetry dashboards. Adherence to these standards ensures our diverse codebase remains maintainable, readable, and reliable during high-pressure launch operations.</p>
</div>
</div>
<div class="callout danger">
<div class="callout-title">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>
Mandatory Adherence
</div>
<p>These standards must be followed by all members of the Software, Avionics, and Payload departments. All Pull Requests (PRs) will be reviewed against this guide before merging.</p>
</div>
</section>
<section id="purpose">
<h2>Why Standards Matter</h2>
<p>In high-stakes engineering projects like rocketry, code is more than just instructions for a computer; it's a critical component of mission success. A single bug in our avionics firmware can lead to total vehicle loss.</p>
<ul>
<li><strong>Safety & Reliability:</strong> Consistent, well-structured code is easier to audit for potential failure points before they happen in flight.</li>
<li><strong>Knowledge Transfer:</strong> We are a student team with constant member turnover. Standardized code ensures that new recruits can understand and maintain legacy systems written by alumni years ago.</li>
<li><strong>Interoperability:</strong> When the Payload team's science experiments need to talk to the Avionics team's flight computer, adhering to shared data structure and naming conventions prevents integration nightmares on the launchpad.</li>
</ul>
</section>
<section id="universal">
<h2>Universal Standards <span class="lang-badge">ALL</span></h2>
<p>These rules apply to every file in our repositories, regardless of language.</p>
<h3>1. ASCII Header & Copyright</h3>
<p>Every source file must start with the standard team ASCII art and copyright notice.</p>
<div class="code-block-wrapper">
<div class="code-header"><span>Standard Header Template</span><button class="copy-btn">Copy</button></div>
<pre><code>/*
::
::
::
::
::
.. .......... :. :: :: ......... .. .......... ... .
:: :: : .:. :: .::. :: :: :: : :: :. :
:: :: ..::: : .:. :: :::::: :: :: :: : :: :: :
:: ::......:: : ::: :::::: :: :: ::.......: :: :::
::::::
:.::.:
.:::: :: ::::.
.::::::::. :: .:::::::::
::::::::::::....::::.....:::::::::::
.:::::::::::::::::::::::::::::::::.
© Copyright of Ignition <Department Name>
*/</code></pre>
</div>
<p>Example with file details and history block:</p>
<div class="code-block-wrapper">
<div class="code-header"><span>Real-World Example (fin_actuator.c)</span><button class="copy-btn">Copy</button></div>
<pre><code class="language-c">/**************************************************************************************************
* File: fin_actuator.c
* Author: John Doe
* Created On: 2025-01-15
* * Brief:
* Source file for Fin Actuator Module.
* * Description:
* Implements PID-based active roll control using MPU6050 and 4 servo fins.
***************************************************************************************************
* HISTORY:
* * +----- (NEW | MODify | ADD | DELete)
* |
* No# | when who what
******+*********+**********+********************+**************************************************
* 000 NEW 2025-01-15 John Doe Initial creation
**************************************************************************************************/</code></pre>
</div>
<h3>2. Version History Block</h3>
<p>Maintain a manual history block at the top of critical files (especially firmware and core telemetry libraries) to track changes alongside Git history.</p>
<div class="code-block-wrapper">
<div class="code-header"><span>History Block</span><button class="copy-btn">Copy</button></div>
<pre><code>/**************************************************************************************************
* HISTORY:
*
* +----- (NEW | MODify | ADD | DELete)
* |
* No# | when who what
******+*********+**********+********************+**************************************************
* 000 NEW 2025-06-13 John Doe Initial creation
* 001 ADD 2025-06-14 Jane Smith Added SystemInit() logic
**************************************************************************************************/</code></pre>
</div>
<h3>3. Commit Messages</h3>
<p>Use clear, imperative present-tense commit messages. Prefix with the subsystem if applicable.</p>
<ul>
<li><strong>Good:</strong> <code>[Avionics] Fix stack overflow in IMU sensor task</code></li>
<li><strong>Bad:</strong> <code>fixed bug</code> or <code>updated code</code></li>
</ul>
</section>
<!-- EDUCATIONAL EMBEDDED C SECTION -->
<section id="c-edu-basics">
<h2>Embedded C: The Basics Explained</h2>
<p>Understanding the <em>why</em> behind our standards helps you write better code. Here's a breakdown of core concepts.</p>
<h3>The .c vs. .h Split</h3>
<p>In C, we split code into <strong>Header files (.h)</strong> and <strong>Source files (.c)</strong>. This is crucial for modularity.</p>
<ul>
<li><strong>Header Files (.h):</strong> These are the "public interface" of your module. They tell other parts of the code <em>what</em> your module can do, but not <em>how</em> it does it. They contain function prototypes, public struct definitions, macros, and extern variable declarations. Think of it as a menu in a restaurant.</li>
<li><strong>Source Files (.c):</strong> These contain the actual implementation logic. They represent the "kitchen" where the work happens. This file includes its own `.h` file to ensure it matches the advertised interface.</li>
</ul>
<div class="callout">
<strong>Why?</strong> If you change <em>how</em> a function works internally (in the `.c` file) without changing its inputs/outputs (in the `.h` file), you don't need to recompile every other file that uses it. This saves massive amounts of time in large projects.
</div>
</section>
<section id="c-edu-macros">
<h2>The Power of Macros</h2>
<p>Macros (defined with `#define`) are preprocessor directives that perform text substitution before compilation. We use them extensively for two main reasons:</p>
<h3>1. Avoiding Magic Numbers</h3>
<p>A "magic number" is a raw number in code with no context. It's confusing and hard to update.</p>
<ul>
<li><strong>Bad:</strong> <code>if (speed > 1200) { ... }</code> — What is 1200? meters/sec? RPM? raw sensor ticks?</li>
<li><strong>Good:</strong> <code>#define MAX_SAFE_SPEED_RPM (1200U)</code><br><code>if (speed > MAX_SAFE_SPEED_RPM) { ... }</code> — Clear, and if the limit changes, you only update it in one place.</li>
</ul>
<h3>2. Reusable, Efficient Operations</h3>
<p>Small, frequent operations can be defined as macros for efficiency, as they avoid function call overhead. Always wrap macro arguments in parentheses to avoid order-of-operation bugs.</p>
<div class="code-block-wrapper">
<pre><code class="language-c">// BAD: #define SQUARE(x) x * x
// SQUARE(5+1) becomes 5 + 1 * 5 + 1 = 5 + 5 + 1 = 11 (WRONG!)
// GOOD:
#define SQUARE(x) ((x) * (x))
// SQUARE(5+1) becomes ((5+1) * (5+1)) = (6 * 6) = 36 (CORRECT!)</code></pre>
</div>
</section>
<section id="c-edu-typedef">
<h2>Why Typedef?</h2>
<p>`typedef` allows us to create aliases for data types. In Embedded C, this is critical for portability.</p>
<p>Different microcontrollers have different sizes for standard types like `int`. On an 8-bit AVR, `int` might be 16 bits. On a 32-bit STM32, `int` is 32 bits. This can cause catastrophic bugs if your code assumes a specific size.</p>
<p>By using `<stdint.h>` typedefs like `uint8_t`, `int32_t`, etc., we guarantee the exact size of our variables regardless of the hardware, ensuring our flight code works reliably everywhere.</p>
</section>
<section id="c-edu-realtime">
<h2>Real-Time Concepts</h2>
<p>A rocket doesn't wait for your code to finish. We must write code that meets strict timing deadlines.</p>
<h3>Blocking vs. Non-Blocking Code</h3>
<p><strong>Blocking</strong> code halts the CPU until a task is done (e.g., writing to an SD card). <strong>Non-blocking</strong> code starts a task and immediately returns, checking back later.</p>
<div class="callout danger">
<strong>Critical:</strong> Never use blocking code in the main flight control loop. An SD card write can take 100ms+, which could cause the rocket to become unstable if it misses gyro updates during that time.
</div>
<p><strong>Solution:</strong> Use <strong>interrupts</strong> to handle time-critical sensor data, and use <strong>buffers</strong> (RAM) to temporarily store data before writing it to slow peripherals like SD cards when the CPU is idle.</p>
</section>
<!-- ADVANCED ALGORITHMS SECTION -->
<section id="algo-fsm">
<h2>Finite State Machines (FSM) <span class="lang-badge algo">CRITICAL</span></h2>
<p>An FSM is mandatory for flight logic. It prevents invalid states, like firing a parachute while still on the launch pad.</p>
<h3>Standard Flight States</h3>
<ul>
<li><code>PAD_IDLE</code>: Rocket is on ground, disarmed.</li>
<li><code>ARMED</code>: Ready for launch, awaiting acceleration trigger.</li>
<li><code>POWERED_ASCENT</code>: Motor is burning, high-G acceleration.</li>
<li><code>COAST</code>: Motor burnout, coasting to apogee.</li>
<li><code>APOGEE</code>: Zero vertical velocity, deploy drogue parachute.</li>
<li><code>MAIN_DESCENT</code>: Reached lower altitude, deploy main parachute.</li>
<li><code>LANDED</code>: safely on ground, stop logging.</li>
</ul>
<div class="code-block-wrapper">
<div class="code-header"><span>FSM Implementation Example</span></div>
<pre><code class="language-cpp">switch (gCurrentState)
{
case STATE_PAD_IDLE:
if (IsLaunchDetected()) {
TransitionTo(STATE_POWERED_ASCENT);
}
break;
case STATE_COAST:
if (Velocity <= 0 && Altitude > MIN_APOGEE) {
TransitionTo(STATE_APOGEE);
}
break;
// ... other states
}</code></pre>
</div>
</section>
<section id="algo-pid">
<h2>PID Control <span class="lang-badge algo">STABILIZATION</span></h2>
<p>Used for active stabilization (fins, thrust vectoring). It calculates a corrective action based on the error between desired and actual orientation.</p>
<ul>
<li><strong>P (Proportional):</strong> Reacts to current error. "We are tilted 10 degrees, push back hard."</li>
<li><strong>I (Integral):</strong> Reacts to accumulated past error. "We've been tilted for 5 seconds, push harder to fix it."</li>
<li><strong>D (Derivative):</strong> Reacts to rate of change. "We are tilting too fast, slow down."</li>
</ul>
<div class="code-block-wrapper">
<div class="code-header"><span>Robust PID Class with Anti-Windup</span><button class="copy-btn">Copy</button></div>
<pre><code class="language-cpp">class PID {
public:
PID(float kp, float ki, float kd, float max_i)
: _kp(kp), _ki(ki), _kd(kd), _max_i(max_i), _integral(0), _prev_error(0) {}
float update(float setpoint, float measured, float dt) {
float error = setpoint - measured;
_integral += error * dt;
// Anti-windup: clamp integral term
if (_integral > _max_i) _integral = _max_i;
else if (_integral < -_max_i) _integral = -_max_i;
float derivative = (error - _prev_error) / dt;
_prev_error = error;
return (_kp * error) + (_ki * _integral) + (_kd * derivative);
}
private:
float _kp, _ki, _kd, _max_i;
float _integral, _prev_error;
};</code></pre>
</div>
</section>
<section id="algo-kalman">
<h2>Kalman Filtering <span class="lang-badge algo">STATE ESTIMATION</span></h2>
<p>Raw sensor data is noisy. A Kalman filter fuses data from multiple sensors (e.g., accelerometer + barometer) to create a single, highly accurate estimate of altitude and velocity. This is essential for precise apogee detection.</p>
<p>It works in a two-step cycle:</p>
<ol>
<li><strong>Predict:</strong> Use physics equations (accelerometer data) to guess where the rocket will be next.</li>
<li><strong>Update:</strong> Use a real measurement (barometer altitude) to correct that guess based on how trusted each sensor is.</li>
</ol>
</section>
<!-- STANDARD C SECTION -->
<section id="c-structure">
<h2>Embedded C Standards <span class="lang-badge c">AVIONICS</span></h2>
<h3>File Structure & Logical Order</h3>
<p>The recommended logical order of a <code>.c</code> or <code>.h</code> file is:</p>
<ol>
<li>ASCII Header & File Info Block</li>
<li>Includes (System <code><...></code> first, then Project <code>"..."</code>)</li>
<li>Macros / Constants</li>
<li>Enumerations</li>
<li>Typedefs / Structures</li>
<li>Global / Static Variables</li>
<li>Static Function Declarations</li>
<li>Function Definitions</li>
</ol>
</section>
<section id="c-naming">
<h3>Naming Conventions (C)</h3>
<p>Meaningful names are self-documenting. Avoid cryptic abbreviations (e.g., use <code>CalculateVelocity</code> instead of <code>CalcVel</code>).</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Entity</th><th>Convention</th><th>Example</th></tr>
</thead>
<tbody>
<tr><td>Macros / Constants</td><td><code>UPPER_SNAKE_CASE</code></td><td><code>MAX_ALLOWED_SPEED</code></td></tr>
<tr><td>Enums</td><td>PascalCase (type) + <code>ALL_CAPS</code> (values)</td><td><code>SystemState</code>, <code>STATE_ERROR</code></td></tr>
<tr><td>Structs</td><td>Prefix 't' + PascalCase (Optional) or PascalCase</td><td><code>tSensorData</code> or <code>SensorData</code></td></tr>
<tr><td>Globals</td><td>Prefix 'g' + CamelCase</td><td><code>gRuntimeStatus</code></td></tr>
<tr><td>Statics (Private)</td><td>Prefix 's' + CamelCase</td><td><code>sControlFlag</code></td></tr>
<tr><td>Functions</td><td>PascalCase (VerbNoun)</td><td><code>SystemInit()</code></td></tr>
<tr><td>Pointers</td><td>Prefix 'p'</td><td><code>pDataBuffer</code></td></tr>
</tbody>
</table>
</div>
<h3>Standard Types (stdint.h)</h3>
<p>ALWAYS use fixed-width types for portability across platforms (e.g., STM32, ESP32, AVR).</p>
<div class="table-wrapper">
<table>
<thead><tr><th>Standard Type</th><th>Defined As</th></tr></thead>
<tbody>
<tr><td>unsigned char</td><td><code>uint8_t</code></td></tr>
<tr><td>unsigned short</td><td><code>uint16_t</code></td></tr>
<tr><td>unsigned long</td><td><code>uint32_t</code></td></tr>
<tr><td>signed char</td><td><code>int8_t</code></td></tr>
<tr><td>signed short</td><td><code>int16_t</code></td></tr>
<tr><td>signed long</td><td><code>int32_t</code></td></tr>
<tr><td>boolean</td><td><code>bool</code> (requires <code><stdbool.h></code>)</td></tr>
</tbody>
</table>
</div>
</section>
<section id="c-formatting">
<h3>Formatting Guidelines</h3>
<h4>Indentation & Whitespace</h4>
<ul>
<li>Use <strong>TAB</strong> (set to 4 spaces width) for indentation.</li>
<li>Use one blank line to separate logical blocks of code.</li>
<li>Space around operators: <code>result = value1 + value2;</code> not <code>result=value1+value2;</code>.</li>
<li>Space after commas and semicolons: <code>Function(arg1, arg2, arg3);</code></li>
<li>Space after keywords with parentheses: <code>for (int i = 0; i < 10; i++)</code></li>
</ul>
<h4>Braces (Allman/BSD Style)</h4>
<p>Braces are <strong>always required</strong>, even for single-line blocks. Opening braces must be on a <strong>new line</strong>.</p>
<div class="code-block-wrapper">
<pre><code class="language-c">if (condition)
{
PerformAction();
}
else
{
HandleError();
}</code></pre>
</div>
</section>
<section id="c-functions">
<h3>Function Documentation (Doxygen)</h3>
<p>Every function must have a Doxygen header. We use different styles for global vs. static functions.</p>
<h4>Global Function Header</h4>
<div class="code-block-wrapper">
<pre><code class="language-c">/**
* \brief Initializes the system.
* \details Sets up default configuration and resets status trackers.
*
* \param[in] initState Desired system state to initialize.
* \return RESULT_OK if successful, RESULT_INVALID_PARAM if state is invalid.
*
* \pre Must be called before other system routines.
* \post Global status and config are initialized.
*/
ResultCode SystemInit(SystemState initState)
{
// Implementation...
}</code></pre>
</div>
<h4>Static (Private) Function Header</h4>
<div class="code-block-wrapper">
<pre><code class="language-c">/**
* \brief Validates configuration structure.
*
* \param[in] config Pointer to config to validate.
* \return true if valid, false otherwise.
*/
static bool Module_ValidateConfig(const ModuleConfig* config);</code></pre>
</div>
<h3>Error Handling</h3>
<p>All failure-prone functions MUST return a <code>ResultCode</code>. Validate all inputs at the start of every function. **No silent failures.**</p>
</section>
<section id="c-templates">
<h3>C Module Templates</h3>
<p>Use these templates exactly as shown for new modules.</p>
<!-- ADDED DRIVE LINKS HERE -->
<div class="drive-links">
<a href="https://drive.google.com/drive/folders/1fse1-j96eJJAO7OhyhyQJ5sEDTO-o_oy?usp=sharing" target="_blank" class="drive-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"/></svg>
Templates Folder
</a>
<a href="https://docs.google.com/document/d/1AbmAShuT2e7Qd-A6n7_8eX3vIoEVFz0d0hwLOTUMJds/edit?usp=drive_link" target="_blank" class="drive-btn">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>
Original DOCX Guide
</a>
</div>
<div class="code-block-wrapper">
<div class="code-header"><span>Template_module.h</span><button class="copy-btn">Copy</button></div>
<pre><code class="language-c">#ifndef TEMPLATE_MODULE_H_
#define TEMPLATE_MODULE_H_
/**************************************************************************************************
* Includes
**************************************************************************************************/
#include <stdint.h>
#include <stdbool.h>
/**************************************************************************************************
* Macro Definitions
**************************************************************************************************/
#define TEMPLATE_TIMEOUT_MS (500U)
/**************************************************************************************************
* Type Definitions
**************************************************************************************************/
/**
* \brief Operating states for the template module.
*/
typedef enum
{
MODE_IDLE = 0,
MODE_RUNNING,
MODE_ERROR
} TemplateMode;
/**
* \brief Result codes for function return.
*/
typedef enum
{
RESULT_OK = 0,
RESULT_INVALID_PARAM,
RESULT_TIMEOUT
} TemplateResult;
/**
* \brief Configuration parameters for initialization.
*/
typedef struct
{
uint16_t timeout_ms;
bool enable_flag;
} TemplateConfig;
/**
* \brief Internal runtime tracking structure.
*/
typedef struct
{
TemplateMode current_mode;
uint32_t tick_count;
} TemplateRuntime;
/**************************************************************************************************
* Public Function Prototypes
**************************************************************************************************/
/**
* \brief Initializes the template module.
* \param[in] config Pointer to configuration structure.
* \return RESULT_OK if successful, RESULT_INVALID_PARAM otherwise.
*/
TemplateResult Template_Init(const TemplateConfig* config);
/**
* \brief Periodic update for the module.
* \return RESULT_OK on success.
*/
TemplateResult Template_Update(void);
#endif /* TEMPLATE_MODULE_H_ */</code></pre>
</div>
<div class="code-block-wrapper">
<div class="code-header"><span>Template_module.c</span><button class="copy-btn">Copy</button></div>
<pre><code class="language-c">/**************************************************************************************************
* Includes
**************************************************************************************************/
#include "template_module.h"
/**************************************************************************************************
* Static Variables
**************************************************************************************************/
static TemplateRuntime s_runtime;
static TemplateConfig s_config;
/**************************************************************************************************
* Static Function Prototypes
**************************************************************************************************/
/**
* \brief Validates configuration structure.
* \param[in] config Pointer to config to validate.
* \return true if valid, false otherwise.
*/
static bool Template_ValidateConfig(const TemplateConfig* config);
/**************************************************************************************************
* Function Definitions
**************************************************************************************************/
TemplateResult Template_Init(const TemplateConfig* config)
{
if (!Template_ValidateConfig(config))
{
return RESULT_INVALID_PARAM;
}
s_config = *config;
s_runtime.current_mode = MODE_IDLE;
s_runtime.tick_count = 0U;
return RESULT_OK;
}
TemplateResult Template_Update(void)
{
s_runtime.tick_count++;
// Example control logic
if (s_runtime.current_mode == MODE_RUNNING)
{
// TODO: Add functional code here
}
return RESULT_OK;
}
/**************************************************************************************************
* Static Function Definitions
**************************************************************************************************/
static bool Template_ValidateConfig(const TemplateConfig* config)
{
if (config == NULL) { return false; }
if (config->timeout_ms == 0U) { return false; }
return true;
}</code></pre>