mirror of https://github.com/ARMmbed/mbed-os.git
STM32 common filess astyle
parent
8b1cd98a8e
commit
c02cb71b35
|
@ -250,12 +250,12 @@ void USBPhyHw::init(USBPhyEvents *events)
|
|||
|
||||
__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
|
||||
|
||||
#ifdef __HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE
|
||||
#ifdef __HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE
|
||||
__HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE();
|
||||
#endif
|
||||
#ifdef __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE
|
||||
#endif
|
||||
#ifdef __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE
|
||||
__HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
map = PinMap_USB_HS;
|
||||
|
||||
|
@ -267,12 +267,12 @@ void USBPhyHw::init(USBPhyEvents *events)
|
|||
|
||||
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
|
||||
|
||||
#ifdef __HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE
|
||||
#ifdef __HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE
|
||||
__HAL_RCC_USB1_OTG_FS_ULPI_CLK_SLEEP_DISABLE();
|
||||
#endif
|
||||
#ifdef __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE
|
||||
#endif
|
||||
#ifdef __HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE
|
||||
__HAL_RCC_USB2_OTG_FS_ULPI_CLK_SLEEP_DISABLE();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
map = PinMap_USB_FS;
|
||||
|
||||
|
|
|
@ -142,13 +142,13 @@ static void _can_init_freq_direct(can_t *obj, const can_pinmap_t *pinmap, int hz
|
|||
// !When the sample point should be lower than 50%, this must be changed to
|
||||
// !IS_FDCAN_NOMINAL_TSEG2(ntq/nominalPrescaler), since
|
||||
// NTSEG2 and SJW max values are lower. For now the sample point is fix @75%
|
||||
while (!IS_FDCAN_NOMINAL_TSEG1(ntq/nominalPrescaler)){
|
||||
while (!IS_FDCAN_NOMINAL_TSEG1(ntq / nominalPrescaler)) {
|
||||
nominalPrescaler ++;
|
||||
if (!IS_FDCAN_NOMINAL_PRESCALER(nominalPrescaler)){
|
||||
if (!IS_FDCAN_NOMINAL_PRESCALER(nominalPrescaler)) {
|
||||
error("Could not determine good nominalPrescaler. Bad clock value\n");
|
||||
}
|
||||
}
|
||||
ntq = ntq/nominalPrescaler;
|
||||
ntq = ntq / nominalPrescaler;
|
||||
|
||||
obj->CanHandle.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
|
||||
obj->CanHandle.Init.Mode = FDCAN_MODE_NORMAL;
|
||||
|
@ -298,13 +298,13 @@ int can_frequency(can_t *obj, int f)
|
|||
// !When the sample point should be lower than 50%, this must be changed to
|
||||
// !IS_FDCAN_DATA_TSEG2(ntq/nominalPrescaler), since
|
||||
// NTSEG2 and SJW max values are lower. For now the sample point is fix @75%
|
||||
while (!IS_FDCAN_DATA_TSEG1(ntq/nominalPrescaler)){
|
||||
while (!IS_FDCAN_DATA_TSEG1(ntq / nominalPrescaler)) {
|
||||
nominalPrescaler ++;
|
||||
if (!IS_FDCAN_NOMINAL_PRESCALER(nominalPrescaler)){
|
||||
if (!IS_FDCAN_NOMINAL_PRESCALER(nominalPrescaler)) {
|
||||
error("Could not determine good nominalPrescaler. Bad clock value\n");
|
||||
}
|
||||
}
|
||||
ntq = ntq/nominalPrescaler;
|
||||
ntq = ntq / nominalPrescaler;
|
||||
|
||||
obj->CanHandle.Init.NominalPrescaler = nominalPrescaler;
|
||||
obj->CanHandle.Init.NominalTimeSeg1 = ntq * 0.75; // Phase_segment_1
|
||||
|
@ -1126,8 +1126,7 @@ int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t
|
|||
sFilterConfig.FilterActivation = ENABLE;
|
||||
sFilterConfig.BankNumber = 14;
|
||||
|
||||
if (HAL_CAN_ConfigFilter(&obj->CanHandle, &sFilterConfig) == HAL_OK)
|
||||
{
|
||||
if (HAL_CAN_ConfigFilter(&obj->CanHandle, &sFilterConfig) == HAL_OK) {
|
||||
success = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ void lp_ticker_init(void)
|
|||
|
||||
#if (LPTIM_MST_BASE == LPTIM1_BASE)
|
||||
#if defined (__HAL_LPTIM_LPTIM1_EXTI_ENABLE_IT)
|
||||
__HAL_LPTIM_LPTIM1_EXTI_ENABLE_IT();
|
||||
__HAL_LPTIM_LPTIM1_EXTI_ENABLE_IT();
|
||||
#endif
|
||||
#endif
|
||||
#if defined (__HAL_LPTIM_WAKEUPTIMER_EXTI_ENABLE_IT)
|
||||
|
|
|
@ -41,7 +41,7 @@ extern void SetSysClock(void);
|
|||
|
||||
/**
|
||||
* @brief configure the LSE crystal driver load
|
||||
* This settings ist target hardware dependend and
|
||||
* This setting is target hardware dependend and
|
||||
* depends on the crystal that is used for LSE clock.
|
||||
* For low power requirements, crystals with low load capacitors can be used and
|
||||
* driver setting is RCC_LSEDRIVE_LOW.
|
||||
|
@ -58,13 +58,14 @@ extern void SetSysClock(void);
|
|||
* @retval None
|
||||
*/
|
||||
|
||||
static void LSEDriveConfig(void) {
|
||||
static void LSEDriveConfig(void)
|
||||
{
|
||||
HAL_PWR_EnableBkUpAccess();
|
||||
#if defined(__HAL_RCC_LSEDRIVE_CONFIG)
|
||||
#if defined(__HAL_RCC_LSEDRIVE_CONFIG)
|
||||
__HAL_RCC_LSEDRIVE_CONFIG(LSE_DRIVE_LOAD_LEVEL);
|
||||
#else
|
||||
#else
|
||||
HAL_RCCEx_SelectLSEMode(LSE_DRIVE_LOAD_LEVEL);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif // LSE_CONFIG_AVAILABLE
|
||||
|
||||
|
@ -79,13 +80,15 @@ static void LSEDriveConfig(void) {
|
|||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
MBED_WEAK void TargetBSP_Init(void) {
|
||||
MBED_WEAK void TargetBSP_Init(void)
|
||||
{
|
||||
/** Do nothing */
|
||||
}
|
||||
|
||||
#ifndef MBED_DEBUG
|
||||
#if MBED_CONF_TARGET_GPIO_RESET_AT_INIT
|
||||
void GPIO_Full_Init(void) {
|
||||
void GPIO_Full_Init(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_All;
|
||||
|
@ -238,7 +241,7 @@ void mbed_sdk_init()
|
|||
#if IS_PWR_SUPPLY(MBED_CONF_TARGET_SYSTEM_POWER_SUPPLY)
|
||||
HAL_PWREx_ConfigSupply(MBED_CONF_TARGET_SYSTEM_POWER_SUPPLY);
|
||||
#else
|
||||
#error system_power_supply not configured
|
||||
#error system_power_supply not configured
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -276,7 +279,7 @@ void mbed_sdk_init()
|
|||
#if IS_PWR_SUPPLY(MBED_CONF_TARGET_SYSTEM_POWER_SUPPLY)
|
||||
HAL_PWREx_ConfigSupply(MBED_CONF_TARGET_SYSTEM_POWER_SUPPLY);
|
||||
#else
|
||||
#error system_power_supply not configured
|
||||
#error system_power_supply not configured
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -290,8 +293,7 @@ void mbed_sdk_init()
|
|||
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
|
||||
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
|
||||
PeriphClkInitStruct.RTCClockSelection = (RCC_RTCCLKSOURCE_HSE_DIVX | RTC_HSE_DIV << 16);
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
|
||||
{
|
||||
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
|
||||
error("PeriphClkInitStruct RTC failed with HSE\n");
|
||||
}
|
||||
#elif ((MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_LSE_OR_LSI) && !MBED_CONF_TARGET_LSE_AVAILABLE) || (MBED_CONF_TARGET_RTC_CLOCK_SOURCE == USE_RTC_CLK_LSI)
|
||||
|
|
|
@ -87,14 +87,14 @@ ospi_status_t ospi_prepare_command(const ospi_command_t *command, OSPI_RegularCm
|
|||
}
|
||||
|
||||
st_command->InstructionSize = (st_command->InstructionMode == HAL_OSPI_INSTRUCTION_8_LINES) ? HAL_OSPI_INSTRUCTION_16_BITS : HAL_OSPI_INSTRUCTION_8_BITS;
|
||||
st_command->InstructionDtrMode = (command->instruction.bus_width == OSPI_CFG_BUS_OCTA_DTR) ? HAL_OSPI_INSTRUCTION_DTR_ENABLE :HAL_OSPI_INSTRUCTION_DTR_DISABLE;
|
||||
st_command->InstructionDtrMode = (command->instruction.bus_width == OSPI_CFG_BUS_OCTA_DTR) ? HAL_OSPI_INSTRUCTION_DTR_ENABLE : HAL_OSPI_INSTRUCTION_DTR_DISABLE;
|
||||
st_command->DummyCycles = command->dummy_count;
|
||||
// these are target specific settings, use default values
|
||||
st_command->SIOOMode = HAL_OSPI_SIOO_INST_EVERY_CMD;
|
||||
st_command->DataDtrMode = (command->instruction.bus_width == OSPI_CFG_BUS_OCTA_DTR) ? HAL_OSPI_DATA_DTR_ENABLE : HAL_OSPI_DATA_DTR_DISABLE;
|
||||
st_command->AddressDtrMode = (command->instruction.bus_width == OSPI_CFG_BUS_OCTA_DTR) ? HAL_OSPI_ADDRESS_DTR_ENABLE : HAL_OSPI_ADDRESS_DTR_DISABLE;
|
||||
st_command->AlternateBytesDtrMode = (command->instruction.bus_width == OSPI_CFG_BUS_OCTA_DTR) ? HAL_OSPI_ALTERNATE_BYTES_DTR_ENABLE : HAL_OSPI_ALTERNATE_BYTES_DTR_DISABLE;
|
||||
st_command->DQSMode = (command->instruction.bus_width == OSPI_CFG_BUS_OCTA_DTR) ? HAL_OSPI_DQS_ENABLE :HAL_OSPI_DQS_DISABLE;
|
||||
st_command->DQSMode = (command->instruction.bus_width == OSPI_CFG_BUS_OCTA_DTR) ? HAL_OSPI_DQS_ENABLE : HAL_OSPI_DQS_DISABLE;
|
||||
|
||||
st_command->OperationType = HAL_OSPI_OPTYPE_COMMON_CFG;
|
||||
if (command->address.disabled == true) {
|
||||
|
@ -245,7 +245,7 @@ static ospi_status_t _ospi_init_direct(ospi_t *obj, const ospi_pinmap_t *pinmap,
|
|||
// Set default OCTOSPI handle values
|
||||
obj->handle.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
|
||||
//#if defined(TARGET_MX25LM512451G)
|
||||
// obj->handle.Init.MemoryType = HAL_OSPI_MEMTYPE_MACRONIX; // Read sequence in DTR mode: D1-D0-D3-D2
|
||||
// obj->handle.Init.MemoryType = HAL_OSPI_MEMTYPE_MACRONIX; // Read sequence in DTR mode: D1-D0-D3-D2
|
||||
//#else
|
||||
obj->handle.Init.MemoryType = HAL_OSPI_MEMTYPE_MICRON; // Read sequence in DTR mode: D0-D1-D2-D3
|
||||
//#endif
|
||||
|
@ -404,7 +404,8 @@ ospi_status_t ospi_init(ospi_t *obj, PinName io0, PinName io1, PinName io2, PinN
|
|||
|
||||
const ospi_pinmap_t static_pinmap = {peripheral, io0, function_io0, io1, function_io1, io2, function_io2, io3, function_io3,
|
||||
io4, function_io4, io5, function_io5, io6, function_io6, io7, function_io7,
|
||||
sclk, function_sclk, ssel, function_ssel, dqs, function_dqs};
|
||||
sclk, function_sclk, ssel, function_ssel, dqs, function_dqs
|
||||
};
|
||||
|
||||
return OSPI_INIT_DIRECT(obj, &static_pinmap, hz, mode);
|
||||
}
|
||||
|
|
|
@ -354,10 +354,10 @@ void serial_free(serial_t *obj)
|
|||
pin_function(obj_s->pin_tx, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
|
||||
pin_function(obj_s->pin_rx, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
|
||||
#if DEVICE_SERIAL_FC
|
||||
if ( (obj_s->hw_flow_ctl == UART_HWCONTROL_RTS) || (obj_s->hw_flow_ctl == UART_HWCONTROL_RTS_CTS) ) {
|
||||
if ((obj_s->hw_flow_ctl == UART_HWCONTROL_RTS) || (obj_s->hw_flow_ctl == UART_HWCONTROL_RTS_CTS)) {
|
||||
pin_function(obj_s->pin_rts, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
|
||||
}
|
||||
if ( (obj_s->hw_flow_ctl == UART_HWCONTROL_CTS) || (obj_s->hw_flow_ctl == UART_HWCONTROL_RTS_CTS) ) {
|
||||
if ((obj_s->hw_flow_ctl == UART_HWCONTROL_CTS) || (obj_s->hw_flow_ctl == UART_HWCONTROL_RTS_CTS)) {
|
||||
pin_function(obj_s->pin_cts, STM_PIN_DATA(STM_MODE_ANALOG, GPIO_NOPULL, 0));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -667,7 +667,8 @@ static inline int ssp_busy(spi_t *obj)
|
|||
return status;
|
||||
}
|
||||
|
||||
static inline int datasize_to_transfer_bitshift(uint32_t DataSize) {
|
||||
static inline int datasize_to_transfer_bitshift(uint32_t DataSize)
|
||||
{
|
||||
switch (DataSize) {
|
||||
#if defined(SPI_DATASIZE_4BIT)
|
||||
case SPI_DATASIZE_4BIT:
|
||||
|
|
Loading…
Reference in New Issue