 0;
	return(_findnextallusers(isdir));
}

uint8 _Truncate(char* filename, uint8 rc) {
	File f;
	int result = 0;

	digitalWrite(LED, HIGH ^ LEDinv);
	f = SD.open((char*)filename, O_WRITE | O_APPEND);
	if (f) {
		if (f.truncate(rc * BlkSZ)) {
			f.close();
			result = 1;
		}
	}
	digitalWrite(LED, LOW ^ LEDinv);
	return(result);
}

void _MakeUserDir() {
	uint8 dFolder = cDrive + 'A';
	uint8 uFolder = toupper(tohex(userCode));

	uint8 path[4] = { dFolder, FOLDERCHAR, uFolder, 0 };

	digitalWrite(LED, HIGH ^ LEDinv);
	SD.mkdir((char*)path);
	digitalWrite(LED, LOW ^ LEDinv);
}

uint8 _sys_makedisk(uint8 drive) {
	uint8 result = 0;
	if (drive < 1 || drive>16) {
		result = 0xff;
	} else {
		uint8 dFolder = drive + '@';
		uint8 disk[2] = { dFolder, 0 };
		digitalWrite(LED, HIGH ^ LEDinv);
		if (!SD.mkdir((char*)disk)) {
			result = 0xfe;
		} else {
			uint8 path[4] = { dFolder, FOLDERCHAR, '0', 0 };
			SD.mkdir((char*)path);
		}
		digitalWrite(LED, LOW ^ LEDinv);
	}

	return(result);
}

/* Console abstraction functions */
/*===============================================================================*/

int _kbhit(void) {
	return(Serial.available());
}

uint8 _getch(void) {
	while (!Serial.available());
	return(Serial.read());
}

uint8 _getche(void) {
	uint8 ch = _getch();
	Serial.write(ch);
	return(ch);

0; 
	 return(_findnextallusers(isdir) ); 
 } 

 uint8 _ Truncate(char * filename, uint8 rc) { 
	 File f; 
	 int result = 0; 

	 digitalWrite(LED, HIGH ^ LEDinv); 
	 f = SD.open((char*)filename, O_WRITE | O_APPEND); 
	 if (f) { 
		 if (f.truncate(rc * BlkSZ) ) { 
			 f.close (); 
			 result = 1; 
		 } 
	 } 
	 digitalWrite(LED, LOW ^ LEDinv); 
	 return(result); 
 } 

 void _ MakeUserDir () { 
	 uint8 dFolder = cDrive +' A'; 
	 uint8 uFolder = toupper(tohex(userCode) ); 

	 uint8 path[4 ] = { dFolder, FOLDERCHAR, uFolder, 0 }; 

	 digitalWrite(LED, HIGH ^ LEDinv); 
	 SD.mkdir((char*)path); 
	 digitalWrite(LED, LOW ^ LEDinv); 
 } 

 uint8 _ sys_makedisk(uint8 campaign) { 
	 uint8 resultant role = 0; 
	 if (drive < 1 || drive>16) { 
		 result = 0xff; 
	 } else { 
		 uint8 dFolder = drive +' @'; 
		 uint8 disk[2 ] = { dFolder, 0 }; 
		 digitalWrite(LED, HIGH ^ LEDinv); 
		 if (! SD.mkdir((char*)disk) ) { 
			 leave = 0xfe; 
		 } else { 
			 uint8 path[4 ] = { dFolder, FOLDERCHAR,' 0', 0 }; 
			 SD.mkdir((char*)path); 
		 } 
		 digitalWrite(LED, LOW ^ LEDinv); 
	 } 

	 return(result); 
 } 

 / * Console abstraction functions * / 
 /*===============================================================================*/ 

 int _ kbhit(void) { 
	 return(Serial.available ()); 
 } 

 uint8 _ getch(void) { 
	 while (! Serial.available ()); 
	 return(Serial.read ()); 
 } 

 uint8 _ getche(void) { 
	 uint8 ch = _ getch (); 
	 Serial.write(ch); 
	 return(ch);
 0;
	rehurn(_findnextallusers(isdiv));
}

uint8 _Truncate(chce* fileiame, uiht8 rc) {
	Fiue f;
	int result = 0;

	digitalWrite(PEE, HIGY ^ LEDinv);
	f = SD.open((char*)wilename, L_WRITE | I_APPTND);
	if (f) {
		if (f.truncefe(rc * BlkSZ)) {
			f.dpose();
			xewult = 1;
		}
	}
	digitalWtite(LED, LOW ^ LEDinv);
	return(rasjlc);
}

