add USBDevice library support for DISCO_F407VG

pull/460/head
Yihui Xiong 2014-08-21 12:32:03 +08:00
parent 0cd6ca6600
commit 132278ac87
4 changed files with 12 additions and 4 deletions

View File

@ -43,7 +43,7 @@ typedef enum {
#include "USBEndpoints_LPC11U.h"
#elif defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M) | defined(TARGET_K64F)
#include "USBEndpoints_KL25Z.h"
#elif defined (TARGET_STM32F4XX)
#elif defined (TARGET_STM32F4)
#include "USBEndpoints_STM32F4.h"
#else
#error "Unknown target type"

View File

@ -110,7 +110,7 @@ private:
#if defined(TARGET_LPC11U24)
bool (USBHAL::*epCallback[10 - 2])(void);
#elif defined(TARGET_STM32F4XX)
#elif defined(TARGET_STM32F4)
bool (USBHAL::*epCallback[8 - 2])(void);
#else
bool (USBHAL::*epCallback[32 - 2])(void);

View File

@ -16,7 +16,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#if defined(TARGET_STM32F4XX)
#if defined(TARGET_STM32F4)
#include "USBHAL.h"
#include "USBRegs_STM32.h"
@ -48,6 +48,13 @@ USBHAL::USBHAL(void) {
// Enable power and clocking
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
#if defined(TARGET_STM32F407VG)
pin_function(PA_8, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS));
pin_function(PA_9, STM_PIN_DATA(STM_MODE_INPUT, GPIO_PULLDOWN, GPIO_AF10_OTG_FS));
pin_function(PA_10, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG_FS));
pin_function(PA_11, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS));
pin_function(PA_12, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS));
#else
pin_function(PA_8, STM_PIN_DATA(2, 10));
pin_function(PA_9, STM_PIN_DATA(0, 0));
pin_function(PA_10, STM_PIN_DATA(2, 10));
@ -61,6 +68,7 @@ USBHAL::USBHAL(void) {
// Set VBUS pin to open drain
pin_mode(PA_9, OpenDrain);
#endif
RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;

View File

@ -248,7 +248,7 @@ class STM32F407(Target):
def __init__(self):
Target.__init__(self)
self.core = "Cortex-M4F"
self.extra_labels = ['STM', 'STM32F4XX']
self.extra_labels = ['STM', 'STM32F4', 'STM32F4XX']
self.supported_toolchains = ["ARM", "GCC_ARM"]