update to latest version of USBComposite
This commit is contained in:
parent
823744fb6c
commit
e8d8cdb75e
|
@ -23,7 +23,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libmaple/iwdg.h>
|
#include <libmaple/iwdg.h>
|
||||||
|
|
||||||
#include "usb_serial.h"
|
#include "usb_composite_serial.h"
|
||||||
|
|
||||||
#define USB_TIMEOUT 50
|
#define USB_TIMEOUT 50
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define _COMPOSITE_SERIAL_H_
|
#define _COMPOSITE_SERIAL_H_
|
||||||
|
|
||||||
#include "USBComposite.h"
|
#include "USBComposite.h"
|
||||||
#include "usb_serial.h"
|
#include "usb_composite_serial.h"
|
||||||
|
|
||||||
class USBCompositeSerial : public Stream {
|
class USBCompositeSerial : public Stream {
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <libmaple/nvic.h>
|
#include <libmaple/nvic.h>
|
||||||
#include "usb_hid.h"
|
#include "usb_hid.h"
|
||||||
#include "usb_serial.h"
|
#include "usb_composite_serial.h"
|
||||||
#include "usb_generic.h"
|
#include "usb_generic.h"
|
||||||
#include <libmaple/usb.h>
|
#include <libmaple/usb.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "USBMassStorage.h"
|
#include "USBMassStorage.h"
|
||||||
#include "usb_mass.h"
|
#include "usb_mass.h"
|
||||||
#include "usb_mass_mal.h"
|
#include "usb_mass_mal.h"
|
||||||
#include "usb_serial.h"
|
#include "usb_composite_serial.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
void USBMassStorageDevice::begin() {
|
void USBMassStorageDevice::begin() {
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include <USBHID.h>
|
||||||
|
|
||||||
|
#define LED PB12
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
pinMode(LED,OUTPUT);
|
||||||
|
digitalWrite(LED,1);
|
||||||
|
USBHID_begin_with_serial(HID_MOUSE);
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop(){
|
||||||
|
digitalWrite(LED,0);
|
||||||
|
Mouse.move(4,0);
|
||||||
|
delay(500);
|
||||||
|
digitalWrite(LED,1);
|
||||||
|
delay(30000);
|
||||||
|
digitalWrite(LED,0);
|
||||||
|
Mouse.move(-4,0);
|
||||||
|
delay(500);
|
||||||
|
digitalWrite(LED,1);
|
||||||
|
delay(30000);
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
#include <USBComposite.h>
|
#include <USBComposite.h>
|
||||||
|
|
||||||
|
#define PRODUCT_ID 0x29
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
|
||||||
bool write(uint32_t memoryOffset, const uint8_t *writebuff, uint16_t transferLength) {
|
bool write(uint32_t memoryOffset, const uint8_t *writebuff, uint16_t transferLength) {
|
||||||
|
@ -49,6 +51,7 @@ void dumpDrive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
USBComposite.setProductId(PRODUCT_ID);
|
||||||
MassStorage.setDrive(0, sizeof(image), read, write);
|
MassStorage.setDrive(0, sizeof(image), read, write);
|
||||||
MassStorage.registerComponent();
|
MassStorage.registerComponent();
|
||||||
CompositeSerial.registerComponent();
|
CompositeSerial.registerComponent();
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "SdFat.h"
|
#include "SdFat.h"
|
||||||
|
|
||||||
#define LED_PIN PB12
|
#define LED_PIN PB12
|
||||||
|
#define PRODUCT_ID 0x29
|
||||||
|
|
||||||
SdFatEX sd;
|
SdFatEX sd;
|
||||||
const uint32_t speed = SPI_CLOCK_DIV2 ;
|
const uint32_t speed = SPI_CLOCK_DIV2 ;
|
||||||
|
@ -22,6 +23,7 @@ bool read(uint32_t memoryOffset, uint8_t *readbuff, uint16_t transferLength) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
USBComposite.setProductId(PRODUCT_ID);
|
||||||
pinMode(LED_PIN,OUTPUT);
|
pinMode(LED_PIN,OUTPUT);
|
||||||
digitalWrite(LED_PIN,1);
|
digitalWrite(LED_PIN,1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name=USBComposite for STM32F1
|
name=USBComposite for STM32F1
|
||||||
version=0.64
|
version=0.66
|
||||||
author=Various
|
author=Various
|
||||||
email=arpruss@gmail.com
|
email=arpruss@gmail.com
|
||||||
sentence=USB HID / MIDI / mass storage library for STM32F1
|
sentence=USB HID / MIDI / mass storage library for STM32F1
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
* the result made cleaner.
|
* the result made cleaner.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "usb_serial.h"
|
#include "usb_composite_serial.h"
|
||||||
#include "usb_generic.h"
|
#include "usb_generic.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libmaple/usb.h>
|
#include <libmaple/usb.h>
|
|
@ -264,6 +264,7 @@ static void getMIDIPartDescriptor(uint8* out) {
|
||||||
// patch to reflect where the part goes in the descriptor
|
// patch to reflect where the part goes in the descriptor
|
||||||
OUT_BYTE(usbMIDIDescriptor_Config, AC_Interface.bInterfaceNumber) += usbMIDIPart.startInterface;
|
OUT_BYTE(usbMIDIDescriptor_Config, AC_Interface.bInterfaceNumber) += usbMIDIPart.startInterface;
|
||||||
OUT_BYTE(usbMIDIDescriptor_Config, MS_Interface.bInterfaceNumber) += usbMIDIPart.startInterface;
|
OUT_BYTE(usbMIDIDescriptor_Config, MS_Interface.bInterfaceNumber) += usbMIDIPart.startInterface;
|
||||||
|
OUT_BYTE(usbMIDIDescriptor_Config, AC_CS_Interface.baInterfaceNr) += usbMIDIPart.startInterface;
|
||||||
OUT_BYTE(usbMIDIDescriptor_Config, DataOutEndpoint.bEndpointAddress) += usbMIDIPart.startEndpoint;
|
OUT_BYTE(usbMIDIDescriptor_Config, DataOutEndpoint.bEndpointAddress) += usbMIDIPart.startEndpoint;
|
||||||
OUT_BYTE(usbMIDIDescriptor_Config, DataInEndpoint.bEndpointAddress) += usbMIDIPart.startEndpoint;
|
OUT_BYTE(usbMIDIDescriptor_Config, DataInEndpoint.bEndpointAddress) += usbMIDIPart.startEndpoint;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,18 +35,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "boards_private.h"
|
#include "boards_private.h"
|
||||||
#include "USBHID.h"
|
|
||||||
#include <libmaple/gpio.h>
|
#include <libmaple/gpio.h>
|
||||||
#include <libmaple/timer.h>
|
#include <libmaple/timer.h>
|
||||||
|
|
||||||
#include <boards.h>
|
#include <boards.h>
|
||||||
#include <usb_serial.h>
|
|
||||||
|
|
||||||
namespace wirish {
|
namespace wirish {
|
||||||
namespace priv {
|
namespace priv {
|
||||||
|
|
||||||
void board_setup_usb(void) {
|
void board_setup_usb(void) {
|
||||||
//Serial = CompositeSerial;
|
|
||||||
#ifdef GENERIC_BOOTLOADER
|
#ifdef GENERIC_BOOTLOADER
|
||||||
//Reset the USB interface on generic boards - developed by Victor PV
|
//Reset the USB interface on generic boards - developed by Victor PV
|
||||||
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
gpio_set_mode(PIN_MAP[PA12].gpio_device, PIN_MAP[PA12].gpio_bit, GPIO_OUTPUT_PP);
|
||||||
|
|
Loading…
Reference in New Issue