-
-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy pathAlexaDemo.ino
79 lines (69 loc) · 1.63 KB
/
AlexaDemo.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "NDP.h"
//const bool lowestPower = true;
const bool lowestPower = false;
void ledBlueOn(char* label) {
nicla::leds.begin();
nicla::leds.setColor(blue);
delay(200);
nicla::leds.setColor(off);
if (!lowestPower) {
Serial.println(label);
}
nicla::leds.end();
}
void ledGreenOn() {
nicla::leds.begin();
nicla::leds.setColor(green);
delay(200);
nicla::leds.setColor(off);
nicla::leds.end();
}
void ledRedBlink() {
while (1) {
nicla::leds.begin();
nicla::leds.setColor(red);
delay(200);
nicla::leds.setColor(off);
delay(200);
nicla::leds.end();
}
}
void setup() {
Serial.begin(115200);
nicla::begin();
nicla::disableLDO();
nicla::leds.begin();
NDP.onError(ledRedBlink);
NDP.onMatch(ledBlueOn);
NDP.onEvent(ledGreenOn);
Serial.println("Loading synpackages");
NDP.begin("mcu_fw_120_v91.synpkg");
NDP.load("dsp_firmware_v91.synpkg");
NDP.load("alexa_334_NDP120_B0_v11_v91.synpkg");
Serial.println("packages loaded");
NDP.getInfo();
Serial.println("Configure mic");
NDP.turnOnMicrophone();
NDP.interrupts();
// For maximum low power; please note that it's impossible to print after calling these functions
nicla::leds.end();
if (lowestPower) {
NRF_UART0->ENABLE = 0;
}
//NDP.turnOffMicrophone();
}
void loop() {
uint8_t command = 0xFF;
while (Serial.available()) {
command = Serial.read();
if (command == 'f') {
Serial.println("Interrupts disabled");
NDP.noInterrupts();
} else if (command == 'o') {
Serial.println("Interrupts enabled");
NDP.interrupts();
}
}
//Serial.println("in the loop");
delay(100);
}