Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/stable_18.2.x' into stab…
Browse files Browse the repository at this point in the history
…le_18.2.rusefi
  • Loading branch information
rusefillc committed Mar 21, 2019
2 parents 128405f + 0b5e6bb commit 0ddc96c
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 170 deletions.
2 changes: 2 additions & 0 deletions demos/STM32/RT-STM32F303-DISCOVERY/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ int main(void) {
* Activates the serial driver 1 using the driver default configuration.
*/
sdStart(&SD1, NULL);
palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7)); /* USART1 TX. */
palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7)); /* USART1 RX. */

/*
* Creates the example threads.
Expand Down
2 changes: 1 addition & 1 deletion os/common/oslib/include/chfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ extern "C" {
* @param[in] objalign required objects alignment
* @param[in] objbuf pointer to the buffer of objects, it must be able
* to hold @p objn objects of @p objsize size with
* @p objealign alignment
* @p objalign alignment
* @param[in] msgbuf pointer to the buffer of messages, it must be able
* to hold @p objn messages
*
Expand Down
14 changes: 4 additions & 10 deletions os/ex/ST/hts221.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,10 @@ static msg_t hts221Calibrate(HTS221Driver *devp) {
uint8_t calib[16], H0_rH_x2, H1_rH_x2, msb;
int16_t H0_T0_OUT, H1_T0_OUT, T0_degC_x8, T1_degC_x8, T0_OUT, T1_OUT;

#if HTS221_SHARED_I2C
i2cAcquireBus(devp->config->i2cp);
i2cStart(devp->config->i2cp, devp->config->i2ccfg);
#endif /* HTS221_SHARED_I2C */

/* Retrieving rH values from Calibration registers */
msg = hts221I2CReadRegister(devp->config->i2cp,
HTS221_AD_CALIB_0, calib, 16);

#if HTS221_SHARED_I2C
i2cReleaseBus(devp->config->i2cp);
#endif /* HTS221_SHARED_I2C */

H0_rH_x2 = calib[0];
H1_rH_x2 = calib[1];
H0_T0_OUT = calib[6];
Expand Down Expand Up @@ -666,13 +657,16 @@ void hts221Start(HTS221Driver *devp, const HTS221Config *config) {
i2cAcquireBus(devp->config->i2cp);
#endif /* HTS221_SHARED_I2C */

/* Intializing the I2C. */
i2cStart(devp->config->i2cp, devp->config->i2ccfg);

hts221Calibrate(devp);

#if HTS221_SHARED_I2C
i2cReleaseBus(devp->config->i2cp);
i2cReleaseBus(devp->config->i2cp);
#endif /* HTS221_SHARED_I2C */


if(devp->config->hygrosensitivity == NULL) {
devp->hygrosensitivity = devp->hygrofactorysensitivity;
}
Expand Down
4 changes: 2 additions & 2 deletions os/ex/ST/hts221.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
/**
* @brief HTS221 driver version string.
*/
#define EX_HTS221_VERSION "1.1.1"
#define EX_HTS221_VERSION "1.1.2"

/**
* @brief HTS221 driver version major number.
Expand All @@ -59,7 +59,7 @@
/**
* @brief HTS221 driver version patch number.
*/
#define EX_HTS221_PATCH 1
#define EX_HTS221_PATCH 2
/** @} */

/**
Expand Down
2 changes: 1 addition & 1 deletion os/hal/ports/STM32/LLD/ADCv3/hal_adc_lld.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ void adc_lld_init(void) {
#if defined(ADC3_4_COMMON)
ADCD3.adcc = ADC3_4_COMMON;
#elif defined(ADC123_COMMON)
ADCD1.adcc = ADC123_COMMON;
ADCD3.adcc = ADC123_COMMON;
#else
ADCD3.adcc = ADC3_COMMON;
#endif
Expand Down
36 changes: 36 additions & 0 deletions os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
#endif

#if STM32_ST_USE_TIMER == 2
#if !STM32_HAS_TIM2
#error "TIM2 not present in the selected device"
#endif
#if defined(STM32_TIM2_IS_USED)
#error "ST requires TIM2 but the timer is already used"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM2_IS_32BITS
#error "TIM2 is not a 32bits timer"
#endif
Expand All @@ -58,6 +64,12 @@
#endif

#elif STM32_ST_USE_TIMER == 3
#if !STM32_HAS_TIM3
#error "TIM3 not present in the selected device"
#endif
#if defined(STM32_TIM3_IS_USED)
#error "ST requires TIM3 but the timer is already used"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM3_IS_32BITS
#error "TIM3 is not a 32bits timer"
#endif
Expand All @@ -77,6 +89,12 @@
#endif

#elif STM32_ST_USE_TIMER == 4
#if !STM32_HAS_TIM4
#error "TIM4 not present in the selected device"
#endif
#if defined(STM32_TIM4_IS_USED)
#error "ST requires TIM4 but the timer is already used"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM4_IS_32BITS
#error "TIM4 is not a 32bits timer"
#endif
Expand All @@ -96,6 +114,12 @@
#endif

#elif STM32_ST_USE_TIMER == 5
#if !STM32_HAS_TIM5
#error "TIM5 not present in the selected device"
#endif
#if defined(STM32_TIM5_IS_USED)
#error "ST requires TIM5 but the timer is already used"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM5_IS_32BITS
#error "TIM5 is not a 32bits timer"
#endif
Expand All @@ -115,6 +139,12 @@
#endif

#elif STM32_ST_USE_TIMER == 21
#if !STM32_HAS_TIM21
#error "TIM21 not present in the selected device"
#endif
#if defined(STM32_TIM21_IS_USED)
#error "ST requires TIM21 but the timer is already used"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM21_IS_32BITS
#error "TIM21 is not a 32bits timer"
#endif
Expand All @@ -126,6 +156,12 @@
#define ST_ENABLE_STOP() DBGMCU->APB1FZ |= DBGMCU_APB2_FZ_DBG_TIM21_STOP

#elif STM32_ST_USE_TIMER == 22
#if !STM32_HAS_TIM22
#error "TIM22 not present in the selected device"
#endif
#if defined(STM32_TIM22_IS_USED)
#error "ST requires TIM22 but the timer is already used"
#endif
#if (OSAL_ST_RESOLUTION == 32) && !STM32_TIM22_IS_32BITS
#error "TIM21 is not a 32bits timer"
#endif
Expand Down
78 changes: 27 additions & 51 deletions os/hal/ports/STM32/LLD/TIMv1/hal_st_lld.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,71 +65,47 @@
/* Derived constants and error checks. */
/*===========================================================================*/

#if STM32_ST_USE_TIMER == 2
#if !STM32_HAS_TIM2
#error "TIM2 not present in the selected device"
#if !defined(STM32_HAS_TIM2)
#define STM32_HAS_TIM2 FALSE
#endif
#if defined(STM32_TIM2_IS_USED) && (CH_CFG_ST_TIMEDELTA > 0)
#error "ST requires TIM2 but the timer is already used"
#else
#define STM32_TIM2_IS_USED

#if !defined(STM32_HAS_TIM3)
#define STM32_HAS_TIM3 FALSE
#endif
#define STM32_ST_TIM STM32_TIM2

#elif STM32_ST_USE_TIMER == 3
#if !STM32_HAS_TIM3
#error "TIM3 not present in the selected device"
#if !defined(STM32_HAS_TIM4)
#define STM32_HAS_TIM4 FALSE
#endif
#if defined(STM32_TIM3_IS_USED)
#error "ST requires TIM3 but the timer is already used"
#else
#define STM32_TIM3_IS_USED

#if !defined(STM32_HAS_TIM5)
#define STM32_HAS_TIM5 FALSE
#endif
#define STM32_ST_TIM STM32_TIM3

#elif STM32_ST_USE_TIMER == 4
#if !STM32_HAS_TIM4
#error "TIM4 not present in the selected device"
#if !defined(STM32_HAS_TIM21)
#define STM32_HAS_TIM21 FALSE
#endif
#if defined(STM32_TIM4_IS_USED)
#error "ST requires TIM4 but the timer is already used"
#else
#define STM32_TIM4_IS_USED

#if !defined(STM32_HAS_TIM22)
#define STM32_HAS_TIM22 FALSE
#endif
#define STM32_ST_TIM STM32_TIM4

#if STM32_ST_USE_TIMER == 2
#define STM32_ST_TIM STM32_TIM2

#elif STM32_ST_USE_TIMER == 3
#define STM32_ST_TIM STM32_TIM3

#elif STM32_ST_USE_TIMER == 4
#define STM32_ST_TIM STM32_TIM4

#elif STM32_ST_USE_TIMER == 5
#if !STM32_HAS_TIM5
#error "TIM5 not present in the selected device"
#endif
#if defined(STM32_TIM5_IS_USED)
#error "ST requires TIM5 but the timer is already used"
#else
#define STM32_TIM5_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM5
#define STM32_ST_TIM STM32_TIM5

#elif STM32_ST_USE_TIMER == 21
#if !STM32_HAS_TIM21
#error "TIM21 not present in the selected device"
#endif
#if defined(STM32_TIM21_IS_USED)
#error "ST requires TIM21 but the timer is already used"
#else
#define STM32_TIM21_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM21
#define STM32_ST_TIM STM32_TIM21

#elif STM32_ST_USE_TIMER == 22
#if !STM32_HAS_TIM22
#error "TIM22 not present in the selected device"
#endif
#if defined(STM32_TIM22_IS_USED)
#error "ST requires TIM22 but the timer is already used"
#else
#define STM32_TIM22_IS_USED
#endif
#define STM32_ST_TIM STM32_TIM22
#define STM32_ST_TIM STM32_TIM22

#else
#error "STM32_ST_USE_TIMER specifies an unsupported timer"
Expand Down
2 changes: 1 addition & 1 deletion os/hal/ports/STM32/STM32H7xx/hal_lld.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void stm32_clock_init(void) {
/* Fix for errata 2.2.15: Reading from AXI SRAM might lead to data
read corruption.
AXI->TARG7_FN_MOD.*/
*((volatile uint32_t *)0x51000000 + 0x1108 + 0x7000) = 0x00000001U;
*((volatile uint32_t *)(0x51000000 + 0x1108 + 0x7000)) = 0x00000001U;
#endif

/* PWR initialization.*/
Expand Down
54 changes: 27 additions & 27 deletions os/hal/ports/STM32/STM32H7xx/hal_lld.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,9 @@
#define STM32_SAI4ASEL_PER_CK RCC_D3CCIPR_SAI4ASEL_VALUE(4U)

#define STM32_ADCSEL_PLL2_P_CK RCC_D3CCIPR_ADCSEL_VALUE(0U)
#define STM32_ADCSEL_PLL3_R_CK RCC_D3CCIPR_ADCSEL_VALUE(0U)
#define STM32_ADCSEL_PER_CK RCC_D3CCIPR_ADCSEL_VALUE(0U)
#define STM32_ADCSEL_DISABLE RCC_D3CCIPR_ADCSEL_VALUE(0U)
#define STM32_ADCSEL_PLL3_R_CK RCC_D3CCIPR_ADCSEL_VALUE(1U)
#define STM32_ADCSEL_PER_CK RCC_D3CCIPR_ADCSEL_VALUE(2U)
#define STM32_ADCSEL_DISABLE RCC_D3CCIPR_ADCSEL_VALUE(3U)

#define STM32_LPTIM345SEL_PCLK4 RCC_D3CCIPR_LPTIM345SEL_VALUE(0U)
#define STM32_LPTIM345SEL_PLL2_P_CK RCC_D3CCIPR_LPTIM345SEL_VALUE(1U)
Expand Down Expand Up @@ -2427,58 +2427,58 @@
/**
* @brief USART4 clock.
*/
#define STM32_USART4CLK STM32_PCLK1
#define STM32_UART4CLK STM32_PCLK1

/**
* @brief USART5 clock.
*/
#define STM32_USART5CLK STM32_PCLK1
#define STM32_UART5CLK STM32_PCLK1

/**
* @brief USART7 clock.
*/
#define STM32_USART7CLK STM32_PCLK1
#define STM32_UART7CLK STM32_PCLK1

/**
* @brief USART8 clock.
*/
#define STM32_USART8CLK STM32_PCLK2
#define STM32_UART8CLK STM32_PCLK1

#elif STM32_USART234578SEL == STM32_USART234578SEL_PLL2_Q_CK
#define STM32_USART2CLK STM32_PLL2_Q_CK
#define STM32_USART3CLK STM32_PLL2_Q_CK
#define STM32_USART4CLK STM32_PLL2_Q_CK
#define STM32_USART5CLK STM32_PLL2_Q_CK
#define STM32_USART7CLK STM32_PLL2_Q_CK
#define STM32_USART8CLK STM32_PLL2_Q_CK
#define STM32_UART4CLK STM32_PLL2_Q_CK
#define STM32_UART5CLK STM32_PLL2_Q_CK
#define STM32_UART7CLK STM32_PLL2_Q_CK
#define STM32_UART8CLK STM32_PLL2_Q_CK
#elif STM32_USART234578SEL == STM32_USART234578SEL_PLL3_Q_CK
#define STM32_USART2CLK STM32_PLL3_Q_CK
#define STM32_USART3CLK STM32_PLL3_Q_CK
#define STM32_USART4CLK STM32_PLL3_Q_CK
#define STM32_USART5CLK STM32_PLL3_Q_CK
#define STM32_USART7CLK STM32_PLL3_Q_CK
#define STM32_USART8CLK STM32_PLL3_Q_CK
#define STM32_UART4CLK STM32_PLL3_Q_CK
#define STM32_UART5CLK STM32_PLL3_Q_CK
#define STM32_UART7CLK STM32_PLL3_Q_CK
#define STM32_UART8CLK STM32_PLL3_Q_CK
#elif STM32_USART234578SEL == STM32_USART234578SEL_HSI_KER_CK
#define STM32_USART2CLK STM32_HSI_CK
#define STM32_USART3CLK STM32_HSI_CK
#define STM32_USART4CLK STM32_HSI_CK
#define STM32_USART5CLK STM32_HSI_CK
#define STM32_USART7CLK STM32_HSI_CK
#define STM32_USART8CLK STM32_HSI_CK
#define STM32_UART4CLK STM32_HSI_CK
#define STM32_UART5CLK STM32_HSI_CK
#define STM32_UART7CLK STM32_HSI_CK
#define STM32_UART8CLK STM32_HSI_CK
#elif STM32_USART234578SEL == STM32_USART234578SEL_CSI_KER_CK
#define STM32_USART2CLK STM32_CSI_CK
#define STM32_USART3CLK STM32_CSI_CK
#define STM32_USART4CLK STM32_CSI_CK
#define STM32_USART5CLK STM32_CSI_CK
#define STM32_USART7CLK STM32_CSI_CK
#define STM32_USART8CLK STM32_CSI_CK
#define STM32_UART4CLK STM32_CSI_CK
#define STM32_UART5CLK STM32_CSI_CK
#define STM32_UART7CLK STM32_CSI_CK
#define STM32_UART8CLK STM32_CSI_CK
#elif STM32_USART234578SEL == STM32_USART234578SEL_LSE_CK
#define STM32_USART2CLK STM32_LSE_CK
#define STM32_USART3CLK STM32_LSE_CK
#define STM32_USART4CLK STM32_LSE_CK
#define STM32_USART6CLK STM32_LSE_CK
#define STM32_USART7CLK STM32_LSE_CK
#define STM32_USART8CLK STM32_LSE_CK
#define STM32_UART4CLK STM32_LSE_CK
#define STM32_UART6CLK STM32_LSE_CK
#define STM32_UART7CLK STM32_LSE_CK
#define STM32_UART8CLK STM32_LSE_CK
#else
#error "invalid source selected for STM32_USART234578SEL clock"
#endif
Expand Down
2 changes: 1 addition & 1 deletion os/nil/include/ch.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@

#if (CH_LICENSE_FEATURES != CH_FEATURES_FULL) && \
(CH_LICENSE_FEATURES != CH_FEATURES_INTERMEDIATE) && \
(CH_LICENSE_FEATURES == CH_FEATURES_BASIC)
(CH_LICENSE_FEATURES != CH_FEATURES_BASIC)
#error "invalid CH_LICENSE_FEATURES setting"
#endif

Expand Down
Loading

0 comments on commit 0ddc96c

Please sign in to comment.