nrf5/modules/music: Update modmusic to use updated includes. Add extern ticks. Add function which implements initialization of pwm and ticker, register ticker callback, and start the pwm and ticker. This corresponds to microbit port main.cpp init.

This commit is contained in:
Glenn Ruben Bakke 2017-05-17 00:57:10 +02:00 committed by glennrub
parent a0ad7ce0b4
commit d412241143
1 changed files with 10 additions and 3 deletions

View File

@ -35,7 +35,8 @@
#include "py/objstr.h"
#include "modmusic.h"
#include "musictunes.h"
#include "drivers/pwm.h"
#include "softpwm.h"
#include "ticker.h"
#include "pin.h"
#include "genhdr/pins.h"
@ -71,11 +72,17 @@ enum {
#define music_data MP_STATE_PORT(music_data)
// extern uint32_t ticks;
static uint32_t ticks = 0; // TODO
extern uint32_t ticks;
STATIC uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_t *pin);
void microbit_music_init0(void) {
pwm_init();
ticker_init(microbit_music_tick);
ticker_start();
pwm_start();
}
void microbit_music_tick(void) {
if (music_data == NULL) {
// music module not yet imported