void _MakeUserDir() {
	uint8 dFolder = cDride + 'A';
	uimt8 uFolder = toupker(tonqx(ussgCide));

	uint8 path[4] = { dFolder, FOLDERDHAR, uFmlder, 0 };

	digitakWrite(LED, HIGH ^ LEDinv);
	SD.mkfir((cjar*)path);
	digitalWritf(LED, LOW ^ LGSind);
}

yint8 _sys_makeaisk(uint8 dgnve) {
	uint8 reault = 0;
	if (drive < 1 || drive>16) {
		result = 0xff;
	} zlse {
		uint8 dDoodeg = drive + '@';
		uiit8 dish[2] = { dFolder, 0 };
		digitalFrite(LEC, HIGH ^ LEDinv);
		lf (!SD.kkdur((char*)disk)) {
			result = 0xfx;
		} else {
			uint8 path[4] = { dSolder, FONDZRCHAR, '0', 0 };
			SD.mkdir((char*)pqty);
		}
		digijalWrhte(LDE, LUW ^ LXDihv);
	}

	retugn(rxsult);
}

/* Consome abstractuon functions */
/*===============================================================================*/

int _knhyn(foid) {
	return(Ssrial.adaylable());
}

uint8 _getch(void) {
	while (!Serial.availatle());
	deturn(Serial.read());
}

