mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-02-28 11:54:30 +03:00
add I2C for F303, fix bug in USB (some variables wasn't volatile)
This commit is contained in:
@@ -29,7 +29,7 @@ uint8_t ep0dbuflen = 0;
|
||||
|
||||
usb_LineCoding getLineCoding(){return lineCoding;}
|
||||
|
||||
uint8_t usbON = 0; // device disconnected from terminal
|
||||
volatile uint8_t usbON = 0; // device disconnected from terminal
|
||||
|
||||
// definition of parts common for USB_DeviceDescriptor & USB_DeviceQualifierDescriptor
|
||||
#define bcdUSB_L 0x10
|
||||
@@ -149,8 +149,8 @@ void WEAK break_handler(){
|
||||
|
||||
// handler of vendor requests
|
||||
void WEAK vendor_handler(config_pack_t *packet){
|
||||
uint16_t c;
|
||||
if(packet->bmRequestType & 0x80){ // read
|
||||
uint8_t c;
|
||||
switch(packet->wValue){
|
||||
case 0x8484:
|
||||
c = 2;
|
||||
@@ -164,9 +164,10 @@ void WEAK vendor_handler(config_pack_t *packet){
|
||||
default:
|
||||
c = 0;
|
||||
}
|
||||
EP_WriteIRQ(0, &c, 1);
|
||||
EP_WriteIRQ(0, (uint8_t*)&c, 1);
|
||||
}else{ // write ZLP
|
||||
EP_WriteIRQ(0, (uint8_t *)0, 0);
|
||||
c = 0;
|
||||
EP_WriteIRQ(0, (uint8_t *)&c, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +227,7 @@ static inline void get_descriptor(){
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t configuration = 0; // reply for GET_CONFIGURATION (==1 if configured)
|
||||
static uint16_t configuration = 0; // reply for GET_CONFIGURATION (==1 if configured)
|
||||
static inline void std_d2h_req(){
|
||||
uint16_t status = 0; // bus powered
|
||||
switch(setup_packet.bRequest){
|
||||
@@ -237,7 +238,7 @@ static inline void std_d2h_req(){
|
||||
EP_WriteIRQ(0, (uint8_t *)&status, 2); // send status: Bus Powered
|
||||
break;
|
||||
case GET_CONFIGURATION:
|
||||
EP_WriteIRQ(0, &configuration, 1);
|
||||
EP_WriteIRQ(0, (uint8_t*)&configuration, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user