MCPcopy Create free account
hub / github.com/OpenEarable/open-earable / begin

Method begin

src/utils/SDManager.cpp:12–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10}
11
12bool SDManager::begin() {
13 if (_available) return true;
14 pinMode(EPIN_SD_STATE, INPUT_PULLUP);
15
16 _read_sd_state();
17
18 // prevent multiattachment of the interrupt
19 detachInterrupt(digitalPinToInterrupt(EPIN_SD_STATE));
20 attachInterrupt(digitalPinToInterrupt(EPIN_SD_STATE), _read_sd_state, CHANGE);
21
22 if (!sd_inserted) {
23 Serial.println("No SD card inserted.");
24 return false;
25 }
26
27 _available = sd->begin(SPI_CC, SPI_SPEED);
28 return _available;
29}
30
31void SDManager::end() {
32 if (!_available) return;

Callers 2

startMethod · 0.45
startMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected