USB device stack for NUCLEO-F042K6, NUCLEO-L152RE and NUCLEO-F103RB.
Fork of L152RE_USBDevice by
I tried USB device using HAL_PCD.
Nucleo-F042K6 | USB |
---|---|
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
Diff: USBAudio/USBAudio.h
- Revision:
- 25:7c72828865f3
- Parent:
- 4:eaa07ce86d49
- Child:
- 47:a0cd9646ecd1
--- a/USBAudio/USBAudio.h Fri May 16 09:00:39 2014 +0100 +++ b/USBAudio/USBAudio.h Tue Jun 03 11:30:32 2014 +0100 @@ -50,7 +50,7 @@ * * int main() { * int16_t buf[AUDIO_LENGTH_PACKET/2]; -* +* * while (1) { * // read an audio packet * audio.read((uint8_t *)buf); @@ -88,7 +88,7 @@ * @returns volume */ float getVolume(); - + /** * Read an audio packet. During a frame, only a single reading (you can't write and read an audio packet during the same frame)can be done using this method. Warning: Blocking * @@ -97,7 +97,7 @@ * @returns true if successfull */ bool read(uint8_t * buf); - + /** * Try to read an audio packet. During a frame, only a single reading (you can't write and read an audio packet during the same frame)can be done using this method. Warning: Non Blocking * @@ -106,7 +106,7 @@ * @returns true if successfull */ bool readNB(uint8_t * buf); - + /** * Write an audio packet. During a frame, only a single writing (you can't write and read an audio packet during the same frame)can be done using this method. * @@ -114,7 +114,7 @@ * @returns true if successful */ bool write(uint8_t * buf); - + /** * Write and read an audio packet at the same time (on the same frame) * @@ -123,7 +123,7 @@ * @returns true if successful */ bool readWrite(uint8_t * buf_read, uint8_t * buf_write); - + /** attach a handler to update the volume * @@ -212,12 +212,12 @@ * Callback called on each Start of Frame event */ virtual void SOF(int frameNumber); - + /* * Callback called when a packet is received */ virtual bool EP3_OUT_callback(); - + /* * Callback called when a packet has been sent */ @@ -227,13 +227,13 @@ // stream available ? volatile bool available; - + // interrupt OUT has been received volatile bool interruptOUT; - + // interrupt IN has been received volatile bool interruptIN; - + // audio packet has been written volatile bool writeIN; @@ -248,7 +248,7 @@ // mono, stereo,... uint8_t channel_nb_in; uint8_t channel_nb_out; - + // channel config: master, left, right uint8_t channel_config_in; uint8_t channel_config_out; @@ -270,16 +270,16 @@ // Buffer containing one audio packet (to be read) volatile uint8_t * buf_stream_in; - + // Buffer containing one audio packet (to be written) volatile uint8_t * buf_stream_out; - + // callback to update volume FunctionPointer updateVol; - + // boolean showing that the SOF handler has been called. Useful for readNB. volatile bool SOF_handler; - + volatile float volume; };