flipperzero-firmware/applications/examples/example_thermo
Georgii Surkov 7a3a1aaf0d
[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>
2023-02-08 14:40:44 +09:00
..
application.fam
example_thermo_10px.png
example_thermo.c
README.md [FL-3057] Allow use of any suitable pin for 1-Wire devices (#2350) 2023-02-08 14:40:44 +09:00

1-Wire Thermometer

This example application demonstrates the use of the 1-Wire library with a DS18B20 thermometer. It also covers basic GUI, input handling, threads and localisation.

Electrical connections

Before launching the application, connect the sensor to Flipper's external GPIO according to the table below:

DS18B20 Flipper
VDD 9
GND 18
DQ 17

NOTE 1: GND is also available on pins 8 and 11.

NOTE 2: For any other pin than 17, connect an external 4.7k pull-up resistor to pin 9.

Launching the application

In order to launch this demo, follow the steps below:

  1. Make sure your Flipper has an SD card installed.
  2. Connect your Flipper to the computer via a USB cable.
  3. Run ./fbt launch_app APPSRC=example_thermo in your terminal emulator of choice.

Changing the data pin

It is possible to use other GPIO pin as a 1-Wire data pin. In order to change it, set the THERMO_GPIO_PIN macro to any of the options listed below:

/* Possible GPIO pin choices:
 - gpio_ext_pc0
 - gpio_ext_pc1
 - gpio_ext_pc3
 - gpio_ext_pb2
 - gpio_ext_pb3
 - gpio_ext_pa4
 - gpio_ext_pa6
 - gpio_ext_pa7
 - ibutton_gpio
*/

#define THERMO_GPIO_PIN (ibutton_gpio)

Do not forget about the external pull-up resistor as these pins do not have one built-in.

With the changes been made, recompile and launch the application again. The on-screen text should reflect it by asking to connect the thermometer to another pin.