|
| 1 | +/* |
| 2 | + Copyright (c) 2015 Arduino LLC. All right reserved. |
| 3 | + Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. |
| 4 | +
|
| 5 | + This library is free software; you can redistribute it and/or |
| 6 | + modify it under the terms of the GNU Lesser General Public |
| 7 | + License as published by the Free Software Foundation; either |
| 8 | + version 2.1 of the License, or (at your option) any later version. |
| 9 | +
|
| 10 | + This library is distributed in the hope that it will be useful, |
| 11 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | + See the GNU Lesser General Public License for more details. |
| 14 | +
|
| 15 | + You should have received a copy of the GNU Lesser General Public |
| 16 | + License along with this library; if not, write to the Free Software |
| 17 | + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | +*/ |
1 | 19 |
|
2 | 20 | #include <string.h> |
3 | 21 | #include "board_driver_usb.h" |
@@ -155,12 +173,12 @@ uint32_t USB_Write(Usb *pUsb, const char *pData, uint32_t length, uint8_t ep_num |
155 | 173 | usb_endpoint_table[ep_num].DeviceDescBank[1].PCKSIZE.bit.MULTI_PACKET_SIZE = 0; |
156 | 174 | /* Clear the transfer complete flag */ |
157 | 175 | //pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT1 = true; |
158 | | - pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT |= (1 << 1); |
| 176 | + pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT |= (1<<1); |
159 | 177 | /* Set the bank as ready */ |
160 | 178 | pUsb->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.bit.BK1RDY = true; |
161 | 179 |
|
162 | 180 | /* Wait for transfer to complete */ |
163 | | - while (!( pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT & (1<<1) )); |
| 181 | + while ( (pUsb->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.bit.TRCPT & (1<<1)) == 0 ); |
164 | 182 |
|
165 | 183 | return length; |
166 | 184 | } |
@@ -347,4 +365,3 @@ void USB_Configure(Usb *pUsb) |
347 | 365 | usb_endpoint_table[USB_EP_COMM].DeviceDescBank[1].PCKSIZE.bit.SIZE = 0; |
348 | 366 | pUsb->DEVICE.DeviceEndpoint[USB_EP_COMM].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK1RDY; |
349 | 367 | } |
350 | | - |
|
0 commit comments