hw/mcu/nrf52: Fix PWM instance id handling
We can now pass it as int casted to pointer.
@@ -206,37 +206,31 @@ static void
nrf52_periph_create_pwm(void)
{
int rc;
- int idx;
(void)rc;
- (void)idx;
#if MYNEWT_VAL(PWM_0)
- idx = 0;
rc = os_dev_create(&os_bsp_pwm0.pwm_os_dev, "pwm0",
OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
- nrf52_pwm_dev_init, &idx);
+ nrf52_pwm_dev_init, UINT_TO_POINTER(0));
assert(rc == 0);
#endif
#if MYNEWT_VAL(PWM_1)
- idx = 1;
rc = os_dev_create(&os_bsp_pwm1.pwm_os_dev, "pwm1",
OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
- nrf52_pwm_dev_init, &idx);
+ nrf52_pwm_dev_init, UINT_TO_POINTER(1));
assert(rc == 0);
#endif
#if MYNEWT_VAL(PWM_2)
- idx = 2;
rc = os_dev_create(&os_bsp_pwm2.pwm_os_dev, "pwm2",
OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
- nrf52_pwm_dev_init, &idx);
+ nrf52_pwm_dev_init, UINT_TO_POINTER(2));
assert(rc == 0);
#endif
#if MYNEWT_VAL(PWM_3)
- idx = 3;
rc = os_dev_create(&os_bsp_pwm3.pwm_os_dev, "pwm3",
OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
- nrf52_pwm_dev_init, &idx);
+ nrf52_pwm_dev_init, UINT_TO_POINTER(3));
assert(rc == 0);
#endif
}
