File tree Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -99,9 +99,11 @@ void pwmout_init(pwmout_t* obj, PinName pin)
99
99
100
100
((struct nu_pwm_var * ) modinit -> var )-> en_msk |= 1 << chn ;
101
101
102
- // Mark this module to be inited.
103
- int i = modinit - pwm_modinit_tab ;
104
- pwm_modinit_mask |= 1 << i ;
102
+ if (((struct nu_pwm_var * ) modinit -> var )-> en_msk ) {
103
+ // Mark this module to be inited.
104
+ int i = modinit - pwm_modinit_tab ;
105
+ pwm_modinit_mask |= 1 << i ;
106
+ }
105
107
}
106
108
107
109
void pwmout_free (pwmout_t * obj )
@@ -120,9 +122,11 @@ void pwmout_free(pwmout_t* obj)
120
122
CLK_DisableModuleClock (modinit -> clkidx );
121
123
}
122
124
123
- // Mark this module to be deinited.
124
- int i = modinit - pwm_modinit_tab ;
125
- pwm_modinit_mask &= ~(1 << i );
125
+ if (((struct nu_pwm_var * ) modinit -> var )-> en_msk == 0 ) {
126
+ // Mark this module to be deinited.
127
+ int i = modinit - pwm_modinit_tab ;
128
+ pwm_modinit_mask &= ~(1 << i );
129
+ }
126
130
}
127
131
128
132
void pwmout_write (pwmout_t * obj , float value )
Original file line number Diff line number Diff line change @@ -105,9 +105,11 @@ void pwmout_init(pwmout_t* obj, PinName pin)
105
105
106
106
((struct nu_pwm_var * ) modinit -> var )-> en_msk |= 1 << chn ;
107
107
108
- // Mark this module to be inited.
109
- int i = modinit - pwm_modinit_tab ;
110
- pwm_modinit_mask |= 1 << i ;
108
+ if (((struct nu_pwm_var * ) modinit -> var )-> en_msk ) {
109
+ // Mark this module to be inited.
110
+ int i = modinit - pwm_modinit_tab ;
111
+ pwm_modinit_mask |= 1 << i ;
112
+ }
111
113
}
112
114
113
115
void pwmout_free (pwmout_t * obj )
@@ -143,9 +145,11 @@ void pwmout_free(pwmout_t* obj)
143
145
}
144
146
}
145
147
146
- // Mark this module to be deinited.
147
- int i = modinit - pwm_modinit_tab ;
148
- pwm_modinit_mask &= ~(1 << i );
148
+ if (((struct nu_pwm_var * ) modinit -> var )-> en_msk == 0 ) {
149
+ // Mark this module to be deinited.
150
+ int i = modinit - pwm_modinit_tab ;
151
+ pwm_modinit_mask &= ~(1 << i );
152
+ }
149
153
}
150
154
151
155
void pwmout_write (pwmout_t * obj , float value )
You can’t perform that action at this time.
0 commit comments