aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-06-15 16:43:48 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-10-18 13:30:17 -0400
commitc6c959682084c8493a0c39754374e7dbe6cf1708 (patch)
treefa07c52c4527a2d1f11dbd1630aae1da25d54655
parent9e3c80a3ae38c111c138aa9e7c70f1abb5d1424f (diff)
downloadlibrambutan-c6c959682084c8493a0c39754374e7dbe6cf1708.tar.gz
librambutan-c6c959682084c8493a0c39754374e7dbe6cf1708.zip
usb: Cleanups and renames.
Rename setupUSB() and disableUSB() to usb_cdcacm_enable() and usb_cdcacm_disable(), respectively. Remove usbSendHello(). This shouldn't exist. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
-rw-r--r--libmaple/usb/usb.c19
-rw-r--r--libmaple/usb/usb.h6
-rw-r--r--wirish/boards.cpp2
-rw-r--r--wirish/usb_serial.cpp4
4 files changed, 7 insertions, 24 deletions
diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c
index 9b70b6b..5c4c35a 100644
--- a/libmaple/usb/usb.c
+++ b/libmaple/usb/usb.c
@@ -99,7 +99,7 @@ struct {
volatile uint8 bESOFcnt;
} ResumeS;
-void setupUSB (gpio_dev *disc_dev, uint8 disc_bit) {
+void usb_cdcacm_enable(gpio_dev *disc_dev, uint8 disc_bit) {
gpio_set_mode(disc_dev, disc_bit, GPIO_OUTPUT_PP);
/* setup the apb1 clock for USB */
@@ -110,7 +110,7 @@ void setupUSB (gpio_dev *disc_dev, uint8 disc_bit) {
USB_Init(); // low level init routine provided by the ST library
}
-void disableUSB (gpio_dev *disc_dev, uint8 disc_bit) {
+void usb_cdcacm_disable(gpio_dev *disc_dev, uint8 disc_bit) {
// These are just guesses about how to do this
// TODO: real disable function
usbDsbISR();
@@ -400,21 +400,6 @@ uint32 usbReceiveBytes(uint8* recvBuf, uint32 len) {
return len;
}
-void usbSendHello(void) {
- uint8 bufin = 48 + recvBufIn;;
- uint8 bufout = 48 + recvBufOut;
- uint8 avail = 48 + usbBytesAvailable();
-
- char *line = "\r\n";
- while(usbSendBytes(&bufin,1) == 0);
- while(usbSendBytes(&bufout,1) == 0);
- while(usbSendBytes(&avail,1) == 0);
- while(usbSendBytes((uint8*)line,2) == 0);
-
- uint8 recv[64];
- usbReceiveBytes(&recv[0],1);
-}
-
uint8 usbGetDTR() {
return ((line_dtr_rts & CONTROL_LINE_DTR) != 0);
}
diff --git a/libmaple/usb/usb.h b/libmaple/usb/usb.h
index 0df3c8d..c3d587d 100644
--- a/libmaple/usb/usb.h
+++ b/libmaple/usb/usb.h
@@ -57,8 +57,8 @@ typedef enum {
extern volatile uint32 bDeviceState;
-void setupUSB(gpio_dev*, uint8);
-void disableUSB(gpio_dev*, uint8);
+void usb_cdcacm_enable(gpio_dev*, uint8);
+void usb_cdcacm_disable(gpio_dev*, uint8);
void usbSuspend(void);
void usbResumeInit(void);
void usbResume(RESUME_STATE);
@@ -84,8 +84,6 @@ uint8 usbIsConnected(void);
uint8 usbIsConfigured(void);
uint16 usbGetPending(void);
-void usbSendHello(void);
-
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/wirish/boards.cpp b/wirish/boards.cpp
index 1b921ac..3c09390 100644
--- a/wirish/boards.cpp
+++ b/wirish/boards.cpp
@@ -58,7 +58,7 @@ void init(void) {
afio_init();
setupADC();
setupTimers();
- setupUSB(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT);
+ usb_cdcacm_enable(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT);
boardInit();
}
diff --git a/wirish/usb_serial.cpp b/wirish/usb_serial.cpp
index 927f7fc..9d9cd59 100644
--- a/wirish/usb_serial.cpp
+++ b/wirish/usb_serial.cpp
@@ -39,11 +39,11 @@ USBSerial::USBSerial(void) {
}
void USBSerial::begin(void) {
- setupUSB(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT);
+ usb_cdcacm_enable(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT);
}
void USBSerial::end(void) {
- disableUSB(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT);
+ usb_cdcacm_disable(BOARD_USB_DISC_DEV, BOARD_USB_DISC_BIT);
}
void USBSerial::write(uint8 ch) {