Added first draft of "pins" project

This commit is contained in:
Derek Jamison 2023-02-27 16:26:51 -05:00
parent 31c9be7ef7
commit ee8e6c9d32
20 changed files with 208 additions and 0 deletions

View File

@ -20,10 +20,21 @@ Feel free to reach out to me at CodeAllNight@outlook.com with any questions or l
## GPIO ## GPIO
### gpio-pins
[tool](./gpio/pins/README.md) - This is a set of files you can copy to your Flipper Zero so that you can easily lookup the meaning of a pin.
### hc_sr04
[project](./gpio/hc_sr04/README.md) - This is an improvement over the original HC_SR04 library so that you can get mm accuracy in measurements. It displays ultrasonic distance in both inches/cm. The readme explains how the code gets more accurate timings.
### gpio-gpio-7segment
[project](./gpio/gpio_7segment/README.md) - This application can control a common-anode or common-cathode 7-segment display. When you click the OK button the display shows a random dice roll (1-6); but you can modify code to display any number from 0-9.
### gpio-gpio-polling-demo ### gpio-gpio-polling-demo
[tutorial](./gpio/gpio_polling_demo/README.md) - This is a "hello world" demonstration of reading a GPIO pin using polling. [tutorial](./gpio/gpio_polling_demo/README.md) - This is a "hello world" demonstration of reading a GPIO pin using polling.
## Subghz [folder](./subghz/README.md) ## Subghz [folder](./subghz/README.md)
### subghz-plugins-subghz_demo ### subghz-plugins-subghz_demo
[tutorial](./subghz/plugins/subghz_demo/README.md) - This is a demonstration of sending & receiving radio signals using the subghz_tx_rx worker library. [tutorial](./subghz/plugins/subghz_demo/README.md) - This is a demonstration of sending & receiving radio signals using the subghz_tx_rx worker library.

View File

@ -0,0 +1,10 @@
Connected via USB cable it will have +5 volts OTHERWISE you must enable via GPIO/"5V on GPIO" and click "ON".
Max of 1 watt (1-Amp).
Look at device datasheet. If 5 volts, connect to "VIN", "VCC" or "+5V" (if NO VIN) on the device.
If datasheet says 3.3 volts, do NOT use this pin!
Devices:
- HC-SR04
- Joystick (via a 10K resistor)
- Mx2125 (recommend 3v3 pin)

View File

@ -0,0 +1,11 @@
For SPI, the naming convetion is changing. You may see "MOSI", "MO", "SI", "COPI", "CO", "PI". This pin is Flipper data out "SDO" (which should connect to the device data in "SDI") pin. "I" refers to "Input" and "O" refers to "Output". "M/C" refers to "Main", "Master" (not used anymore), "Controller". "S/P" refers to "Subnode", "Slave" (not used anymore), "Perpherial". "SD" refers to "Serial Data".
Generic GPIO uses PA7.
Devices:
- DHT11[GPIO] (PA7)
- BME280[SPI] (SDI)
- BMP280[SPI] (SDI)
- NRF24L01[SPI] (MO)
- NRF24L02[SPI] (MOSI)
- CC1101[SPI] (SI)

View File

@ -0,0 +1,10 @@
For SPI, the naming convetion is changing. You may see "MISO", "MI", "SO", "CIPO", "CI", "PO". This pin is Flipper data out "SDI" (which should connect to the device data in "SDO") pin. "I" refers to "Input" and "O" refers to "Output". "M/C" refers to "Main", "Master" (not used anymore), "Controller". "S/P" refers to "Subnode", "Slave" (not used anymore), "Perpherial". "SD" refers to "Serial Data".
Generic GPIO uses PA6.
Devices:
- BME280[SPI] (SDO)
- BMP280[SPI] (SDO)
- NRF24L01[SPI] (MI)
- NRF24L02[SPI] (MISO)
- CC1101[SPI] (SO)

View File

@ -0,0 +1,12 @@
For SPI, this is the Chip Select (which enables the data lines.) Typically LOW to enable -- "CSN" is "Chip Select Not".
Generic GPIO uses PA4.
CHECK: "LPTIM2.OUT/ADC1.9/COMP1 IN- COMP2 IN-"
Devices:
- BME280[SPI] (CS)
- BMP280[SPI] (CS)
- NRF24L01[SPI] (CSN)
- NRF24L02[SPI] (CSN)
- CC1101[SPI] (CSN)

View File

@ -0,0 +1,13 @@
For SPI, this is the Serial Clock (which says when to read/write data.) Typically Mode 0 (Idle LOW, Sample Rising Edge, Shift Falling Edge.)
Generic GPIO uses PB3.
CHECK: "ADC1.9/COMP1 IN- COMP2 IN-/SWO"
Devices:
- BME280[SPI] (SCK)
- BMP280[SPI] (SCK)
- NRF24L01[SPI] (SCK)
- NRF24L02[SPI] (SCK)
- CC1101[SPI] (SCLK)

View File

@ -0,0 +1,10 @@
For SPI, libraries do not treat as CS (although it is shown in some diagrams.) This is just a GPIO pin, but it typically get connected to "CE" (for Chip Enable -- e.g. take chip out of standby.) It is typically logic LOW. On the CC1101 it is used for GDO0 (general purpose IRQ).
Generic GPIO uses PB2.
CHECK: "LPTIM1.OUT/COMP1 IN+"
Devices:
- NRF24L01[SPI] (CE)
- NRF24L02[SPI] (CE)
- CC1101[SPI] (GDO0)

View File

