
// MIOS_BANKSTICK_CtrlSet(0x00); // select 1st BankStick
// MIOS_BANKSTICK_CtrlSet(0x07); // select 8th BankStick

/////////////////////////////////////////////////////////////////////////////
// BANKSTICK SAVE PHRASE
/////////////////////////////////////////////////////////////////////////////

void SAVE(){
	//if(phrase==0)return;
	MIOS_LCD_CursorSet(0x00);//First line
	MIOS_LCD_PrintCString("BANKSTICK 0x");
	MIOS_LCD_PrintHex2(MIOS_BANKSTICK_CtrlGet());
	//str_buffer[16][1];

	//MIOS_LCD_CursorSet(0x40);//2 line
	//MIOS_LCD_PrintCString("Write phrase 0x");
	//MIOS_LCD_PrintHex2(phrase);

	MIOS_LCD_CursorSet(0x80);//3 line

	//switch(MIOS_BANKSTICK_WritePage(0x4000+(phrase*64),pattern[midi_channel])){
	switch(MIOS_BANKSTICK_WritePage(0x4000+(selectpot*64),main)){
		
		case 0x00:
			MIOS_LCD_PrintCString("Pattern ");
			MIOS_LCD_PrintHex2(selectpot);
			MIOS_LCD_PrintCString(" Saved OK");
			break;

		case 0x01:
			//0x01: Byte mismatch
			MIOS_LCD_PrintCString("Byte mismatch");
			break;
		
		case 0x02:
			//0x02: No BankStick
			MIOS_LCD_PrintCString("No BankStick");
			break;

		default:
			MIOS_LCD_PrintCString("Save error");
			break;
	}
}


/////////////////////////////////////////////////////////////////////////////
// BANKSTICK LOAD PHRASE
/////////////////////////////////////////////////////////////////////////////

void LOAD(){
	//if(phrase==0)return;
	MIOS_LCD_PrintCString("LOAD:");
	MIOS_LCD_PrintHex2(selectpot);
	//MIOS_LCD_PrintHex2(phrase);
	//MIOS_BANKSTICK_ReadPage(0x4000+(phrase*64),pattern[midi_channel]);//bug (tempo)
	MIOS_BANKSTICK_ReadPage(0x4000+(selectpot*64),main);//
}

void GETPAT(unsigned char voice,unsigned char patnum){//load pattern number 'patnum' into pattern['voice']
	//MIOS_LCD_PrintCString("[");
	//MIOS_LCD_PrintBCD1(voice);
	//MIOS_LCD_PrintCString(":");
	//MIOS_LCD_PrintHex2(patnum);
	//MIOS_LCD_PrintCString("]");
	MIOS_BANKSTICK_ReadPage(0x4000+(patnum*64),pattern[voice]);
}

void BS_DETECT(){
	MIOS_BANKSTICK_Read(0x7fff);
	if(!MIOS_BOX_STAT.BS_AVAILABLE ) {
		// here you could do some error handling
		MIOS_LCD_PrintCString("No BankStick");
	}else{
		MIOS_LCD_PrintCString("BankStick OK");
	}
}


/*
void ERASE_BS(){//ERASE BANCKSTICK
}
*/

void BACKUP(){
}

