[FL-3179] 1-Wire Overdrive Mode (#2522)

* Separate ibutton to its own module, add one_wire to f18
* Move onewire cli to a separate app
* Add definitions for normal and overdrive timings
* Update api definitions
* Add rough overdrive timings definition for onewire emulation
* Remove one_wire_host_timing.h
* Add rough overdrive timings for onewire host
* Improve overdrive mode
* Working overdrive mode from flipper to flipper
* Update thermometer example app
* Turn on otg power when running thermometer example app
* Implement reset overdrive switching
* Always exit out of overdrive mode
* Improve overdrive timings
* Fix typos
* Fix reset behaviour
* Use overdrive mode everywhere in DS1996
* Improve comments
* Bump API version

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Georgii Surkov
2023-03-22 17:54:06 +03:00
committed by GitHub
parent 1f236ede0e
commit 8b224ecb15
16 changed files with 397 additions and 227 deletions

View File

@@ -19,9 +19,12 @@
#include <one_wire/maxim_crc.h>
#include <one_wire/one_wire_host.h>
#include <furi_hal_power.h>
#define UPDATE_PERIOD_MS 1000UL
#define TEXT_STORE_SIZE 64U
#define DS18B20_CMD_SKIP_ROM 0xccU
#define DS18B20_CMD_CONVERT 0x44U
#define DS18B20_CMD_READ_SCRATCHPAD 0xbeU
@@ -92,7 +95,7 @@ static void example_thermo_request_temperature(ExampleThermoContext* context) {
/* After the reset, a ROM operation must follow.
If there is only one device connected, the "Skip ROM" command is most appropriate
(it can also be used to address all of the connected devices in some cases).*/
onewire_host_skip(onewire);
onewire_host_write(onewire, DS18B20_CMD_SKIP_ROM);
/* After the ROM operation, a device-specific command is issued.
In this case, it's a request to start measuring the temperature. */
onewire_host_write(onewire, DS18B20_CMD_CONVERT);
@@ -133,7 +136,7 @@ static void example_thermo_read_temperature(ExampleThermoContext* context) {
/* After the reset, a ROM operation must follow.
If there is only one device connected, the "Skip ROM" command is most appropriate
(it can also be used to address all of the connected devices in some cases).*/
onewire_host_skip(onewire);
onewire_host_write(onewire, DS18B20_CMD_SKIP_ROM);
/* After the ROM operation, a device-specific command is issued.
This time, it will be the "Read Scratchpad" command which will
@@ -267,6 +270,9 @@ static void example_thermo_input_callback(InputEvent* event, void* ctx) {
/* Starts the reader thread and handles the input */
static void example_thermo_run(ExampleThermoContext* context) {
/* Enable power on external pins */
furi_hal_power_enable_otg();
/* Configure the hardware in host mode */
onewire_host_start(context->onewire);
@@ -299,6 +305,9 @@ static void example_thermo_run(ExampleThermoContext* context) {
/* Reset the hardware */
onewire_host_stop(context->onewire);
/* Disable power on external pins */
furi_hal_power_disable_otg();
}
/******************** Initialisation & startup *****************************/