mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 23:10:22 +00:00
2f3ea9494e
* gpio, hsem, crypto: switch from HAL to LL/registers * Moved GPIO initialization to furi_hal * More HAL removed * All HAL modules disabled * HAL is finally removed * hal_gpio -> furi_hal_gpio, main.h removed * Bootloader build fix * RTOS config moved to freertos-glue * delay -> furi_hal_delay Co-authored-by: あく <alleteam@gmail.com>
25 lines
844 B
C
25 lines
844 B
C
#include "furi_hal_sd.h"
|
|
#include <stm32wbxx_ll_gpio.h>
|
|
#include <furi.h>
|
|
#include <furi_hal.h>
|
|
|
|
void hal_sd_detect_init(void) {
|
|
// low speed input with pullup
|
|
LL_GPIO_SetPinMode(SD_CD_GPIO_Port, SD_CD_Pin, LL_GPIO_MODE_INPUT);
|
|
LL_GPIO_SetPinSpeed(SD_CD_GPIO_Port, SD_CD_Pin, LL_GPIO_SPEED_FREQ_LOW);
|
|
LL_GPIO_SetPinPull(SD_CD_GPIO_Port, SD_CD_Pin, LL_GPIO_PULL_UP);
|
|
}
|
|
|
|
void hal_sd_detect_set_low(void) {
|
|
// low speed input with pullup
|
|
LL_GPIO_SetPinMode(SD_CD_GPIO_Port, SD_CD_Pin, LL_GPIO_MODE_OUTPUT);
|
|
LL_GPIO_SetPinOutputType(SD_CD_GPIO_Port, SD_CD_Pin, LL_GPIO_OUTPUT_OPENDRAIN);
|
|
LL_GPIO_ResetOutputPin(SD_CD_GPIO_Port, SD_CD_Pin);
|
|
}
|
|
|
|
bool hal_sd_detect(void) {
|
|
bool result = !(LL_GPIO_IsInputPinSet(SD_CD_GPIO_Port, SD_CD_Pin));
|
|
return result;
|
|
}
|
|
|
|
FuriHalSpiBusHandle* furi_hal_sd_spi_handle = NULL;
|