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:
parent
a0ad7ce0b4
commit
d412241143
|
@ -35,7 +35,8 @@
|
||||||
#include "py/objstr.h"
|
#include "py/objstr.h"
|
||||||
#include "modmusic.h"
|
#include "modmusic.h"
|
||||||
#include "musictunes.h"
|
#include "musictunes.h"
|
||||||
#include "drivers/pwm.h"
|
#include "softpwm.h"
|
||||||
|
#include "ticker.h"
|
||||||
#include "pin.h"
|
#include "pin.h"
|
||||||
#include "genhdr/pins.h"
|
#include "genhdr/pins.h"
|
||||||
|
|
||||||
|
@ -71,11 +72,17 @@ enum {
|
||||||
|
|
||||||
#define music_data MP_STATE_PORT(music_data)
|
#define music_data MP_STATE_PORT(music_data)
|
||||||
|
|
||||||
// extern uint32_t ticks;
|
extern uint32_t ticks;
|
||||||
static uint32_t ticks = 0; // TODO
|
|
||||||
|
|
||||||
STATIC uint32_t start_note(const char *note_str, size_t note_len, const pin_obj_t *pin);
|
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) {
|
void microbit_music_tick(void) {
|
||||||
if (music_data == NULL) {
|
if (music_data == NULL) {
|
||||||
// music module not yet imported
|
// music module not yet imported
|
||||||
|
|
Loading…
Reference in New Issue