Working code for STM32F0x2 test board, development of the same code for STM32F103

This commit is contained in:
eddyem
2019-05-18 18:57:57 +03:00
parent 24b953e3a3
commit 96c7e0d77c
52 changed files with 11016 additions and 4227 deletions

Binary file not shown.

View File

@@ -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;
}