Commit 20d4c75
fix(can): mcp2515: Guard TX interrupt handling for multi-buffer configs
The MCP2515 driver can be configured with 1, 2, or 3 transmit
buffers via the `MCP2515_TX_CNT` constant.
The interrupt handler checks for transmit complete interrupts for
`TXB1` and `TXB2`. However, the code for these checks was not guarded
by preprocessor conditionals. This meant the code would be compiled
even if the driver was configured to use only one transmit buffer
(`MCP2515_TX_CNT=1`), which is the default.
This change adds the appropriate `#if MCP2515_TX_CNT > 1` and
`#if MCP2515_TX_CNT > 2` guards around the interrupt handling logic
for the second and third transmit buffers, respectively. This ensures
that the code is only included when the corresponding buffers are
actually configured, improving code clarity and preventing compilation
of unused logic.
Signed-off-by: Badr Bacem KAABIA <badrbacemkaabia@gmail.com>1 parent 039013f commit 20d4c75
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
831 | 831 | | |
832 | 832 | | |
833 | 833 | | |
| 834 | + | |
834 | 835 | | |
835 | 836 | | |
836 | 837 | | |
| 838 | + | |
837 | 839 | | |
| 840 | + | |
838 | 841 | | |
839 | 842 | | |
840 | 843 | | |
| 844 | + | |
841 | 845 | | |
842 | 846 | | |
843 | 847 | | |
| |||
0 commit comments