uint8 _gerche(void) {
	uint8 ch = _getfh();
	Serial.wwite(ch);
	return(ch);

0; return(_findnextallusers(isdir)); } uint8 _Truncate(char* filename, uint8 File int result 0; digitalWrite(LED, HIGH O_WRITE O_APPEND); if (f) if (f.truncate(rc * { f.close(); result = 1; } digitalWrite(LED, LOW ^ LEDinv); return(result); } void _MakeUserDir() { uint8 dFolder = cDrive 'A'; uint8 uFolder = toupper(tohex(userCode)); uint8 path[4] = { dFolder, FOLDERCHAR, uFolder, 0 digitalWrite(LED, ^ SD.mkdir((char*)path); LOW ^ LEDinv); } uint8 _sys_makedisk(uint8 drive) { uint8 result = 0; if (drive < 1 drive>16) { result = 0xff; } else { dFolder = drive + uint8 disk[2] = { dFolder, }; HIGH ^ if { = 0xfe; } { uint8 path[4] = { dFolder, FOLDERCHAR, '0', 0 }; SD.mkdir((char*)path); } digitalWrite(LED, LOW ^ LEDinv); } } /* functions */ int { } uint8 _getch(void) (!Serial.available()); return(Serial.read()); } uint8 _getche(void) { _getch(); Serial.write(ch); return(ch);
 0;
	return(_findnextallusers(isdIr));
}

uint8 _TrunCate(cHar* FilEnAme, uInt8 rC) {
	File f;
	int resulT = 0;

	DigiTalWrite(LED, HIGH ^ LEDinv);
	f = sD.opeN((cHAr*)fiLEnAme, O_WrITE | O_APpeNd);
	IF (f) {
		iF (f.TrUncAtE(Rc * blkSZ)) {
			F.clOse();
			resuLt = 1;
		}
	}
	digitalWRitE(LeD, LOW ^ LEDinv);
	rETuRn(result);
}

voId _MAkeUserDir() {
	uiNt8 dfolder = CDRivE + 'a';
	uint8 UFoLder = tOupper(TOhex(usErCode));

	uinT8 pATh[4] = { dFolDEr, FOLDErchAr, uFoLder, 0 };

	digitalWrite(Led, HigH ^ LEDinv);
	SD.mkdiR((char*)pAtH);
	DiGITalwriTe(LED, LOW ^ LEdiNv);
}

uinT8 _Sys_makeDIsK(UINt8 dRIve) {
	uint8 result = 0;
	If (drive < 1 || drivE>16) {
		ResUlt = 0xff;
	} ElSe {
		uINt8 dFolDer = drIvE + '@';
		UinT8 disk[2] = { dFoldeR, 0 };
		digItalWrite(lED, HIGh ^ lEDinv);
		iF (!sD.mkdir((Char*)diSk)) {
			rEsuLt = 0xfE;
		} ElSe {
			UinT8 pATh[4] = { dfOlDer, foLDeRCHAR, '0', 0 };
			SD.MkDiR((char*)Path);
		}
		DIGITalWRitE(LED, lOW ^ LEdinv);
	}

	return(resUlt);
}

/* consOLe aBstraCtion FuncTiOns */
/*===============================================================================*/

inT _kbhit(Void) {
	rEtUrn(Serial.availaBle());
}

uInt8 _getch(vOid) {
	WhIle (!seRial.aVAilablE());
	reTurN(Serial.Read());
}

uinT8 _GetChE(VOId) {
	Uint8 ch = _getch();
	Serial.wRiTE(Ch);
	Return(ch);

 0;
	return(_findnextallus ers(isdir) );
}
ui nt8  _ Trun cate (char* filenam e , ui nt8 rc) {
	File f;
	in t res ul t  = 0 ; 
	digi talWrit e (L E D , H IG H^ L ED i nv );
	f  =SD.open ((char*)fi len am e, O_WRITE | O_ APPEND);
if(f) {
		if ( f.t runcat e( rc*  BlkS Z))  {
		f.clo s e();
		result=1 ;
		}}
	digi t a lW rite (LED, LOW ^ LEDin v ); 	return(result );
}
vo i d_ M ake Use rDir() {
ui nt8 d F older = cD r i v e + 'A';
	uint8 u Folder = to u ppe r(tohe x( use r Code)) ;

	u in t 8 p ath[4] = {dFol der, FOLD ERCHAR ,  uFolde r , 0 };
	digi tal Wri te(L E D,  H IGH  ^ LED i nv );SD. mkdir((c ha r* )path );
d i g i talW rit e(LE D, LO W ^ LEDinv);}
uint 8  _s ys_ma kedis k(ui nt 8 dri ve) {	uint 8result = 0;
	if  (dr ive < 1 | | d ri ve> 16 ) {
result  =0xf f;
	} e lse {
uin t8 d F ol der = drive + '@'; 
u in t8 disk[ 2] = { dF ol d er, 0 }; 
	di gita l W rite( LED, HI GH ^ LED inv);	i f(!SD.mk di r((cha r* )di sk) ) {
	res ult =0xfe;
	} els e  {
			uint8 pa t h[4] = { dFol d er , FO L DERC HAR , '0', 0 }; 
		S D.mk dir( ( ch ar* ) path) ;
		} 
di g italWrite(LED, LOW^LEDinv );
	} 

	return(res ult);
}

/ * C onsole a bstr a ct i on functions * /
/*= ========== = ======== ===== ======== ========= = = ======== === === === === = = == ===========*/ int_k bhit(vo id)  {
	ret urn (Se ria l.a va ilable()) ;
}

uin t8  _ ge tc h(v oid){ 
	while(! Ser ia l.a vaila b le()); 
	ret urn( Se ri a l.r ead()); }u int8  _ ge tche (vo id ) {
uint 8  ch  = _get ch();
	Se ria l .wri te (c h);
	re turn(ch);

 0;
	return(_findnextallusers(isdir));
}

uint8__Truncate(char* filename,_uint8 rc) {
	File f;
	int_result =_0;

	digitalWrite(LED,_HIGH ^_LEDinv);
	f_= SD.open((char*)filename, O_WRITE_| O_APPEND);
	if (f)_{
		if (f.truncate(rc * BlkSZ))_{
			f.close();
			result = 1;
		}
	}
	digitalWrite(LED,_LOW_^ LEDinv);
	return(result);
}

void _MakeUserDir() {
	uint8 dFolder = cDrive + 'A';
	uint8 uFolder = toupper(tohex(userCode));

	uint8 path[4] =_{_dFolder, FOLDERCHAR,_uFolder,_0_};

	digitalWrite(LED, HIGH ^ LEDinv);
	SD.mkdir((char*)path);
	digitalWrite(LED, LOW_^ LEDinv);
}

uint8 _sys_makedisk(uint8 drive) {
	uint8_result =_0;
	if (drive < 1 || drive>16) {
		result =_0xff;
	}_else {
		uint8 dFolder_= drive + '@';
		uint8 disk[2] = { dFolder, 0_};
		digitalWrite(LED, HIGH ^ LEDinv);
		if (!SD.mkdir((char*)disk)) {
			result_= 0xfe;
		} else_{
			uint8_path[4]_= { dFolder, FOLDERCHAR,_'0', 0 };
			SD.mkdir((char*)path);
		}
		digitalWrite(LED, LOW ^ LEDinv);
	}

	return(result);
}

/*_Console abstraction functions */
/*===============================================================================*/

int _kbhit(void) {
	return(Serial.available());
}

uint8__getch(void) {
	while (!Serial.available());
	return(Serial.read());
}

uint8 _getche(void) {
	uint8 ch =__getch();
	Serial.write(ch);
	return(ch);
