14.11.2012 Views

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

B.1. Microprocessor Code 93<br />

TIM_DeInit(TIM0);<br />

TIM_DeInit(TIM1);<br />

SCU_APBPeriphClockConfig(__TIM23, ENABLE);<br />

TIM_DeInit(TIM2);<br />

TIM_DeInit(TIM3);<br />

SCU_TIMPresConfig(SCU_TIM01 , 4800); // ~10KHz<br />

SCU_TIMExtCLKCmd(SCU_TIM01 , DISABLE); // Disable external pin<br />

SCU_TIMPresConfig(SCU_TIM23 , 4800); // ~10KHz<br />

SCU_TIMExtCLKCmd(SCU_TIM23 , DISABLE); // Disable external pin<br />

SCU_APBPeriphClockConfig(__I2C0, ENABLE);<br />

I2C_DeInit(I2C0);<br />

SCU_AHBPeriphClockConfig(__FMI, ENABLE);<br />

SCU_AHBPeriphReset(__FMI, DISABLE);<br />

}<br />

/*******************************************************************************<br />

* Function Name : USB_Configuration<br />

* Description : Configures <strong>the</strong> USB<br />

* Input : None<br />

* Output : None<br />

* Return : None<br />

*******************************************************************************/<br />

void USB_Configuration(void) {<br />

GPIO_InitTypeDef GPIO_InitStructure;<br />

/* USB clock = MCLK/2 = 48MHz */<br />

SCU_USBCLKConfig(SCU_USBCLK_MCLK2);<br />

/* Enable USB clock */<br />

SCU_AHBPeriphClockConfig(__USB, ENABLE);<br />

SCU_AHBPeriphReset(__USB, DISABLE);<br />

SCU_AHBPeriphClockConfig(__USB48M , ENABLE);<br />

/* Configure USB D+ PullUp pin */<br />

GPIO_StructInit(&GPIO_InitStructure);<br />

GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;<br />

GPIO_InitStructure.GPIO_Pin = USB_Dp_PullUp_GPIOx_Pin;<br />

GPIO_InitStructure.GPIO_Type = GPIO_Type_OpenCollector;//GPIO_Type_PushPull;<br />

GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt1;<br />

GPIO_Init(USB_Dp_PullUp_GPIO , &GPIO_InitStructure);<br />

USB_Dp_PullUp_OFF();<br />

MSDelay(100);<br />

USB_Dp_PullUp_ON();<br />

USB_endPointConf();<br />

VIC_Config(USBLP_ITLine, VIC_IRQ, USB_Priority);<br />

VIC_ITCmd(USBLP_ITLine, ENABLE);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!