@@ -20,15 +20,13 @@ LOG_MODULE_REGISTER(pwm_nrfx, CONFIG_PWM_LOG_LEVEL);
20
20
* to 0 or 1, hence the use of #if IS_ENABLED().
21
21
*/
22
22
#if IS_ENABLED (NRFX_PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED )
23
- #define ANOMALY_109_IRQ_CONNECT (...) IRQ_CONNECT(__VA_ARGS__)
24
23
#define ANOMALY_109_EGU_IRQ_CONNECT (idx ) _EGU_IRQ_CONNECT(idx)
25
24
#define _EGU_IRQ_CONNECT (idx ) \
26
25
extern void nrfx_egu_##idx##_irq_handler(void); \
27
26
IRQ_CONNECT(DT_IRQN(DT_NODELABEL(egu##idx)), \
28
27
DT_IRQ(DT_NODELABEL(egu##idx), priority), \
29
28
nrfx_isr, nrfx_egu_##idx##_irq_handler, 0)
30
29
#else
31
- #define ANOMALY_109_IRQ_CONNECT (...)
32
30
#define ANOMALY_109_EGU_IRQ_CONNECT (idx )
33
31
#endif
34
32
@@ -63,6 +61,12 @@ static uint16_t *seq_values_ptr_get(const struct device *dev)
63
61
return (uint16_t * )config -> seq .values .p_raw ;
64
62
}
65
63
64
+ static void pwm_handler (nrfx_pwm_evt_type_t event_type , void * p_context )
65
+ {
66
+ ARG_UNUSED (event_type );
67
+ ARG_UNUSED (p_context );
68
+ }
69
+
66
70
static bool pwm_period_check_and_set (const struct device * dev ,
67
71
uint32_t channel , uint32_t period_cycles )
68
72
{
@@ -229,7 +233,8 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel,
229
233
* until another playback is requested (new values will be
230
234
* loaded then) or the PWM peripheral is stopped.
231
235
*/
232
- nrfx_pwm_simple_playback (& config -> pwm , & config -> seq , 1 , 0 );
236
+ nrfx_pwm_simple_playback (& config -> pwm , & config -> seq , 1 ,
237
+ NRFX_PWM_FLAG_NO_EVT_FINISHED );
233
238
}
234
239
235
240
return 0 ;
@@ -256,6 +261,7 @@ static int pwm_nrfx_init(const struct device *dev)
256
261
{
257
262
const struct pwm_nrfx_config * config = dev -> config ;
258
263
uint8_t initially_inverted = 0 ;
264
+ nrfx_err_t result ;
259
265
260
266
int ret = pinctrl_apply_state (config -> pcfg , PINCTRL_STATE_DEFAULT );
261
267
@@ -284,10 +290,7 @@ static int pwm_nrfx_init(const struct device *dev)
284
290
seq_values_ptr_get (dev )[i ] = PWM_NRFX_CH_VALUE (0 , inverted );
285
291
}
286
292
287
- nrfx_err_t result = nrfx_pwm_init (& config -> pwm ,
288
- & config -> initial_config ,
289
- NULL ,
290
- NULL );
293
+ result = nrfx_pwm_init (& config -> pwm , & config -> initial_config , pwm_handler , dev -> data );
291
294
if (result != NRFX_SUCCESS ) {
292
295
LOG_ERR ("Failed to initialize device: %s" , dev -> name );
293
296
return - EBUSY ;
@@ -377,9 +380,8 @@ static int pwm_nrfx_pm_action(const struct device *dev,
377
380
}; \
378
381
static int pwm_nrfx_init##idx(const struct device *dev) \
379
382
{ \
380
- ANOMALY_109_IRQ_CONNECT( \
381
- DT_IRQN(PWM(idx)), DT_IRQ(PWM(idx), priority), \
382
- nrfx_isr, nrfx_pwm_##idx##_irq_handler, 0); \
383
+ IRQ_CONNECT(DT_IRQN(PWM(idx)), DT_IRQ(PWM(idx), priority), \
384
+ nrfx_isr, nrfx_pwm_##idx##_irq_handler, 0); \
383
385
return pwm_nrfx_init(dev); \
384
386
}; \
385
387
PM_DEVICE_DT_DEFINE(PWM(idx), pwm_nrfx_pm_action); \
0 commit comments