[FL-3057] Allow use of any suitable pin for 1-Wire devices (#2350)

* Add 1-wire thermometer example app stub
* Working 1-wire thermometer app
* Refactor app to use threads
* Clean up code, add comments
* Add CRC checking
* Increase update period
* Fix error in fbt
* Revert the old update period
* Use settable pin in onewire_host
* Use settable pin for onewire_slave
* Clear EXTI flag after callback, make private methods static in onewire_slave
* Do not hardcode GPIO pin number
* Remove iButton hal from furi_hal_rfid
* Remove most of furi_hal_ibutton
* Add some of furi_hal_ibutton back
* Slightly neater code
* Fix formatting
* Fix PVS-studio warnings
* Update CODEOWNERS
* Add furi_hal_gpio_get_ext_pin_number
* Create README.md
* FuriHal: move furi_hal_gpio_get_ext_pin_number to resources

---------

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Georgii Surkov
2023-02-08 08:40:44 +03:00
committed by GitHub
parent e3d473bf42
commit 7a3a1aaf0d
22 changed files with 592 additions and 184 deletions

View File

@@ -7,7 +7,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <furi_hal_gpio.h>
#ifdef __cplusplus
extern "C" {
@@ -18,70 +17,43 @@ typedef void (*FuriHalIbuttonEmulateCallback)(void* context);
/** Initialize */
void furi_hal_ibutton_init();
/**
* Start emulation timer
* @param period timer period
* @param callback timer callback
* @param context callback context
*/
void furi_hal_ibutton_emulate_start(
uint32_t period,
FuriHalIbuttonEmulateCallback callback,
void* context);
/**
* Update emulation timer period
* @param period new timer period
*/
void furi_hal_ibutton_emulate_set_next(uint32_t period);
/**
* Stop emulation timer
*/
void furi_hal_ibutton_emulate_stop();
/**
* Sets the pin to normal mode (open collector), and sets it to float
* Set the pin to normal mode (open collector), and sets it to float
*/
void furi_hal_ibutton_start_drive();
/**
* Sets the pin to normal mode (open collector), and clears pin EXTI interrupt.
* Used in EXTI interrupt context.
*/
void furi_hal_ibutton_start_drive_in_isr();
/**
* Sets the pin to interrupt mode (EXTI interrupt on rise or fall), and sets it to float
*/
void furi_hal_ibutton_start_interrupt();
/**
* Sets the pin to interrupt mode (EXTI interrupt on rise or fall), and clears pin EXTI interrupt.
* Used in EXTI interrupt context.
*/
void furi_hal_ibutton_start_interrupt_in_isr();
void furi_hal_ibutton_pin_configure();
/**
* Sets the pin to analog mode, and sets it to float
*/
void furi_hal_ibutton_stop();
void furi_hal_ibutton_pin_reset();
/**
* Attach interrupt callback to iButton pin
* @param cb callback
* @param context context
* iButton write pin
* @param state true / false
*/
void furi_hal_ibutton_add_interrupt(GpioExtiCallback cb, void* context);
/**
* Remove interrupt callback from iButton pin
*/
void furi_hal_ibutton_remove_interrupt();
/**
* Sets the pin to low
*/
void furi_hal_ibutton_pin_low();
/**
* Sets the pin to high (float in iButton pin modes)
*/
void furi_hal_ibutton_pin_high();
/**
* Get pin level
* @return true if level is high
* @return false if level is low
*/
bool furi_hal_ibutton_pin_get_level();
void furi_hal_ibutton_pin_write(const bool state);
#ifdef __cplusplus
}