* API HAL SPI: refactoring, split into layers, prepare ST HAL separation. API HAL SubGhz: initialize on start. Drivers: add basic cc1101 driver. Update API usage. Debug: increase max debugger port speed. Remove subghz apps. * CC1101: chip status handling. ApiHalSpi: increase SubGhz bus speed to 8mhz. F4: backport subghz initialization. * Api Hal SubGhz: rx path and frequency. CC1101: frequency control. * SubGhz Application: basic tests * SubGhz app: tone and packet test. API HAL SUBGHZ: update configs, add missing bits and pieces.
		
			
				
	
	
		
			36 lines
		
	
	
		
			871 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			871 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include <api-hal-sd.h>
 | 
						|
#include <api-hal-spi.h>
 | 
						|
#include <api-hal-resources.h>
 | 
						|
#include <api-hal-delay.h>
 | 
						|
#include <furi.h>
 | 
						|
 | 
						|
void hal_sd_detect_init(void) {
 | 
						|
    // nothing to do
 | 
						|
}
 | 
						|
 | 
						|
void hal_sd_detect_set_low(void) {
 | 
						|
    // nothing to do
 | 
						|
}
 | 
						|
 | 
						|
bool hal_sd_detect(void) {
 | 
						|
    bool result = false;
 | 
						|
 | 
						|
    // TODO open record
 | 
						|
    const ApiHalSpiDevice* device = api_hal_spi_device_get(ApiHalSpiDeviceIdSdCard);
 | 
						|
 | 
						|
    // configure pin as input
 | 
						|
    gpio_init_ex(device->chip_select, GpioModeInput, GpioPullUp, GpioSpeedVeryHigh);
 | 
						|
    delay(1);
 | 
						|
 | 
						|
    // if gpio_read == 0 return true else return false
 | 
						|
    result = !gpio_read(device->chip_select);
 | 
						|
 | 
						|
    // configure pin back
 | 
						|
    gpio_init_ex(device->chip_select, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh);
 | 
						|
    gpio_write(device->chip_select, 1);
 | 
						|
    delay(1);
 | 
						|
 | 
						|
    api_hal_spi_device_return(device);
 | 
						|
 | 
						|
    return result;
 | 
						|
} |