mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
Changed switch into if statements
This commit is contained in:
parent
3e6feb7f6d
commit
59ff208c65
@ -550,14 +550,17 @@ static void transmit_fifo_packet(uint8_t fifo_num, uint8_t * src, uint16_t len){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write the remaining 1-3 bytes into fifo
|
// Write the remaining 1-3 bytes into fifo
|
||||||
|
uint8_t bytes_rem = len & 0x03;
|
||||||
|
if(bytes_rem){
|
||||||
uint32_t tmp_word = 0;
|
uint32_t tmp_word = 0;
|
||||||
switch(len & 0x0003){
|
tmp_word |= src[0];
|
||||||
case 3: tmp_word |= src[2] << 16;
|
if(bytes_rem > 1){
|
||||||
case 2: tmp_word |= src[1] << 8;
|
tmp_word |= src[1] << 8;
|
||||||
case 1: tmp_word |= src[0];
|
}
|
||||||
|
if(bytes_rem > 2){
|
||||||
|
tmp_word |= src[2] << 16;
|
||||||
|
}
|
||||||
*tx_fifo = tmp_word;
|
*tx_fifo = tmp_word;
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user