mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 05:45:31 +03:00
Move SDCard SPI clock dividers into target.h (they depend on the bus Hz)
This commit is contained in:
parent
96182c7c07
commit
04d8dd27bf
2 changed files with 6 additions and 2 deletions
|
@ -1181,7 +1181,7 @@ static bool sdcard_completeInit()
|
||||||
DESELECT_SDCARD;
|
DESELECT_SDCARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
spiSetDivisor(SDCARD_SPI_INSTANCE, 4);
|
spiSetDivisor(SDCARD_SPI_INSTANCE, SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER);
|
||||||
|
|
||||||
sdcard.state = SDCARD_STATE_READY;
|
sdcard.state = SDCARD_STATE_READY;
|
||||||
|
|
||||||
|
@ -1211,7 +1211,7 @@ static bool sdcard_checkInitDone() {
|
||||||
bool sdcard_init()
|
bool sdcard_init()
|
||||||
{
|
{
|
||||||
// Max frequency is initially 400kHz
|
// Max frequency is initially 400kHz
|
||||||
spiSetDivisor(SDCARD_SPI_INSTANCE, 128);
|
spiSetDivisor(SDCARD_SPI_INSTANCE, SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER);
|
||||||
|
|
||||||
// SDCard wants 1ms minimum delay after power is applied to it
|
// SDCard wants 1ms minimum delay after power is applied to it
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
|
@ -100,6 +100,10 @@
|
||||||
#define SDCARD_SPI_CS_GPIO GPIOB
|
#define SDCARD_SPI_CS_GPIO GPIOB
|
||||||
#define SDCARD_SPI_CS_PIN GPIO_Pin_12
|
#define SDCARD_SPI_CS_PIN GPIO_Pin_12
|
||||||
#define SDCARD_SPI_CS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOB
|
#define SDCARD_SPI_CS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOB
|
||||||
|
// SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
|
||||||
|
#define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
|
||||||
|
// Divide to under 25MHz for normal operation:
|
||||||
|
#define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 2
|
||||||
|
|
||||||
#define ACC
|
#define ACC
|
||||||
#define USE_ACC_LSM303DLHC
|
#define USE_ACC_LSM303DLHC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue