// *--------------------------------------------------------------------------------* int main(){ UINT16 Count=0; mJTAGPortEnable(0); // JTAG des-habilitado SYSTEMConfigPerformance(GetSystemClock()); // Activa pre-cache.- LED1_OUTPUT(); LED2_OUTPUT(); INTEnableSystemMultiVectoredInt(); deviceAttached = FALSE; //Initialize the stack USBInitialize(0); while(1){ //USB stack process function USBTasks(); if(++Count==0){ LED1_TOGGLE(); } //if thumbdrive is plugged in if(USBHostMSDSCSIMediaDetect()){ deviceAttached = TRUE; LED1_OFF(); //now a device is attached //See if the device is attached and in the right format if(FSInit()){ //Opening a file in mode "w" will create the file if it doesn't // exist. If the file does exist it will delete the old file // and create a new one that is blank. myFile = FSfopen("test.txt","w"); //Write some data to the new file. FSfwrite("This is a test.",1,15,myFile); //Always make sure to close the file so that the data gets // written to the drive. FSfclose(myFile); //Just sit here until the device is removed. while(deviceAttached == TRUE){ USBTasks(); if(++Count==0){ LED2_TOGGLE(); } } LED2_OFF(); } } } }
// *--------------------------------------------------------------------------------* int main(){ UINT8 k=0; UINT16 Conversion; mJTAGPortEnable(0); // JTAG des-habilitado SYSTEMConfigPerformance(GetSystemClock()); // Activa pre-cache.- LED1_OUTPUT(); LED2_OUTPUT(); LED3_OUTPUT(); LED4_OUTPUT(); SW1_INPUT(); SW2_INPUT(); PORTSetPinsDigitalOut(IOPORT_D, BIT_1); // Backlight del TFT mPORTDSetBits(BIT_1); vLCDTFTInit(); vLCDTFTFillScreen(ColorWhite); vADC_Init(); while(1){ if(SW1_STATUS()==0){ vLCDTFTRectangle(0,0,200,319,1,Colores[k]); if(++k==6){k=0;} DelayMs(250); } if(SW2_STATUS()==0){ LED2_TOGGLE(); LED4_TOGGLE(); DelayMs(250); } Conversion=ADC_Conversion(); vLCDTFTRectangle(201,0,239,319,1,ColorWhite); // 1023 -> 0; 0 -> 239 vLCDTFTRectangle(202,((-0.31183*Conversion)+319.0),238,319,1,ColorRed); DelayMs(50); } }
void BlinkLed2(void) { LED2_TOGGLE(); }
void ToggleLed2(void) { LED2_TOGGLE(); CalloutRegister(ToggleLed2, 100); }
void ToggleLed2(void) { LED2_TOGGLE(); }