From 016ab2a417e9ac025b4bab79192e78287662e3ee Mon Sep 17 00:00:00 2001 From: Chun-Chieh Li Date: Thu, 13 Jun 2019 18:11:50 +0800 Subject: [PATCH] [Nuvoton] Fix channel release in analogout_free() --- targets/TARGET_NUVOTON/TARGET_M2351/analogout_api.c | 2 +- targets/TARGET_NUVOTON/TARGET_M451/analogout_api.c | 2 +- targets/TARGET_NUVOTON/TARGET_M480/analogout_api.c | 2 +- targets/TARGET_NUVOTON/TARGET_NANO100/analogout_api.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/analogout_api.c b/targets/TARGET_NUVOTON/TARGET_M2351/analogout_api.c index 55380b61b7..7cfa6e22a2 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/analogout_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M2351/analogout_api.c @@ -124,7 +124,7 @@ void analogout_free(dac_t *obj) /* Channel-level windup from here */ /* Mark channel free */ - dac_modinit_mask[modidx] &= ~(1 << modidx); + dac_modinit_mask[modidx] &= ~(1 << chn); /* Close channel */ DAC_Close(dac_base, chn); diff --git a/targets/TARGET_NUVOTON/TARGET_M451/analogout_api.c b/targets/TARGET_NUVOTON/TARGET_M451/analogout_api.c index 4678f29b9d..31a576c87e 100644 --- a/targets/TARGET_NUVOTON/TARGET_M451/analogout_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M451/analogout_api.c @@ -106,7 +106,7 @@ void analogout_free(dac_t *obj) /* Channel-level windup from here */ /* Mark channel free */ - dac_modinit_mask[modidx] &= ~(1 << modidx); + dac_modinit_mask[modidx] &= ~(1 << chn); /* Close channel */ DAC_Close(dac_base, chn); diff --git a/targets/TARGET_NUVOTON/TARGET_M480/analogout_api.c b/targets/TARGET_NUVOTON/TARGET_M480/analogout_api.c index 80892361aa..6ea75d5986 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/analogout_api.c +++ b/targets/TARGET_NUVOTON/TARGET_M480/analogout_api.c @@ -115,7 +115,7 @@ void analogout_free(dac_t *obj) /* Channel-level windup from here */ /* Mark channel free */ - dac_modinit_mask[modidx] &= ~(1 << modidx); + dac_modinit_mask[modidx] &= ~(1 << chn); /* Close channel */ DAC_Close(dac_base, chn); diff --git a/targets/TARGET_NUVOTON/TARGET_NANO100/analogout_api.c b/targets/TARGET_NUVOTON/TARGET_NANO100/analogout_api.c index f8418d2656..e18d1639b0 100644 --- a/targets/TARGET_NUVOTON/TARGET_NANO100/analogout_api.c +++ b/targets/TARGET_NUVOTON/TARGET_NANO100/analogout_api.c @@ -110,7 +110,7 @@ void analogout_free(dac_t *obj) /* Channel-level windup from here */ /* Mark channel free */ - dac_modinit_mask[modidx] &= ~(1 << modidx); + dac_modinit_mask[modidx] &= ~(1 << chn); /* Close channel */ DAC_Close(dac_base, chn);