mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-03-22 01:31:21 +03:00
Working code for STM32F0x2 test board, development of the same code for STM32F103
This commit is contained in:
Binary file not shown.
@@ -32,6 +32,7 @@ static uint8_t incoming_data[IDATASZ];
|
||||
static uint8_t ovfl = 0;
|
||||
static uint16_t idatalen = 0;
|
||||
static int8_t usbON = 0; // ==1 when USB fully configured
|
||||
static volatile uint8_t tx_succesfull = 0;
|
||||
|
||||
// interrupt IN handler (never used?)
|
||||
static uint16_t EP1_Handler(ep_t ep){
|
||||
@@ -80,6 +81,7 @@ static uint16_t EP23_Handler(ep_t ep){
|
||||
ep.status = SET_STALL_TX(ep.status);
|
||||
}else if (ep.tx_flag){
|
||||
ep.status = KEEP_STAT_TX(ep.status);
|
||||
tx_succesfull = 1;
|
||||
}
|
||||
ep.status = SET_VALID_RX(ep.status);
|
||||
return ep.status;
|
||||
@@ -128,7 +130,10 @@ void USB_send(char *buf){
|
||||
while(*p++) ++l;
|
||||
while(l){
|
||||
uint16_t s = (l > USB_TXBUFSZ) ? USB_TXBUFSZ : l;
|
||||
tx_succesfull = 0;
|
||||
EP_Write(3, (uint8_t*)&buf[ctr], s);
|
||||
uint32_t ctra = 1000000;
|
||||
while(--ctra && tx_succesfull == 0);
|
||||
l -= s;
|
||||
ctr += s;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user