Skip to content

Commit 725dfd5

Browse files
michallencxiaoxiang781216
authored andcommitted
samv7: fix compilation error when only DAC1 is configured
The function call dac_txdone(&g_dac1dev) was not contained in ifdef section. This was cousing compilation error if only DAC1 was configured as the structure g_dac1dev is defined only if DAC0 is used. This commit fixes the error and ensures the function is called only if corresponding DAC is configured. Signed-off-by: Michal Lenc <[email protected]>
1 parent becaf3b commit 725dfd5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

arch/arm/src/samv7/sam_dac.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,20 +189,23 @@ static struct sam_dac_s g_dacmodule;
189189

190190
static int dac_interrupt(int irq, void *context, void *arg)
191191
{
192-
#ifdef CONFIG_SAMV7_DAC1
193192
uint32_t status;
194193

195194
status = getreg32(SAM_DACC_ISR) & getreg32(SAM_DACC_IMR);
196-
if (status & DACC_INT_TXRDY1)
197-
{
198-
dac_txdone(&g_dac2dev);
199-
}
200195

196+
#ifdef CONFIG_SAMV7_DAC0
201197
if (status & DACC_INT_TXRDY0)
202-
#endif
203198
{
204199
dac_txdone(&g_dac1dev);
205200
}
201+
#endif
202+
203+
#ifdef CONFIG_SAMV7_DAC1
204+
if (status & DACC_INT_TXRDY1)
205+
{
206+
dac_txdone(&g_dac2dev);
207+
}
208+
#endif
206209

207210
return OK;
208211
}

0 commit comments

Comments
 (0)