* Outdated apps: add api-light-usage * Gpio: update SD card CS pin settings * API-power: added fns to disable/enable external 3v3 dc-dc * API-gpio: separated SD card detect routines * Resources: removed sd cs pin * SD card: low level init now resets card power supply * App SD-filesystem: use new card detect fns * SD card: fix low level init headers * SD card: more realilable low level init, power reset, exit from command read cycle conditionally * App SD-filesystem: led notifiers, init cycling * SD card: backport to F4 * SD card: handle eject in init sequence * SD card: api to set level on detect gpio * SPI: api to set state on bus pins * SD card: set low state on bus pins while power reset Co-authored-by: coreglitch <mail@s3f.ru>
		
			
				
	
	
		
			22 lines
		
	
	
		
			767 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			767 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include "api-hal-sd.h"
 | 
						|
#include <stm32wbxx_ll_gpio.h>
 | 
						|
#include <furi.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;
 | 
						|
} |