USB device stack for NUCLEO-F042K6, NUCLEO-L152RE and NUCLEO-F103RB.

Dependents:   LPE-SEM01

Fork of L152RE_USBDevice by Norimasa Okamoto

I tried USB device using HAL_PCD.

/media/uploads/va009039/f042k6_usbdevice_vin.jpg

Nucleo-F042K6USB
PA11 (CN3-13)DM  (2 WHITE)
PA12 (CN3-5)DP  (3 GREEN)
GND (CN3-4)GND (5 BLACK)
VIN (CN4-1)VBUS(1 RED)

Examples

Import programF042K6_USBDevice_example

NUCLEO-F042K6 USBDevice example code

Import programL152RE_USBDevice_example

L152RE_USBDevice example code

Import programF042K6_Simple-CMSIS-DAP

cmsis-dap debug adapter

Import programL152RE_Simple-CMSIS-DAP

cmsis-dap debug adapter

Revision:
25:7c72828865f3
Parent:
19:fcb63a105965
Child:
47:a0cd9646ecd1
--- a/USBSerial/USBSerial.h	Fri May 16 09:00:39 2014 +0100
+++ b/USBSerial/USBSerial.h	Tue Jun 03 11:30:32 2014 +0100
@@ -68,20 +68,20 @@
     * @returns true if there is no error, false otherwise
     */
     virtual int _putc(int c);
-    
+
     /**
     * Read a character: blocking
     *
     * @returns character read
     */
     virtual int _getc();
-    
+
     /**
     * Check the number of bytes available.
     *
     * @returns the number of bytes available
     */
-    uint8_t available(); 
+    uint8_t available();
 
     /** Determine if there is a character available to read
      *
@@ -90,7 +90,7 @@
      *    0 otherwise
      */
     int readable() { return available() ? 1 : 0; }
-    
+
     /** Determine if there is space available to write a character
      *
      *  @returns
@@ -98,9 +98,9 @@
      *    0 otherwise
      */
     int writeable() { return 1; } // always return 1, for write operation is blocking
-    
+
     /**
-    * Write a block of data. 
+    * Write a block of data.
     *
     * For more efficiency, a block of size 64 (maximum size of a bulk endpoint) has to be written.
     *
@@ -112,7 +112,7 @@
     bool writeBlock(uint8_t * buf, uint16_t size);
 
     /**
-     *  Attach a member function to call when a packet is received. 
+     *  Attach a member function to call when a packet is received.
      *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called