Standalone helper function to load JPEG from SD card Combines SD card initialization and JPEG loading in one convenient function
| 106 | // Standalone helper function to load JPEG from SD card |
| 107 | // Combines SD card initialization and JPEG loading in one convenient function |
| 108 | inline FramePtr loadJpegFromSD(int cs_pin, const char *filepath, |
| 109 | const JpegConfig &config = JpegConfig(), |
| 110 | fl::string *error_message = nullptr) { |
| 111 | FileSystem fs; |
| 112 | if (!fs.beginSd(cs_pin)) { |
| 113 | if (error_message) { |
| 114 | *error_message = "Failed to initialize SD card on CS pin "; |
| 115 | error_message->append(static_cast<fl::u32>(cs_pin)); |
| 116 | } |
| 117 | return FramePtr(); |
| 118 | } |
| 119 | return fs.loadJpeg(filepath, config, error_message); |
| 120 | } |
| 121 | |
| 122 | } // namespace fl |
nothing calls this directly
no test coverage detected