File tree Expand file tree Collapse file tree 1 file changed +7
-25
lines changed
hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/TARGET_MCU_NRF52832 Expand file tree Collapse file tree 1 file changed +7
-25
lines changed Original file line number Diff line number Diff line change 53
53
#define MAX_PWM_PERIOD_MS ((MAX_PWM_PERIOD_US / 1000) + 1) // approximations advance
54
54
#define MAX_PWM_PERIOD_S ((MAX_PWM_PERIOD_US / 1000000) + 1) // approximations advance
55
55
56
- #ifdef PWM0_ENABLED
57
- #define __PWM0_NUM 1
58
- #else
59
- #define __PWM0_NUM 0
60
- #endif
61
-
62
- #ifdef PWM1_ENABLED
63
- #define __PWM1_NUM 1
64
- #else
65
- #define __PWM1_NUM 0
66
- #endif
67
-
68
- #ifdef PWM2_ENABLED
69
- #define __PWM2_NUM 1
70
- #else
71
- #define __PWM2_NUM 0
72
- #endif
73
-
74
56
75
- #define PWM_INSTANCE_COUNT (__PWM0_NUM + __PWM1_NUM + __PWM2_NUM)
57
+ #define PWM_INSTANCE_COUNT (PWM_COUNT) // import from the PWM driver header
76
58
77
59
///> instances of nRF52 PWM driver
78
60
static const nrf_drv_pwm_t m_pwm_driver [PWM_INSTANCE_COUNT ] =
79
61
{
80
- #ifdef PWM0_ENABLED
62
+ #if PWM0_ENABLED
81
63
NRF_DRV_PWM_INSTANCE (0 ),
82
64
#endif
83
- #ifdef PWM1_ENABLED
65
+ #if PWM1_ENABLED
84
66
NRF_DRV_PWM_INSTANCE (1 ),
85
67
#endif
86
- #ifdef PWM2_ENABLED
68
+ #if PWM2_ENABLED
87
69
NRF_DRV_PWM_INSTANCE (2 )
88
70
#endif
89
71
};
@@ -104,13 +86,13 @@ typedef struct
104
86
105
87
static pwm_t m_pwm [PWM_INSTANCE_COUNT ] =
106
88
{
107
- #ifdef PWM0_ENABLED
89
+ #if PWM0_ENABLED
108
90
{.p_pwm_driver = NULL },
109
91
#endif
110
- #ifdef PWM0_ENABLED
92
+ #if PWM1_ENABLED
111
93
{.p_pwm_driver = NULL },
112
94
#endif
113
- #ifdef PWM0_ENABLED
95
+ #if PWM2_ENABLED
114
96
{.p_pwm_driver = NULL }
115
97
#endif
116
98
}; /// Array of internal PWM instances.
You can’t perform that action at this time.
0 commit comments