@ -0,0 +1,8 @@
This is just a general purpose GPIO pin.
Generic GPIO uses PC3.
CHECK: "LPTIM1.ETR LPTIM2.ETR/ADC1.4"
Devices:
- None

View File

@ -0,0 +1,4 @@
This is one of three ground pins on the Flipper Zero. You can use pins 8 (L8), 11 (R3), 18 (R10) interchangeably.
Devices:
- All

View File

@ -0,0 +1,19 @@
DANGER: Connect external modules with large capacitive load only when Flipper Zero is powered off. Otherwise, data on the microSD card can be corrupted.
This pin is 3.3 Volts output. NOTE: Some people recommend using the 5V pin (L1) and a 3.3 volt regulator with output having a parallel 10uF and 100nF capacitor; so that voltage is more stable.
Max of 1200 mA (3.96 watt).
Look at device datasheet. If 3.3 volts, connect to "VIN", "VCC", "3.3V/3V3" (if NO VIN) on the device.
Devices:
- NMEA GPS[USART] (VIN)
- DHT11[GPIO] (VCC)
- BME280[I²C] (VCC)
- BME280[SPI-MODE] (VCC)
- BMP280[SPI] (VIN)
- BH1750[I²C] (VCC)
- NRF24L01[SPI] (VCC)
- NRF24L01[SPI] (VCC)
- CC1101[SPI] (VCC)

View File

@ -0,0 +1,6 @@
This pin is used for general IO, timer & SWD only.
CHECK: "LPTIM1.OUT/SWCLK"
Devices:
- None

4
gpio/pins/R3(11)_GND.txt Normal file
View File

@ -0,0 +1,4 @@
This is one of three ground pins on the Flipper Zero. You can use pins 8 (L8), 11 (R3), 18 (R10) interchangeably.
Devices:
- All

View File

@ -0,0 +1,6 @@
This pin is used for back key (PA13) and SWD only.
CHECK: "PA13/SWIO"
Devices:
- None

View File

@ -0,0 +1,11 @@
This pin is Flipper TX on USART (so connect to RX on device).
The Signal Generator/Clock Generator app uses LPTIM1.EXT (pin 13) for the clock signal.
Generic GPIO uses PB6.
CHECK: "COMP2 IN+/MCO"
Devices:
- NMEA GPS[USART] (RX)
- HC-SR04[GPIO] (Trig)

View File

@ -0,0 +1,9 @@
This pin is Flipper RX on USART (so connect to TX on device).
Generic GPIO uses PB7.
CHECK: "LPTIM1.IN2/COMP2 IN-"
Devices:
- NMEA GPS[USART] (TX)
- HC-SR04[GPIO] (Echo)

View File

@ -0,0 +1,11 @@
This pin is Flipper TX on LPUART [Low Power UART] (so connect to RX on device).
For I2C devices this is SDA (Serial Data) pin.
Generic GPIO uses PC1.
CHECK: "LPTIM1.OUT/ADC1.2"
Devices:
- BME280[I²C] (SDA)
- BH1750[I²C] (SDA)

View File

@ -0,0 +1,13 @@
This pin is Flipper RX on LPUART [Low Power UART] (so connect to TX on device).
For I2C devices this is SCL (Serial Clock) pin.
For ADC devices this is ADC1.1 pin (flipperscope application uses LL library to show values.)
Generic GPIO uses PC0.
CHECK: "LPTIM1.IN LPTIM2.IN"
Devices:
- BME280[I²C] (SCL)
- BH1750[I²C] (SCL)

View File

@ -0,0 +1,9 @@
For 1-Wire (iButton) devices this is the wire. It has built-in 1K pull-up resistor to 5 volts.
Generic GPIO uses PC0.
CHECK: "PB14/TIM1.2N/I2C3.SDA-Pullup"
Devices:
- iButton[1Wire] (center of button)
- DS18B20[1Wire] (yellow wire)

27
gpio/pins/README.md Normal file
View File

@ -0,0 +1,27 @@
# Pins
## Description
To help making things easier, I have been trying to use specific colored wires for connecting to various devices. I also made a breakout board that connects to the top of the Flipper Zero and exposes the same colored wires on a breadboard for quick prototyping. The breadboard also exposes a copy of each general output with a 220 ohm series resistor (which is helpful for driving LEDs).
The pins have different names depending on their meaning, so this
helps me connect to the proper pins.
I use the following colors (for some usages like LPUART v. I2C it isn't a match; but I think it is more common for the pins to be I2C):
- White = +5V
- Red = +3.3V
- Black = GND
- Orange = OUT [from Flipper perspective]
- Indigo = IN [from Flipper perspective]
- Yellow = IN/OUT
- Green = SELECT [TYPICALLY LOW]
- Brown = CLOCK
- Blue = GENERAL/IRQ
- Grey = TYPICALLY UNUSED
NOTE: For General Purpose Input/Output (like controlling a 7-segment LED display) instead of a specific protocol, the majority of the colors have no meanings.
## Installing
I copy these files into a folder on my Flipper Zero (like "pins") so that I can easily browse all of the pins. If you click on a file and chose "Info" so that you see the full name without scrolling. If you click on a file and choose "Show" then you will see details about that pin.
## Future work
Many devices have printing on the underside, so you have to be careful when connecting to those (or connect wires from breadboard to device - instead of plugging in directly to device.) Some devices have two sets of adjecent pins, so they don't work in breadboard (I'm working on making an adapter soon) so they can go into my breadboard (but you can also connect wires from breadboard to device.)

View File

@ -0,0 +1,4 @@
This is one of three ground pins on the Flipper Zero. You can use pins 8 (L8), 11 (R3), 18 (R10) interchangeably.
Devices:
- All