MCPcopy Create free account
hub / github.com/SmingHub/Sming / execute

Method execute

tests/HostTests/modules/SpiFlash.cpp:71–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69 }
70
71 void execute() override
72 {
73 TEST_CASE("Query flash info")
74 {
75 auto flash_id = spi_flash_get_id();
76 REQUIRE_NEQ(flash_id, 0);
77 debug_i("flash_id = 0x%08x", flash_id);
78
79 auto flash_size = flashmem_get_size_bytes();
80 REQUIRE_NEQ(flash_size, 0);
81 debug_i("flash_size = 0x%08x bytes, %u MBytes", flash_size, flash_size / 0x100000);
82
83 auto info = flashmem_get_info();
84 auto modeStr = modeToString(SPIFlashMode(info.mode));
85 auto speedStr = speedToString(SPIFlashSpeed(info.speed));
86 auto sizeStr = sizeToString(SPIFlashSize(info.size));
87 PSTR_ARRAY(unk, "Unknown");
88 Serial.print(F("Mode: "));
89 Serial.println(modeStr ?: unk);
90 Serial.print(F("Speed: "));
91 Serial.println(speedStr ?: unk);
92 Serial.print(F("Size: "));
93 Serial.println(sizeStr ?: unk);
94 REQUIRE(modeStr != nullptr && speedStr != nullptr && sizeStr != nullptr);
95 }
96 }
97};
98
99void REGISTER_TEST(SpiFlash)

Callers

nothing calls this directly

Calls 9

modeToStringFunction · 0.85
speedToStringFunction · 0.85
sizeToStringFunction · 0.85
printlnMethod · 0.80
spi_flash_get_idFunction · 0.50
flashmem_get_size_bytesFunction · 0.50
flashmem_get_infoFunction · 0.50
FFunction · 0.50
printMethod · 0.45

Tested by

no test coverage detected