summaryrefslogtreecommitdiff
path: root/ports/cxd56
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-08-21 11:13:53 -0700
committerScott Shawcroft <scott@tannewt.org>2020-08-21 11:13:53 -0700
commita5b01f73612f23407d059879664834b40441f34e (patch)
treefbb1bde1cb5967de27a7bcecb755b1b19f5f36fd /ports/cxd56
parent6857f984269149b46d1cd4283506420f341b2601 (diff)
parent988e5caafc0866de6593d99632622a8fe62a9a9c (diff)
Merge remote-tracking branch 'adafruit/main' into add_pwmio
Diffstat (limited to 'ports/cxd56')
-rw-r--r--ports/cxd56/common-hal/pulseio/PulseOut.c12
-rw-r--r--ports/cxd56/supervisor/port.c9
2 files changed, 19 insertions, 2 deletions
diff --git a/ports/cxd56/common-hal/pulseio/PulseOut.c b/ports/cxd56/common-hal/pulseio/PulseOut.c
index a0c77b0a3..764a5860a 100644
--- a/ports/cxd56/common-hal/pulseio/PulseOut.c
+++ b/ports/cxd56/common-hal/pulseio/PulseOut.c
@@ -58,8 +58,16 @@ static bool pulseout_timer_handler(unsigned int *next_interval_us, void *arg)
return true;
}
-void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t *self,
- const pwmio_pwmout_obj_t *carrier) {
+void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
+ const pwmio_pwmout_obj_t* carrier,
+ const mcu_pin_obj_t* pin,
+ uint32_t frequency,
+ uint16_t duty_cycle) {
+ if (!carrier || pin || frequency) {
+ mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
+ Construct and pass a PWMOut Carrier instead"));
+ }
+
if (pulse_fd < 0) {
pulse_fd = open("/dev/timer0", O_RDONLY);
}
diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c
index 94eda66dc..7038ca478 100644
--- a/ports/cxd56/supervisor/port.c
+++ b/ports/cxd56/supervisor/port.c
@@ -36,6 +36,8 @@
#include "boards/board.h"
#include "supervisor/port.h"
+#include "supervisor/background_callback.h"
+#include "supervisor/usb.h"
#include "supervisor/shared/tick.h"
#include "common-hal/microcontroller/Pin.h"
@@ -116,6 +118,11 @@ uint32_t port_get_saved_word(void) {
return _ebss;
}
+static background_callback_t callback;
+static void usb_background_do(void* unused) {
+ usb_background();
+}
+
volatile bool _tick_enabled;
void board_timerhook(void)
{
@@ -123,6 +130,8 @@ void board_timerhook(void)
if (_tick_enabled) {
supervisor_tick();
}
+
+ background_callback_add(&callback, usb_background_do, NULL);
}
uint64_t port_get_raw_ticks(uint8_t* subticks) {