Skip to content

Commit e200ee8

Browse files
committed
Remove deeper debug level 3
1 parent 29843da commit e200ee8

File tree

4 files changed

+1
-36
lines changed

4 files changed

+1
-36
lines changed

cores/nRF5/HardwarePWM.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,12 @@ bool HardwarePWM::takeOwnership(uintptr_t token)
110110
}
111111
}
112112
if (this->_owner_token != 0) {
113-
if (notInIsr) {
114-
LOG_LV3("HwPWM", "failing to acquire ownership because already owned by other token");
115-
}
116113
return false;
117114
}
118115
if (this->usedChannelCount() != 0) {
119-
if (notInIsr) {
120-
LOG_LV3("HwPWM", "failing to acquire ownership because at least one channel connected");
121-
}
122116
return false;
123117
}
124118
if (this->enabled()) {
125-
if (notInIsr) {
126-
LOG_LV3("HwPWM", "failing to acquire ownership because peripheral is already enabled");
127-
}
128119
return false;
129120
}
130121
// TODO: warn, but do not fail, if taking ownership with IRQs already enabled

cores/nRF5/Tone.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -277,26 +277,21 @@ bool TONE_PWM_CONFIG::InitializeFromPulseCountAndTimePeriod(uint64_t pulse_count
277277
this->duty_with_polarity = 0x8000U | (time_period / 2U);
278278

279279
if (this->pulse_count == 0) {
280-
LOG_LV3("TON", "Infinite duration requested\n");
281-
282280
this->seq0_refresh = 0xFFFFFFU; // 24-bit maximum value
283281
this->seq1_refresh = 0xFFFFFFU; // 24-bit maximum value
284282
this->loop_count = 0xFFFFU; // 16-bit maximum value
285283
this->task_to_start = NRF_PWM_TASK_SEQSTART0;
286284
this->shorts = NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK;
287285
}
288286
else if (this->pulse_count == 1) {
289-
LOG_LV3("TON", "Edge case: exactly one pulse\n");
290-
// yes, this is an edge case
287+
// yes, this is an edge case; e.g., frequency == 100, duration == 100 causes this
291288
this->seq0_refresh = 0;
292289
this->seq1_refresh = 0;
293290
this->loop_count = 1;
294291
this->task_to_start = NRF_PWM_TASK_SEQSTART1;
295292
this->shorts = NRF_PWM_SHORT_LOOPSDONE_STOP_MASK;
296293
}
297294
else {
298-
LOG_LV3("TON", "Non-infinite duration of at least two pulses requested\n");
299-
300295
// This is the interesting section.
301296
//
302297
// To ensure refresh value stays within 24 bits, the maximum number of bits
@@ -318,37 +313,27 @@ bool TONE_PWM_CONFIG::InitializeFromPulseCountAndTimePeriod(uint64_t pulse_count
318313

319314
// NOTE: Due to final SEQ1 outputting exactly one pulse, may need one additional bit for loop count
320315
// ... but that will still be within the 16 bits available, because top of range is 13 bits.
321-
LOG_LV3("TON", "Using %d bits for refresh, and %d bits for loop_count\n", bits_for_refresh, bits_for_loop_count);
322316

323317
// now determine how many PWM pulses should occur per loop (when both SEQ0 and SEQ1 are played)
324318
uint32_t total_refresh_count = 1 << bits_for_refresh; // range is [2 .. 2^24]
325319
uint32_t full_loops = (this->pulse_count - 1) / total_refresh_count; // == loopCount - 1
326320

327-
LOG_LV3("TON", "total_refresh_count is 0x%" PRIx32 " (%" PRIu32 ")\n", total_refresh_count, total_refresh_count);
328-
LOG_LV3("TON", "full_loops is 0x%" PRIx32 " (%" PRIu32 ")\n", full_loops, full_loops);
329-
330321
// if (pulses - 1) % total_refresh_count == 0, then start at SEQ1 and split refresh evenly
331322
// else, start at SEQ0, and set SEQ0 to extra pulses needed...
332323
uint32_t extraPulsesNeededIfStartingAtSequence1 = (this->pulse_count - 1) % total_refresh_count;
333324
uint32_t seq0_count;
334325

335326
if (extraPulsesNeededIfStartingAtSequence1 == 0) {
336-
LOG_LV3("TON", "Pulse count (minus one) is exact multiple of total_refresh_count -- starting at SEQ1\n");
337327
seq0_count = total_refresh_count / 2; // range is [1 .. 2^23]
338328
this->task_to_start = NRF_PWM_TASK_SEQSTART1;
339329
}
340330
else {
341-
LOG_LV3("TON", "Pulse count (minus one) requires extra %" PRIu32 " pulses ... setting SEQ0 to that value\n", extraPulsesNeededIfStartingAtSequence1);
342331
seq0_count = extraPulsesNeededIfStartingAtSequence1;
343332
this->task_to_start = NRF_PWM_TASK_SEQSTART0;
344333
}
345334
this->loop_count = full_loops + 1;
346335
this->seq0_refresh = seq0_count - 1;
347336
this->seq1_refresh = (total_refresh_count - seq0_count) - 1;
348-
349-
LOG_LV3("TON", "seq0_count is %" PRIu32 ", so refresh will be set to %" PRIu32 "\n", seq0_count, this->seq0_refresh);
350-
LOG_LV3("TON", "seq1_count is %" PRIu32 ", so refresh will be set to %" PRIu32 "\n", (total_refresh_count - seq0_count), this->seq1_refresh);
351-
352337
this->shorts = NRF_PWM_SHORT_LOOPSDONE_STOP_MASK;
353338
}
354339
this->is_initialized = true;

cores/nRF5/common_func.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,6 @@ const char* dbg_err_str(int32_t err_id); // TODO move to other place
172172
#define LOG_LV2_BUFFER(...)
173173
#endif
174174

175-
#if CFG_DEBUG >= 3
176-
#define LOG_LV3(...) ADALOG(__VA_ARGS__)
177-
#define LOG_LV3_BUFFER(...) ADALOG_BUFFER(__VA_ARGS__)
178-
#else
179-
#define LOG_LV3(...)
180-
#define LOG_LV3_BUFFER(...)
181-
#endif
182-
183175
#if CFG_DEBUG
184176

185177
#define PRINT_LOCATION() PRINTF("%s: %d:\n", __PRETTY_FUNCTION__, __LINE__)

cores/nRF5/wiring_analog.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,9 @@ void analogWrite( uint32_t pin, uint32_t value )
9696
for(int i=0; i<HWPWM_MODULE_NUM; i++)
9797
{
9898
if (!HwPWMx[i]->isOwner(_analogToken)) {
99-
LOG_LV3("ANA", "not currently owner of PWM %d", i);
10099
continue;
101100
}
102101
if (!HwPWMx[i]->addPin(pin)) {
103-
LOG_LV3("ANA", "could not add pin %" PRIu32 " to PWM %d", pin, i);
104102
continue;
105103
}
106104

@@ -116,7 +114,6 @@ void analogWrite( uint32_t pin, uint32_t value )
116114
for(int i=0; i<HWPWM_MODULE_NUM; i++)
117115
{
118116
if (!HwPWMx[i]->takeOwnership(_analogToken)) {
119-
LOG_LV3("ANA", "Could not take ownership of PWM %d", i);
120117
continue;
121118
}
122119

0 commit comments

Comments
 (0)