Fix compilation bugs; USB MSC isn't working yet
This commit is contained in:
@@ -76,8 +76,9 @@
|
|||||||
#define PIN_BTN7 31
|
#define PIN_BTN7 31
|
||||||
#define PIN_BTN8 12
|
#define PIN_BTN8 12
|
||||||
|
|
||||||
// LED
|
// PIN_LED is 11 (LED_R)
|
||||||
#define PIN_LED 16
|
// LED_B is 13/12
|
||||||
|
// LED_G is 12/13
|
||||||
|
|
||||||
const uint8_t BTN_PINS[] = {
|
const uint8_t BTN_PINS[] = {
|
||||||
PIN_BTN1, PIN_BTN2, PIN_BTN3, PIN_BTN4,
|
PIN_BTN1, PIN_BTN2, PIN_BTN3, PIN_BTN4,
|
||||||
@@ -631,7 +632,7 @@ void audioInit() {
|
|||||||
// Create a FreeRTOS software timer at 8kHz
|
// Create a FreeRTOS software timer at 8kHz
|
||||||
// Note: For better timing, use a hardware TIMER peripheral
|
// Note: For better timing, use a hardware TIMER peripheral
|
||||||
// This works well enough for 8kHz audio
|
// This works well enough for 8kHz audio
|
||||||
audioTimer.begin(1000 / 8, audioTimerHandler, true); // ~8kHz
|
audioTimer.begin(1000 / 8, audioTimerHandler, NULL, true); // ~8kHz
|
||||||
// Better approach: use nrf_drv_timer for precise 125µs intervals
|
// Better approach: use nrf_drv_timer for precise 125µs intervals
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -780,8 +781,18 @@ void setup() {
|
|||||||
digitalWrite(PIN_LED, HIGH);
|
digitalWrite(PIN_LED, HIGH);
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
// Don't block on serial — may not be connected
|
Serial.println("...");
|
||||||
delay(500);
|
|
||||||
|
int c=0;
|
||||||
|
while(c<10) {
|
||||||
|
delay(250);
|
||||||
|
digitalWrite(PIN_LED, LOW);
|
||||||
|
// Serial.println("0");
|
||||||
|
delay(250);
|
||||||
|
digitalWrite(PIN_LED, HIGH);
|
||||||
|
// Serial.println("1");
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
Serial.println("=== Baby Mobile v2 ===");
|
Serial.println("=== Baby Mobile v2 ===");
|
||||||
Serial.println("nRF52840 + IS25LP128F + PAM8302A");
|
Serial.println("nRF52840 + IS25LP128F + PAM8302A");
|
||||||
@@ -824,9 +835,9 @@ void setup() {
|
|||||||
// USB Mass Storage
|
// USB Mass Storage
|
||||||
usb_msc.setID("BabyMobile", "Audio Drive", "2.0");
|
usb_msc.setID("BabyMobile", "Audio Drive", "2.0");
|
||||||
usb_msc.setReadWriteCallback(msc_read_cb, msc_write_cb, msc_flush_cb);
|
usb_msc.setReadWriteCallback(msc_read_cb, msc_write_cb, msc_flush_cb);
|
||||||
usb_msc.setStartStopCallback(msc_start_stop_cb);
|
//usb_msc.setStartStopCallback(msc_start_stop_cb); // unused in nrf?
|
||||||
usb_msc.setCapacity(MSC_BLOCK_COUNT, MSC_BLOCK_SIZE);
|
usb_msc.setCapacity(MSC_BLOCK_COUNT, MSC_BLOCK_SIZE);
|
||||||
usb_msc.setReadOnly(false);
|
//usb_msc.setReadOnly(false);
|
||||||
usb_msc.setUnitReady(true);
|
usb_msc.setUnitReady(true);
|
||||||
usb_msc.begin();
|
usb_msc.begin();
|
||||||
|
|
||||||
@@ -835,7 +846,7 @@ void setup() {
|
|||||||
|
|
||||||
g_lastActivity = millis();
|
g_lastActivity = millis();
|
||||||
|
|
||||||
digitalWrite(PIN_LED, LOW);
|
digitalWrite(PIN_LED, HIGH);
|
||||||
Serial.println("Ready! Plug in USB to upload audio, or press a button.");
|
Serial.println("Ready! Plug in USB to upload audio, or press a button.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user