Skip to content

Commit 7f016ae

Browse files
committed
Fix build with filter to do OR
1 parent 67c6932 commit 7f016ae

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

ports/atmel-samd/Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,9 @@ SRC_C += \
322322
reset.c \
323323
timer_handler.c \
324324

325-
ifeq ($(CIRCUITPY_PWMIO),1)
326-
SRC_C += shared_timers.c
327-
endif
328-
329-
ifeq ($(CIRCUITPY_AUDIOIO),1)
325+
# This is an OR because it filters to any 1s and then checks to see if it is not
326+
# empty.
327+
ifneq (,$(filter 1,$(CIRCUITPY_PWMIO) $(CIRCUITPY_AUDIOIO) $(CIRCUITPY_RGBMATRIX)))
330328
SRC_C += shared_timers.c
331329
endif
332330

ports/atmel-samd/common-hal/pwmio/PWMOut.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
#include "common-hal/pwmio/PWMOut.h"
3232
#include "shared-bindings/pwmio/PWMOut.h"
3333
#include "shared-bindings/microcontroller/Processor.h"
34+
#include "shared_timers.h"
3435
#include "timer_handler.h"
3536

3637
#include "atmel_start_pins.h"
3738
#include "hal/utils/include/utils_repeat_macro.h"
39+
#include "samd/pins.h"
3840
#include "samd/timers.h"
3941
#include "supervisor/shared/translate.h"
4042

41-
#include "samd/pins.h"
42-
4343
#undef ENABLE
4444

4545
#define _TCC_SIZE(unused, n) TCC##n##_SIZE,
@@ -77,16 +77,11 @@ void pwmout_reset(void) {
7777
target_tcc_frequencies[i] = 0;
7878
tcc_refcount[i] = 0;
7979
}
80-
Tcc *tccs[TCC_INST_NUM] = TCC_INSTS;
8180
for (int i = 0; i < TCC_INST_NUM; i++) {
8281
if (!timer_ok_to_reset(i, false)) {
8382
continue;
8483
}
85-
uint8_t mask = 0xff;
86-
for (uint8_t j = 0; j < tcc_cc_num[i]; j++) {
87-
mask <<= 1;
88-
}
89-
tcc_channels[i] = mask;
84+
tcc_channels[i] = 0xff << tcc_cc_num[i];
9085
}
9186
}
9287

ports/atmel-samd/common-hal/rgbmatrix/RGBMatrix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "common-hal/rgbmatrix/RGBMatrix.h"
3030

3131
#include "samd/timers.h"
32+
#include "shared_timers.h"
3233
#include "timer_handler.h"
3334

3435
void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) {

0 commit comments

Comments
 (0)