Skip to content

Commit 190d604

Browse files
committed
Pedal: 2 minor fixes to Misra 15.7 (else needed) and 17.7 (non-void output must be used)
1 parent 8ea01ff commit 190d604

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

board/drivers/dac.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
void puth(unsigned int i);
2+
void puts(const char *a);
3+
14
void dac_init(void) {
25
// no buffers required since we have an opamp
36
//DAC->CR = DAC_CR_EN1 | DAC_CR_BOFF1 | DAC_CR_EN2 | DAC_CR_BOFF2;
@@ -11,6 +14,10 @@ void dac_set(int channel, uint32_t value) {
1114
DAC->DHR12R1 = value;
1215
} else if (channel == 1) {
1316
DAC->DHR12R2 = value;
17+
} else {
18+
puts("Failed to set DAC: invalid channel value: ");
19+
puth(value);
20+
puts("\n");
1421
}
1522
}
1623

board/drivers/uart.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ void putch(const char a) {
304304

305305
//putc(&debug_ring, a);
306306
} else {
307-
injectc(&debug_ring, a);
307+
// misra-c2012-17.7: serial debug function, ok to ignore output
308+
(void)injectc(&debug_ring, a);
308309
}
309310
}
310311

0 commit comments

Comments
 (0)