Merge remote-tracking branch 'ofw/dev' into mntm-dev

This commit is contained in:
Willy-JL
2024-10-14 23:44:44 +01:00
167 changed files with 6280 additions and 2155 deletions

View File

@@ -288,3 +288,19 @@ int32_t furi_hal_resources_get_ext_pin_number(const GpioPin* gpio) {
}
return -1;
}
const GpioPinRecord* furi_hal_resources_pin_by_name(const char* name) {
for(size_t i = 0; i < gpio_pins_count; i++) {
const GpioPinRecord* record = &gpio_pins[i];
if(strcasecmp(name, record->name) == 0) return record;
}
return NULL;
}
const GpioPinRecord* furi_hal_resources_pin_by_number(uint8_t number) {
for(size_t i = 0; i < gpio_pins_count; i++) {
const GpioPinRecord* record = &gpio_pins[i];
if(record->number == number) return record;
}
return NULL;
}

View File

@@ -227,6 +227,26 @@ void furi_hal_resources_init(void);
*/
int32_t furi_hal_resources_get_ext_pin_number(const GpioPin* gpio);
/**
* @brief Finds a pin by its name
*
* @param name case-insensitive pin name to look for (e.g. `"Pc3"`, `"pA4"`)
*
* @return a pointer to the corresponding `GpioPinRecord` if such a pin exists,
* `NULL` otherwise.
*/
const GpioPinRecord* furi_hal_resources_pin_by_name(const char* name);
/**
* @brief Finds a pin by its number
*
* @param name pin number to look for (e.g. `7`, `4`)
*
* @return a pointer to the corresponding `GpioPinRecord` if such a pin exists,
* `NULL` otherwise.
*/
const GpioPinRecord* furi_hal_resources_pin_by_number(uint8_t number);
#ifdef __cplusplus
}
#endif

View File

@@ -202,7 +202,7 @@ bool furi_hal_spi_bus_trx_dma(
furi_check(size > 0);
// If scheduler is not running, use blocking mode
if(furi_kernel_is_running()) {
if(!furi_kernel_is_running()) {
return furi_hal_spi_bus_trx(handle, tx_buffer, rx_buffer, size, timeout_ms);
}