Skip to content

Commit 188e817

Browse files
committed
remove dead code
1 parent c8a7c4b commit 188e817

File tree

1 file changed

+0
-70
lines changed

1 file changed

+0
-70
lines changed

cores/nRF5/Tone.cpp

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ void tone(uint8_t pin, unsigned int frequency, unsigned long duration)
7878
no_stop = true;
7979
}
8080

81-
// PWM configuration depends on the following:
82-
// [ ] time_per
83-
// [ ] duty ( via seq )
84-
// [ ] pin ( via pins[0] )
85-
8681
// Configure PWM
8782
static uint16_t seq_values[]={0};
8883
//In each value, the most significant bit (15) determines the polarity of the output
@@ -95,35 +90,12 @@ void tone(uint8_t pin, unsigned int frequency, unsigned long duration)
9590
0
9691
};
9792

98-
#if 0
99-
//assign pin to pwm channel - look at WVariant.h for details about ulPWMChannel attribute
100-
uint8_t pwm_type=g_APinDescription[pin].ulPWMChannel;
101-
if(pwm_type == NOT_ON_PWM)
102-
return;
103-
104-
uint32_t pins[NRF_PWM_CHANNEL_COUNT]={NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED};
105-
pins[pwm_type & 0x0F]=g_APinDescription[pin].ulPin;
106-
IRQn_Type IntNo = PWM0_IRQn;
107-
NRF_PWM_Type * PWMInstance = NRF_PWM0;
108-
switch(pwm_type &0xF0){
109-
case 16://0x10
110-
PWMInstance = NRF_PWM1;
111-
IntNo = PWM1_IRQn;
112-
break;
113-
case 32://0x20
114-
PWMInstance = NRF_PWM2;
115-
IntNo = PWM2_IRQn;
116-
break;
117-
}
118-
#else
119-
12093
// Use fixed PWM2, TODO could conflict with other usage
12194
uint32_t pins[NRF_PWM_CHANNEL_COUNT]={NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED};
12295
pins[0] = g_ADigitalPinMap[pin];
12396

12497
IRQn_Type IntNo = PWM2_IRQn;
12598
NRF_PWM_Type * PWMInstance = NRF_PWM2;
126-
#endif
12799

128100
nrf_pwm_pins_set(PWMInstance, pins);
129101
nrf_pwm_enable(PWMInstance);
@@ -150,21 +122,7 @@ void noTone(uint8_t pin)
150122
return;
151123
}
152124

153-
#if 0
154-
uint8_t pwm_type=g_APinDescription[pin].ulPWMChannel;
155-
NRF_PWM_Type * PWMInstance = NRF_PWM0;
156-
switch(pwm_type &0xF0){
157-
case 16://0x10
158-
PWMInstance = NRF_PWM1;
159-
break;
160-
case 32://0x20
161-
PWMInstance = NRF_PWM2;
162-
break;
163-
}
164-
#else
165125
NRF_PWM_Type * PWMInstance = NRF_PWM2;
166-
#endif
167-
168126
nrf_pwm_task_trigger(PWMInstance, NRF_PWM_TASK_STOP);
169127
nrf_pwm_disable(PWMInstance);
170128
}
@@ -173,34 +131,6 @@ void noTone(uint8_t pin)
173131
extern "C"{
174132
#endif
175133

176-
#if 0
177-
void PWM0_IRQHandler(void){
178-
nrf_pwm_event_clear(NRF_PWM0, NRF_PWM_EVENT_PWMPERIODEND);
179-
if(!no_stop){
180-
count_duration--;
181-
if(count_duration == 0)
182-
noTone(pin_sound);
183-
else
184-
nrf_pwm_task_trigger(NRF_PWM0, NRF_PWM_TASK_SEQSTART0);
185-
}
186-
else
187-
nrf_pwm_task_trigger(NRF_PWM0, NRF_PWM_TASK_SEQSTART0);
188-
}
189-
190-
void PWM1_IRQHandler(void){
191-
nrf_pwm_event_clear(NRF_PWM1, NRF_PWM_EVENT_PWMPERIODEND);
192-
if(!no_stop){
193-
count_duration--;
194-
if(count_duration == 0)
195-
noTone(pin_sound);
196-
else
197-
nrf_pwm_task_trigger(NRF_PWM1, NRF_PWM_TASK_SEQSTART0);
198-
}
199-
else
200-
nrf_pwm_task_trigger(NRF_PWM1, NRF_PWM_TASK_SEQSTART0);
201-
}
202-
#endif
203-
204134
void PWM2_IRQHandler(void){
205135
nrf_pwm_event_clear(NRF_PWM2, NRF_PWM_EVENT_PWMPERIODEND);
206136
if(!no_stop){

0 commit comments

Comments
 (0)