Skip to content

Cube update F1 + USB middleware #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 18, 2019
3 changes: 3 additions & 0 deletions cores/arduino/stm32/HAL/stm32yyxx_hal_exti.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifdef STM32F1xx
#include "stm32f1xx_hal_exti.c"
#endif
#ifdef STM32F2xx
#include "stm32f2xx_hal_exti.c"
#endif
Expand Down
3 changes: 0 additions & 3 deletions cores/arduino/stm32/HAL/stm32yyxx_hal_spi_ex.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#ifdef STM32F0xx
#include "stm32f0xx_hal_spi_ex.c"
#endif
#ifdef STM32F1xx
#include "stm32f1xx_hal_spi_ex.c"
#endif
#ifdef STM32F3xx
#include "stm32f3xx_hal_spi_ex.c"
#endif
Expand Down
9 changes: 6 additions & 3 deletions cores/arduino/stm32/twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,8 @@ void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, ui
if (obj->i2c_onSlaveTransmit != NULL) {
obj->i2c_onSlaveTransmit();
}
#if defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32L0xx) || defined(STM32L1xx)
#if defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) ||\
defined(STM32L0xx) || defined(STM32L1xx)
HAL_I2C_Slave_Seq_Transmit_IT(hi2c, (uint8_t *) obj->i2cTxRxBuffer,
obj->i2cTxRxBufferSize, I2C_LAST_FRAME);
#else
Expand All @@ -947,7 +948,8 @@ void HAL_I2C_AddrCallback(I2C_HandleTypeDef *hi2c, uint8_t TransferDirection, ui
obj->slaveMode = SLAVE_MODE_RECEIVE;
/* We don't know in advance how many bytes will be sent by master so
* we'll fetch one by one until master ends the sequence */
#if defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32L0xx) || defined(STM32L1xx)
#if defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) ||\
defined(STM32L0xx) || defined(STM32L1xx)
HAL_I2C_Slave_Seq_Receive_IT(hi2c, (uint8_t *) & (obj->i2cTxRxBuffer[obj->slaveRxNbData]),
1, I2C_NEXT_FRAME);
#else
Expand Down Expand Up @@ -998,7 +1000,8 @@ void HAL_I2C_SlaveRxCpltCallback(I2C_HandleTypeDef *hi2c)
}
/* Restart interrupt mode for next Byte */
if (obj->slaveMode == SLAVE_MODE_RECEIVE) {
#if defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32L0xx) || defined(STM32L1xx)
#if defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) ||\
defined(STM32L0xx) || defined(STM32L1xx)
HAL_I2C_Slave_Seq_Receive_IT(hi2c, (uint8_t *) & (obj->i2cTxRxBuffer[obj->slaveRxNbData]),
1, I2C_NEXT_FRAME);
#else
Expand Down
6 changes: 3 additions & 3 deletions cores/arduino/stm32/usb/cdc/usbd_cdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,9 @@ static uint8_t USBD_CDC_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
USBD_CDC_ItfTypeDef *ctrl = (USBD_CDC_ItfTypeDef *)pdev->pUserData;

if (pdev->pClassData != NULL) {
if ((hcdc->TxLastLength > 0U) && ((hcdc->TxLastLength % hpcd->IN_ep[epnum].maxpacket) == 0U)) {
if ((pdev->ep_in[epnum].total_length > 0U) && ((pdev->ep_in[epnum].total_length % hpcd->IN_ep[epnum].maxpacket) == 0U)) {
/* Update the packet total length */
hcdc->TxLastLength = 0U;
pdev->ep_in[epnum].total_length = 0U;

/* Send ZLP */
USBD_LL_Transmit(pdev, epnum, NULL, 0U);
Expand Down Expand Up @@ -835,7 +835,7 @@ uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev)
hcdc->TxState = 1U;

/* Update the packet total length */
hcdc->TxLastLength = hcdc->TxLength;
pdev->ep_in[CDC_IN_EP & 0xFU].total_length = hcdc->TxLength;

/* Transmit next packet */
USBD_LL_Transmit(pdev, CDC_IN_EP, hcdc->TxBuffer,
Expand Down
1 change: 0 additions & 1 deletion cores/arduino/stm32/usb/cdc/usbd_cdc.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ typedef struct {
uint8_t *TxBuffer;
uint32_t RxLength;
uint32_t TxLength;
uint32_t TxLastLength;

__IO uint32_t TxState;
__IO uint32_t RxState;
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/stm32/usb/usbd_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.st.com/SLA0044
* www.st.com/SLA0044
*
******************************************************************************
*/
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/stm32/usb/usbd_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.st.com/SLA0044
* www.st.com/SLA0044
*
******************************************************************************
*/
Expand Down
20 changes: 10 additions & 10 deletions cores/arduino/stm32/usb/usbd_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.st.com/SLA0044
* www.st.com/SLA0044
*
******************************************************************************
*/
Expand Down Expand Up @@ -272,9 +272,9 @@ static void Get_SerialNum(void)

deviceserial0 += deviceserial2;

if (deviceserial0 != 0) {
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
if (deviceserial0 != 0U) {
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8U);
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4U);
}
}

Expand All @@ -287,18 +287,18 @@ static void Get_SerialNum(void)
*/
static void IntToUnicode(uint32_t value, uint8_t *pbuf, uint8_t len)
{
uint8_t idx = 0;
uint8_t idx = 0U;

for (idx = 0 ; idx < len ; idx ++) {
if (((value >> 28)) < 0xA) {
pbuf[ 2 * idx] = (value >> 28) + '0';
for (idx = 0U ; idx < len ; idx ++) {
if (((value >> 28)) < 0xAU) {
pbuf[ 2U * idx] = (value >> 28) + '0';
} else {
pbuf[2 * idx] = (value >> 28) + 'A' - 10;
pbuf[2U * idx] = (value >> 28) + 'A' - 10U;
}

value = value << 4;

pbuf[ 2 * idx + 1] = 0;
pbuf[2U * idx + 1] = 0U;
}
}
#endif /* USBCON */
Expand Down
2 changes: 1 addition & 1 deletion cores/arduino/stm32/usb/usbd_desc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* This software component is licensed by ST under Ultimate Liberty license
* SLA0044, the "License"; You may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.st.com/SLA0044
* www.st.com/SLA0044
*
******************************************************************************
*/
Expand Down
Loading