forked from leaflabs/libmaple
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
47 lines (41 loc) · 1.21 KB
/
main.cpp
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
/**
* SDMC test will try to initialize a memory card and read it's registers.
*
* Instructions: Plug any working micro SD card into the slot on the
* Maple Native board. Listen on SerialUSB, and press the
* on-board button to begin the test.
*
* This file is released into the public domain.
*
* Author: Brian E Tovar <betovar@leaflabs.com>
*/
#define SDMC_SD_BUS_PROTOCOL // not currently being used yet
#include "wirish.h"
#include "libraries/Card/SecureDigital/SDMC.h"
SecureDigitalMemoryCard SDMC;
void setup() {
pinMode(BOARD_LED_PIN, OUTPUT);
digitalWrite(BOARD_LED_PIN, HIGH);
}
void loop() {
waitForButtonPress();
SerialUSB.println("SDIO_DBG: Starting SDMC test");
SDMC.begin();
SerialUSB.println("SDIO_DBG: Initializing card");
SDMC.init();
SerialUSB.println("SDIO_DBG: Initialization complete");
SDMC.end();
SerialUSB.println("SDIO_DBG: Test complete");
}
// Force init to be called *first*, i.e. before static object allocation.
// Otherwise, statically allocated objects that need libmaple may fail.
__attribute__((constructor)) void premain() {
init();
}
int main(void) {
setup();
while (true) {
loop();
}
return 0;
}