msc: made msc optional

This commit is contained in:
schneider 2011-07-10 15:32:20 +02:00
parent e3bc255d28
commit 068cf4a0d6
6 changed files with 25 additions and 2 deletions

View File

@ -140,7 +140,9 @@ void main_executor(void) {
};
if(key==BTN_UP){
#if CFG_USBMSC
usbMSCInit();
#endif
};
// Display nickname

View File

@ -34,8 +34,10 @@ const struct MENU_DEF menu_list = {"FS List", &fs_list};
const struct MENU_DEF menu_create = {"FS Create", &fs_create};
const struct MENU_DEF menu_format = {"FS format", &fs_format};
const struct MENU_DEF menu_read = {"FS read", &fs_read};
#if CFG_USBMSC
const struct MENU_DEF menu_usb = {"USB mount", &usbMSCInit};
const struct MENU_DEF menu_usboff = {"USB unmount", &usbMSCOff};
#endif
const struct MENU_DEF menu_nop = {"---", NULL};
static menuentry menu[] = {
@ -47,8 +49,10 @@ static menuentry menu[] = {
&menu_nop,
&menu_format,
&menu_nop,
#if CFG_USBMSC
&menu_usb,
&menu_usboff,
#endif
&menu_nop,
&menu_ISP,
&menu_incBL,

View File

@ -75,10 +75,12 @@ void EnableWatchdog(uint32_t ms){
};
void ISPandReset(int delay){
#if CFG_USBMSC
if(usbMSCenabled){
usbMSCOff();
delayms(500);
};
#endif
EnableWatchdog(1000*delay);
ReinvokeISP();
};

View File

@ -70,4 +70,15 @@
#define CFG_HAVE_SDCARD (0)
/*=========================================================================*/
#define CFG_USBMSC (1)
#define CFG_USBMSC (1)
#define CFG_USB_VID (0x239A)
#define CFG_USB_PID (0x1002)
#define CFG_USBCDC (0)
#define CFG_USBCDC_BAUDRATE (115200)
#define CFG_USBCDC_INITTIMEOUT (5000)
#define CFG_USBCDC_BUFFERSIZE (256)

View File

@ -18,10 +18,12 @@ uint32_t intstatus;
#define TYPE_DATA 1
static void select() {
#if CFG_USBMSC
if(usbMSCenabled){
intstatus=USB_DEVINTEN;
USB_DEVINTEN=0;
};
#endif
/* the LCD requires 9-Bit frames */
uint32_t configReg = ( SSP_SSP0CR0_DSS_9BIT // Data size = 9-bit
| SSP_SSP0CR0_FRF_SPI // Frame format = SPI
@ -37,9 +39,11 @@ static void deselect() {
| SSP_SSP0CR0_FRF_SPI // Frame format = SPI
| SSP_SSP0CR0_SCR_8); // Serial clock rate = 8
SSP_SSP0CR0 = configReg;
#if CFG_USBMSC
if(usbMSCenabled){
USB_DEVINTEN=intstatus;
};
#endif
}
static void lcdWrite(uint8_t cd, uint8_t data) {

View File

@ -88,7 +88,7 @@ void usbMSCInit(void) {
usbMSCenabled=1;
}
#ifdef CFG_USBMSC
#if CFG_USBMSC
void USB_IRQHandler() {
(*rom)->pUSBD->isr();
}