drivers: counter: counter_mcux_lptmr: Update to start with top value
Updated the driver to start with a value to compare the counter with otherwise the counter will not start until the user sets the top value manually, an issue that will occur inside the counter test. Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
This commit is contained in:
parent
1a29e67c91
commit
c8d6f39e11
1 changed files with 4 additions and 1 deletions
|
|
@ -142,6 +142,8 @@ static int mcux_lptmr_init(const struct device *dev)
|
||||||
|
|
||||||
LPTMR_Init(config->base, &lptmr_config);
|
LPTMR_Init(config->base, &lptmr_config);
|
||||||
|
|
||||||
|
LPTMR_SetTimerPeriod(config->base, config->info.max_top_value);
|
||||||
|
|
||||||
config->irq_config_func(dev);
|
config->irq_config_func(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -210,7 +212,8 @@ static void mcux_lptmr_irq_config_0(const struct device *dev);
|
||||||
|
|
||||||
static struct mcux_lptmr_config mcux_lptmr_config_0 = {
|
static struct mcux_lptmr_config mcux_lptmr_config_0 = {
|
||||||
.info = {
|
.info = {
|
||||||
.max_top_value = UINT16_MAX,
|
.max_top_value = ((DT_INST_PROP(0, resolution) == 32)
|
||||||
|
? UINT32_MAX : UINT16_MAX),
|
||||||
.freq = DT_INST_PROP(0, clock_frequency) /
|
.freq = DT_INST_PROP(0, clock_frequency) /
|
||||||
DT_INST_PROP(0, prescaler),
|
DT_INST_PROP(0, prescaler),
|
||||||
.flags = COUNTER_CONFIG_INFO_COUNT_UP,
|
.flags = COUNTER_CONFIG_INFO_COUNT_UP,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue