mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[chibios] Make compatible with STM32F1 chips
This commit is contained in:
@@ -90,18 +90,13 @@ bool recovering_from_hard_fault;
|
||||
|
||||
/*
|
||||
* SCB_VTOR has to be relocated if Luftboot is used
|
||||
* The new SCB_VTOR location is defined in the board makefile
|
||||
*/
|
||||
void mcu_arch_init(void)
|
||||
{
|
||||
#if LUFTBOOT
|
||||
PRINT_CONFIG_MSG("We are running luftboot, the interrupt vector is being relocated.")
|
||||
#if defined STM32F4
|
||||
PRINT_CONFIG_MSG("STM32F4")
|
||||
SCB->VTOR = 0x00004000;
|
||||
#else
|
||||
PRINT_CONFIG_MSG("STM32F1")
|
||||
SCB->VTOR = 0x00002000;
|
||||
#endif
|
||||
SCB->VTOR = CORTEX_VTOR_INIT;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -61,7 +61,18 @@ void gpio_setup_input_pulldown(ioportid_t port, uint16_t gpios)
|
||||
void gpio_setup_pin_af(ioportid_t port, uint16_t pin, uint8_t af)
|
||||
{
|
||||
chSysLock();
|
||||
// architecture dependent settings
|
||||
#if defined(__STM32F10x_H) || defined(__STM32F105xC_H) || defined (__STM32F107xC_H)
|
||||
// STM32F1xx
|
||||
// FIXME: STM32F1xx doesn't support several alternate modes, is it needed for drivers?
|
||||
(void)port;
|
||||
(void)pin;
|
||||
(void)af;
|
||||
#elif defined(__STM32F4xx_H)
|
||||
// STM32F4xx
|
||||
palSetPadMode(port, pin, PAL_MODE_ALTERNATE(af));
|
||||
#endif // STM32F1xx vs STM32F4xx
|
||||
|
||||
chSysUnlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ static inline uint16_t spi_resolve_slave_pin(uint8_t slave)
|
||||
static inline uint16_t spi_resolve_CR1(struct spi_transaction *t)
|
||||
{
|
||||
uint16_t CR1 = 0;
|
||||
#if defined(__STM32F10x_H) || defined(__STM32F4xx_H)
|
||||
#if defined(__STM32F10x_H) || defined(__STM32F105xC_H) || defined (__STM32F107xC_H) || defined(__STM32F4xx_H)
|
||||
if (t->dss == SPIDss16bit) {
|
||||
CR1 |= SPI_CR1_DFF;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ static inline uint16_t spi_resolve_CR1(struct spi_transaction *t)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif /* STM32F10x_H || STM32F4xx_H */
|
||||
#endif /* __STM32F10x_H || __STM32F105xC_H || __STM32F107xC_H || STM32F4xx_H */
|
||||
return CR1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user