From af4c4985cef82b80b936584d686c80d9538082b6 Mon Sep 17 00:00:00 2001 From: "ajmeyer@mit.edu" Date: Sat, 19 Dec 2009 08:41:53 +0000 Subject: fixed some minor naming issues in usb.c/h usb_serialWriteStr is nonfunctional git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@73 749a229e-a60e-11de-b98f-4500b42dc123 --- src/lib/usb.c | 10 +++++----- src/lib/usb.h | 14 +++++--------- src/main.cpp | 8 +++++++- src/wiring/wiring.c | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/lib/usb.c b/src/lib/usb.c index e0d7d42..e83bf98 100644 --- a/src/lib/usb.c +++ b/src/lib/usb.c @@ -1,5 +1,5 @@ -#include "usb.h" #include +#include "usb.h" void usb_lpIRQHandler(void) { @@ -10,7 +10,7 @@ void usb_lpIRQHandler(void) ptrToUsbISR(); } -void UserToPMABufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes) +void usb_userToPMABufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes) { u32 n = (wNBytes + 1) >> 1; /* n = (wNBytes + 1) / 2 */ u32 i, temp1, temp2; @@ -27,7 +27,7 @@ void UserToPMABufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes) } } -void PMAToUserBufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes) +void usb_PMAToUserBufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes) { u32 n = (wNBytes + 1) >> 1;/* /2*/ u32 i; @@ -40,7 +40,7 @@ void PMAToUserBufferCopy(u8 *pbUsrBuf, u16 wPMABufAddr, u16 wNBytes) } } -void serialWriteStr(char* outStr) { +void usb_serialWriteStr(const char* outStr) { u8 offset=0; while ((outStr[offset] != 0) && (offset < USB_SERIAL_BUF_SIZE)) { @@ -49,7 +49,7 @@ void serialWriteStr(char* outStr) { while (_GetEPTxCount(USB_SERIAL_ENDP_TX) > 0) {} - UserToPMABufferCopy(outStr,USB_SERIAL_ENDP_TXADDR,offset); + usb_userToPMABufferCopy(outStr,USB_SERIAL_ENDP_TXADDR,offset); _SetEPTxCount(USB_SERIAL_ENDP_TX,offset); _SetEPTxValid(USB_SERIAL_ENDP_TX); } diff --git a/src/lib/usb.h b/src/lib/usb.h index be632dd..d057b1d 100644 --- a/src/lib/usb.h +++ b/src/lib/usb.h @@ -6,7 +6,7 @@ #include "cortexm3_macro.h" #include "usb_regs.h" -#ifdef __cpluscplus +#ifdef __cplusplus extern "C" { #endif @@ -18,16 +18,12 @@ extern "C" { #define USB_SERIAL_BUF_SIZE (0x40) void usb_lpIRQHandler(void); -void usb_userToPMABufferCopy(uint8_t *pbUsrBuf, - uint16_t *wPMABufAddr, - uint16_t *wNBytes); -void usb_PMABToUserufferCopy(uint8_t *pbUsrBuf, - uint16_t *wPMABufAddr, - uint16_t *wNBytes); -void usb_serialWriteStr(char* str); +void usb_userToPMABufferCopy(u8 *pbUsrBuf,u16 wPMABufAddr,u16 wNBytes); +void usb_PMAToUserBufferCopy(u8 *pbUsrBuf,u16 wPMABufAddr,u16 wNBytes); +void usb_serialWriteStr(const char *outStr); -#ifdef __cpluscplus +#ifdef __cplusplus } // extern "C" #endif #endif //_USB_H diff --git a/src/main.cpp b/src/main.cpp index 2007c2f..2266f3d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,6 +12,7 @@ #include "pwm.h" #include "ext_interrupts.h" #include "usart.h" +#include "usb.h" void setup(); void loop(); @@ -37,10 +38,15 @@ void setup() int toggle = 0; +char* testMsg = "0123456\n"; void loop() { toggle ^= 1; digitalWrite(ledPin, toggle); - delay(100); + delay(1000); + + usb_userToPMABufferCopy((u8*)testMsg,USB_SERIAL_ENDP_TXADDR,8); + _SetEPTxCount(USB_SERIAL_ENDP_TX,8); + _SetEPTxValid(USB_SERIAL_ENDP_TX); } diff --git a/src/wiring/wiring.c b/src/wiring/wiring.c index bedce55..7fcd5fd 100644 --- a/src/wiring/wiring.c +++ b/src/wiring/wiring.c @@ -35,7 +35,7 @@ void init(void) { void NVIC_Configuration(void) { #ifdef VECT_TAB_ROM NVIC_SetVectorTable(USER_ADDR_ROM, 0x0); -#elifdef VECT_TAB_RAM +#elif defined VECT_TAB_RAM NVIC_SetVectorTable(USER_ADDR_RAM, 0x0); #else // VECT_TAB_BASE /* Set the Vector Table base location at 0x08000000 */ -- cgit v1.2.3