123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #include "sdcard.h"
- extern SdFs SD;
- extern FsFile LOG_FILE;
- extern uint16_t imageSelect;
- // read SD information and print to logfile
- void readSDCardInfo()
- {
- cid_t sd_cid;
- if(SD.card()->readCID(&sd_cid))
- {
- LOG("Sd MID:");
- LOG(sd_cid.mid); //,16
- LOG(" OID:");
- LOG(sd_cid.oid[0]);
- LOGN(sd_cid.oid[1]);
- LOG("Sd Name:");
- LOG(sd_cid.pnm[0]);
- LOG(sd_cid.pnm[1]);
- LOG(sd_cid.pnm[2]);
- LOG(sd_cid.pnm[3]);
- LOGN(sd_cid.pnm[4]);
- LOG("Sd Date:");
- LOG(sd_cid.mdtYear());
- LOG("-");
- LOGN(sd_cid.mdtMonth());
- LOG("Sd Serial:");
- LOGN(sd_cid.psn());
- }
- }
- void readSDCardInfo2()
- {
- cid_t sd_cid;
- if(SD.card()->readCID(&sd_cid))
- {
- LOG_FILE.print("Sd MID:");
- LOG_FILE.print(sd_cid.mid, 16);
- LOG_FILE.print(" OID:");
- LOG_FILE.print(sd_cid.oid[0]);
- LOG_FILE.println(sd_cid.oid[1]);
- LOG_FILE.print("Sd Name:");
- LOG_FILE.print(sd_cid.pnm[0]);
- LOG_FILE.print(sd_cid.pnm[1]);
- LOG_FILE.print(sd_cid.pnm[2]);
- LOG_FILE.print(sd_cid.pnm[3]);
- LOG_FILE.println(sd_cid.pnm[4]);
- LOG_FILE.print("Sd Date:");
- LOG_FILE.print(sd_cid.mdtMonth());
- LOG_FILE.println(sd_cid.mdtYear());
- LOG_FILE.print("Sd Serial:");
- LOG_FILE.println(sd_cid.psn());
- LOG_FILE.sync();
- }
- }
- void sdCardInsert(void){
- if (digitalRead(BOARD_SDCARD_INSERT)){
- LED2_OFF();
- }else{
- LED2_ON();
- }
- }
- void switchImage(void){
- uint8_t oldimageSelect = imageSelect;
- imageSelect = (~(digitalRead(BOARD_SWITCH1_PIN) |
- digitalRead(BOARD_SWITCH2_PIN) << 1 |
- digitalRead(BOARD_SWITCH3_PIN) << 2 |
- digitalRead(BOARD_SWITCH4_PIN) << 3)) & 0x0F;
- if ( oldimageSelect!=imageSelect){
- LOG("Image: ");
- LOGN(imageSelect);
- }
- }
|