aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Ruben Bakke2017-11-25 01:09:18 +0100
committerDamien George2018-07-18 17:12:25 +1000
commit67b57bebeceda9aad845ceafcea0d081657854fb (patch)
tree92f9b579de1ce4d32b2d3c34d78cc3d4142ab185
parentf8ae6b7bfcc069a5c4272c4be2290dfd76136d67 (diff)
nrf: Update main.c to init relevant board drivers, if enabled.
If the board has these drivers then they will be initialized: - softpwm (implicit ticker) - music module - board specific module
-rw-r--r--ports/nrf/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ports/nrf/main.c b/ports/nrf/main.c
index 1090d8fb5..0d06f3253 100644
--- a/ports/nrf/main.c
+++ b/ports/nrf/main.c
@@ -61,6 +61,11 @@
#include "ble_uart.h"
#endif
+#if MICROPY_PY_MACHINE_SOFT_PWM
+#include "ticker.h"
+#include "softpwm.h"
+#endif
+
void do_str(const char *src, mp_parse_input_kind_t input_kind) {
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
if (lex == NULL) {
@@ -206,6 +211,23 @@ pin_init0();
}
#endif
+#if MICROPY_PY_MACHINE_SOFT_PWM
+ ticker_init0();
+ softpwm_init0();
+#endif
+
+#if MICROPY_PY_MUSIC
+ microbit_music_init0();
+#endif
+#if BOARD_SPECIFIC_MODULES
+ board_modules_init0();
+#endif
+
+#if MICROPY_PY_MACHINE_SOFT_PWM
+ ticker_start();
+ pwm_start();
+#endif
+
for (;;) {
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
if (pyexec_raw_repl() != 0) {