Skip to content

Commit 5525941

Browse files
FelixWang47831kartben
authored andcommitted
drivers: Counter: Fix LPIT disable interrupt bug
The parameter for LPIT_DisableInterrupts should be lpit_interrupt_enable_t, not channel id. Besides, improve the code to use BIT macro for shift operation. Signed-off-by: Felix Wang <[email protected]>
1 parent 3eb5471 commit 5525941

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/counter/counter_mcux_lpit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int mcux_lpit_start(const struct device *dev)
6565
uint8_t channel_id = LPIT_CHANNEL_ID(dev);
6666

6767
LOG_DBG("period is %d", mcux_lpit_get_top_value(dev));
68-
LPIT_EnableInterrupts(config->base, (1U << channel_id));
68+
LPIT_EnableInterrupts(config->base, BIT(channel_id));
6969
LPIT_StartTimer(config->base, channel_id);
7070
return 0;
7171
}
@@ -75,7 +75,7 @@ static int mcux_lpit_stop(const struct device *dev)
7575
const struct mcux_lpit_config *config = dev->config;
7676
uint8_t channel_id = LPIT_CHANNEL_ID(dev);
7777

78-
LPIT_DisableInterrupts(config->base, channel_id);
78+
LPIT_DisableInterrupts(config->base, BIT(channel_id));
7979
LPIT_StopTimer(config->base, channel_id);
8080
return 0;
8181
}
@@ -150,12 +150,12 @@ static void mcux_lpit_isr(const struct device *dev)
150150

151151
for (int channel_index = 0; channel_index < config->num_channels; channel_index++) {
152152

153-
if ((flags & (1U << channel_index)) == 0) {
153+
if ((flags & BIT(channel_index)) == 0) {
154154
continue;
155155
}
156156

157157
/* Clear interrupt flag */
158-
LPIT_ClearStatusFlags(config->base, (1U << channel_index));
158+
LPIT_ClearStatusFlags(config->base, BIT(channel_index));
159159

160160
struct mcux_lpit_channel_data *data =
161161
LPIT_CHANNEL_DATA(config->channels[channel_index]);

0 commit comments

Comments
 (0)