diff --git a/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c b/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c index 13f763c2d78..b53f610b23e 100644 --- a/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c +++ b/arch/arm/src/stm32/stm32_oneshot_lowerhalf.c @@ -59,7 +59,9 @@ struct stm32_oneshot_lowerhalf_s { /* This is the part of the lower half driver that is visible to the upper- - * half client of the driver. + * half client of the driver. This must be the first thing in this + * structure so that pointers to struct oneshot_lowerhalf_s are cast + * compatible to struct stm32_oneshot_lowerhalf_s and vice versa. */ struct oneshot_lowerhalf_s lh; /* Common lower-half driver fields */ @@ -314,6 +316,12 @@ FAR struct oneshot_lowerhalf_s *oneshot_initialize(int chan, return NULL; } + /* Initialize the lower-half driver structure */ + + priv->lh.ops = &g_oneshot_ops; + + /* Initialize the contained STM32 oneshot timer */ + ret = stm32_oneshot_initialize(&priv->oneshot, chan, resolution); if (ret < 0) {