Skip to content

Commit

Permalink
Menuconfig for pins, and GPS moved to pin 6
Browse files Browse the repository at this point in the history
  • Loading branch information
htotoo committed Mar 8, 2024
1 parent 0e4f39b commit a5f2b07
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 2,056 deletions.
2 changes: 1 addition & 1 deletion BuildIt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ An addon module for portapack to add extra sensors to it for more fun.

**Pin configuration**

- GPS TX -> ESP pin 18 (baud 9600)
- GPS TX -> ESP pin 6 (baud 9600)
- I2c devices SCL -> ESP pin 4
- I2c devices SDA -> ESP pin 5

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ An addon module for portapack to add extra sensors to it for more fun.

![](https://github.com/htotoo/ESP32-Portapack/blob/main/ScreenShots/ExtSensorTester.png?raw=true)

### How to build:
You can check the pinout here: https://github.com/htotoo/ESP32-Portapack/blob/main/BuildIt/README.md

There is also menuconfig options to redefine the pins.

### Flash:
If you want to flash the provided binary files, you can use this command:
Expand Down
24 changes: 24 additions & 0 deletions Source/main/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
menu "ESP32PP"

config GPSTXPIN
int "PIN where you connect the GPS TX part (ESP RX)"
range 0 40
default 6
help
PIN where you connect the GPS TX part (ESP RX)

config IC2SCLPIN
int "I2C SCL PIN on ESP"
range 0 40
default 4
help
I2C SCL PIN on ESP

config IC2SDAPIN
int "I2C SDA PIN on ESP"
range 1 255
default 5
help
I2C SDA PIN on ESP

endmenu
6 changes: 3 additions & 3 deletions Source/main/environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void init_environment()
bmp280_params_t params_bmp280;
bmp280_init_default_params(&params_bmp280);
memset(&dev_bmp280, 0, sizeof(bmp280_t));
bmp280_init_desc(&dev_bmp280, BMP280_I2C_ADDRESS_0, 0, 5, 4);
bmp280_init_desc(&dev_bmp280, BMP280_I2C_ADDRESS_0, 0, CONFIG_IC2SDAPIN, CONFIG_IC2SCLPIN);

if (bmp280_init(&dev_bmp280, &params_bmp280) == ESP_OK)
{
Expand All @@ -46,7 +46,7 @@ void init_environment()

// sht3x
memset(&sht3x, 0, sizeof(sht3x_t));
sht3x_init_desc(&sht3x, SHT3X_I2C_ADDR_GND, 0, 5, 4);
sht3x_init_desc(&sht3x, SHT3X_I2C_ADDR_GND, 0, CONFIG_IC2SDAPIN, CONFIG_IC2SCLPIN);
if (sht3x_init(&sht3x) == ESP_OK)
{
sht3x_start_measurement(&sht3x, SHT3X_PERIODIC_1MPS, SHT3X_HIGH);
Expand Down Expand Up @@ -89,7 +89,7 @@ void init_environment_light()

// bh1750
memset(&bh1750, 0, sizeof(i2c_dev_t));
bh1750_init_desc(&bh1750, 0x23, 0, 5, 4);
bh1750_init_desc(&bh1750, 0x23, 0, CONFIG_IC2SDAPIN, CONFIG_IC2SCLPIN);

if (bh1750_setup(&bh1750, BH1750_MODE_CONTINUOUS, BH1750_RES_HIGH) == ESP_OK)
{
Expand Down
Loading

0 comments on commit a5f2b07

Please sign in to comment.