diff --git a/docs/configuration/index.md b/docs/configuration/index.md index abcb78fa..e66f4aa6 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -14,24 +14,24 @@ You can add up to 3 user defined sensors. Insert your sensor's payload scheme in For these peripherals no additional code is needed. To activate configure them in the board's hal file before building the code. -See [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/hal/generic.h) for all options and for proper configuration of BME280/BME680. +See [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/hal/generic.h) for all options and for proper configuration of BME280/BME680. === "BME/ BMP Configuration" - ```c linenums="37" title="src/hal/generic.h" - --8<-- "src/hal/generic.h:37:49" + ```c linenums="37" title="shared/hal/generic.h" + --8<-- "shared/hal/generic.h:37:49" ``` === "SDS011 Configuration" - ```c linenums="51" title="src/hal/generic.h" - --8<-- "src/hal/generic.h:51:56" + ```c linenums="51" title="shared/hal/generic.h" + --8<-- "shared/hal/generic.h:51:56" ``` === "Custom Sensors Configuration" - ```c linenums="57" title="src/hal/generic.h" - --8<-- "src/hal/generic.h:57:60" + ```c linenums="57" title="shared/hal/generic.h" + --8<-- "shared/hal/generic.h:57:60" ``` === "Complete `generic.h`" - ```c linenums="1" title="src/hal/generic.h" - --8<-- "src/hal/generic.h" + ```c linenums="1" title="shared/hal/generic.h" + --8<-- "shared/hal/generic.h" ``` Output of user sensor data can be switched by user remote control command `0x14` sent to Port 2. @@ -77,10 +77,10 @@ Paxcounter can keep a time-of-day synced with external or on board time sources. --8<-- "src/paxcounter_orig.conf:88:88" ``` -Supported external time sources are GPS, LORAWAN network time and LORAWAN application timeserver time. Supported on board time sources are the RTC of ESP32 and a DS3231 RTC chip, both are kept sycned as fallback time sources. Time accuracy depends on board's time base which generates the pulse per second. Supported are GPS PPS, SQW output of RTC, and internal ESP32 hardware timer. Time base is selected by #defines in the board's hal file, see example in [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/hal/generic.h). +Supported external time sources are GPS, LORAWAN network time and LORAWAN application timeserver time. Supported on board time sources are the RTC of ESP32 and a DS3231 RTC chip, both are kept sycned as fallback time sources. Time accuracy depends on board's time base which generates the pulse per second. Supported are GPS PPS, SQW output of RTC, and internal ESP32 hardware timer. Time base is selected by #defines in the board's hal file, see example in [`generic.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/hal/generic.h). -```c linenums="87" title="src/hal/generic.h" ---8<-- "src/hal/generic.h:87:96" +```c linenums="87" title="shared/hal/generic.h" +--8<-- "shared/hal/generic.h:87:96" ``` @@ -112,7 +112,7 @@ This describes how to set up a mobile PaxCounter:
Follow all steps so far fo ## SD-card -Data can be stored on a FAT32 (pre-)formatted SD-card if the board provides an SD card interface, either with SPI or MMC mode. To enable this feature, specify interface mode and hardware pins in board's hal file (`src/hal/`): +Data can be stored on a FAT32 (pre-)formatted SD-card if the board provides an SD card interface, either with SPI or MMC mode. To enable this feature, specify interface mode and hardware pins in board's hal file (`shared/hal/`): ```c #define HAS_SDCARD 1 // SD-card interface, using SPI mode @@ -126,10 +126,10 @@ Data can be stored on a FAT32 (pre-)formatted SD-card if the board provides an S #define SDCARD_SCLK (14) ``` -This is an example of a board with MMC SD-card interface: [https://www.aliexpress.com/item/32915894264.html](https://www.aliexpress.com/item/32915894264.html). For this board use file [`src/hal/ttgov21new.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/src/hal/ttgov21new.h) and add the lines given above. +This is an example of a board with MMC SD-card interface: [https://www.aliexpress.com/item/32915894264.html](https://www.aliexpress.com/item/32915894264.html). For this board use file [`shared/hal/ttgov21new.h`](https://github.com/cyberman54/ESP32-Paxcounter/blob/master/shared/hal/ttgov21new.h) and add the lines given above. Another approach would be this tiny board: [https://www.aliexpress.com/item/32424558182.html](https://www.aliexpress.com/item/32424558182.html) (needs 5V). -In this case you choose the correct file for your ESP32-board in the src/hal-directory and add the lines given above. Edit the pin numbers given in the example, according to your wiring. +In this case you choose the correct file for your ESP32-board in the shared/hal-directory and add the lines given above. Edit the pin numbers given in the example, according to your wiring. Data is written on SD-card to a single file. After 3 write operations the data is flushed to the disk to minimize flash write cycles. Thus, up to the last 3 records of data will get lost when the Paxcounter looses power during operation. diff --git a/docs/hardware.md b/docs/hardware.md index 5f7b9950..b50842b7 100644 --- a/docs/hardware.md +++ b/docs/hardware.md @@ -45,7 +45,7 @@ Depending on board hardware following features are supported: - SD-card (see section SD-card here) for logging pax data Target platform must be selected in `platformio.ini`.
-Hardware dependent settings (pinout etc.) are stored in board files in [/hal](https://github.com/cyberman54/ESP32-Paxcounter/tree/master/src/hal) directory. If you want to use a ESP32 board which is not yet supported, use hal file generic.h and tailor pin mappings to your needs. Pull requests for new boards welcome.
+Hardware dependent settings (pinout etc.) are stored in board files in [/shared/hal](https://github.com/cyberman54/ESP32-Paxcounter/tree/master/shared/hal) directory. If you want to use a ESP32 board which is not yet supported, use hal file generic.h and tailor pin mappings to your needs. Pull requests for new boards welcome.
### 3D printed cases Some 3D printable cases can be found (and, if wanted so, ordered) on Thingiverse, see diff --git a/platformio_orig.ini b/platformio_orig.ini index d570de20..7e3e308b 100644 --- a/platformio_orig.ini +++ b/platformio_orig.ini @@ -114,7 +114,7 @@ upload_speed = ${common.upload_speed} platform = ${common.platform_espressif32} lib_deps = ${common.lib_deps_all} build_flags = - -include "src/hal/${board.halfile}" + -include "shared/hal/${board.halfile}" ${common.build_flags_all} extra_scripts = ${common.extra_scripts} monitor_speed = ${common.monitor_speed} @@ -138,6 +138,6 @@ platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/ [env:ci] build_flags = - -include "src/hal/${sysenv.CI_HALFILE}" ; set by CI + -include "shared/hal/${sysenv.CI_HALFILE}" ; set by CI ${common.build_flags_all} upload_protocol = esptool diff --git a/platformio_orig_s3.ini b/platformio_orig_s3.ini index 06217797..04bcda67 100644 --- a/platformio_orig_s3.ini +++ b/platformio_orig_s3.ini @@ -53,7 +53,7 @@ upload_speed = ${common.upload_speed} platform = ${common.platform_espressif32} lib_deps = ${common.lib_deps_all} build_flags = - -include "src/hal/${board.halfile}" + -include "shared/hal/${board.halfile}" ${common.build_flags_all} extra_scripts = ${common.extra_scripts} monitor_speed = ${common.monitor_speed} @@ -64,6 +64,6 @@ upload_protocol = esptool [env:ci] build_flags = - -include "src/hal/${sysenv.CI_HALFILE}" ; set by CI + -include "shared/hal/${sysenv.CI_HALFILE}" ; set by CI ${common.build_flags_all} upload_protocol = esptool \ No newline at end of file diff --git a/shared/build.py b/shared/build.py index e6bd6b50..25fcc7d0 100644 --- a/shared/build.py +++ b/shared/build.py @@ -23,7 +23,8 @@ config.read("platformio.ini") srcdir = env.get("PROJECT_SRC_DIR") # get hal path -haldir = os.path.join (srcdir, "hal") +prjdir = env.get("PROJECT_DIR") +haldir = os.path.join (prjdir, "shared/hal") # check if hal file is present in source directory halconfig = config.get("board", "halfile") diff --git a/src/hal/ebox.h b/shared/hal/ebox.h similarity index 100% rename from src/hal/ebox.h rename to shared/hal/ebox.h diff --git a/src/hal/eboxtube.h b/shared/hal/eboxtube.h similarity index 100% rename from src/hal/eboxtube.h rename to shared/hal/eboxtube.h diff --git a/src/hal/ecopower.h b/shared/hal/ecopower.h similarity index 100% rename from src/hal/ecopower.h rename to shared/hal/ecopower.h diff --git a/src/hal/fipy.h b/shared/hal/fipy.h similarity index 96% rename from src/hal/fipy.h rename to shared/hal/fipy.h index dd8a5da5..4a6c6a42 100644 --- a/src/hal/fipy.h +++ b/shared/hal/fipy.h @@ -1,34 +1,34 @@ -// clang-format off -// upload_speed 921600 -// board esp32dev - -#ifndef _FIPY_H -#define _FIPY_H - -#include - -// Hardware related definitions for Pycom FiPy Board - -#define HAS_LORA 1 // comment out if device shall not send data via LoRa - -#define CFG_sx1272_radio 1 -#define HAS_LED NOT_A_PIN // FiPy has no on board LED, so we use RGB LED -#define RGB_LED_COUNT 1 // we have 1 LED -#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT); -#define BOARD_HAS_PSRAM // use extra 4MB extern RAM - -// Pins for LORA chip SPI interface, reset line and interrupt lines -#define LORA_SCK (5) -#define LORA_CS (18) -#define LORA_MISO (19) -#define LORA_MOSI (27) -#define LORA_RST LMIC_UNUSED_PIN -#define LORA_IRQ (23) // LoRa IRQ -#define LORA_IO1 (23) // Pin tied via diode to DIO0 -#define LORA_IO2 LMIC_UNUSED_PIN - -// select WIFI antenna (internal = onboard / external = u.fl socket) -#define HAS_ANTENNA_SWITCH GPIO_NUM_21 // pin for switching wifi antenna -#define WIFI_ANTENNA 0 // 0 = internal, 1 = external - -#endif +// clang-format off +// upload_speed 921600 +// board esp32dev + +#ifndef _FIPY_H +#define _FIPY_H + +#include + +// Hardware related definitions for Pycom FiPy Board + +#define HAS_LORA 1 // comment out if device shall not send data via LoRa + +#define CFG_sx1272_radio 1 +#define HAS_LED NOT_A_PIN // FiPy has no on board LED, so we use RGB LED +#define RGB_LED_COUNT 1 // we have 1 LED +#define HAS_RGB_LED FastLED.addLeds(leds, RGB_LED_COUNT); +#define BOARD_HAS_PSRAM // use extra 4MB extern RAM + +// Pins for LORA chip SPI interface, reset line and interrupt lines +#define LORA_SCK (5) +#define LORA_CS (18) +#define LORA_MISO (19) +#define LORA_MOSI (27) +#define LORA_RST LMIC_UNUSED_PIN +#define LORA_IRQ (23) // LoRa IRQ +#define LORA_IO1 (23) // Pin tied via diode to DIO0 +#define LORA_IO2 LMIC_UNUSED_PIN + +// select WIFI antenna (internal = onboard / external = u.fl socket) +#define HAS_ANTENNA_SWITCH GPIO_NUM_21 // pin for switching wifi antenna +#define WIFI_ANTENNA 0 // 0 = internal, 1 = external + +#endif diff --git a/src/hal/generic.h b/shared/hal/generic.h similarity index 100% rename from src/hal/generic.h rename to shared/hal/generic.h diff --git a/src/hal/heltec.h b/shared/hal/heltec.h similarity index 100% rename from src/hal/heltec.h rename to shared/hal/heltec.h diff --git a/src/hal/heltecv2.h b/shared/hal/heltecv2.h similarity index 100% rename from src/hal/heltecv2.h rename to shared/hal/heltecv2.h diff --git a/src/hal/heltecv21.h b/shared/hal/heltecv21.h similarity index 100% rename from src/hal/heltecv21.h rename to shared/hal/heltecv21.h diff --git a/src/hal/lolin32lite.h b/shared/hal/lolin32lite.h similarity index 100% rename from src/hal/lolin32lite.h rename to shared/hal/lolin32lite.h diff --git a/src/hal/lolin32litelora.h b/shared/hal/lolin32litelora.h similarity index 100% rename from src/hal/lolin32litelora.h rename to shared/hal/lolin32litelora.h diff --git a/src/hal/lolin32lora.h b/shared/hal/lolin32lora.h similarity index 100% rename from src/hal/lolin32lora.h rename to shared/hal/lolin32lora.h diff --git a/src/hal/lopy.h b/shared/hal/lopy.h similarity index 100% rename from src/hal/lopy.h rename to shared/hal/lopy.h diff --git a/src/hal/lopy4.h b/shared/hal/lopy4.h similarity index 100% rename from src/hal/lopy4.h rename to shared/hal/lopy4.h diff --git a/src/hal/m5core.h b/shared/hal/m5core.h similarity index 100% rename from src/hal/m5core.h rename to shared/hal/m5core.h diff --git a/src/hal/m5fire.h b/shared/hal/m5fire.h similarity index 100% rename from src/hal/m5fire.h rename to shared/hal/m5fire.h diff --git a/src/hal/octopus32.h b/shared/hal/octopus32.h similarity index 100% rename from src/hal/octopus32.h rename to shared/hal/octopus32.h diff --git a/src/hal/olimexpoeiso.h b/shared/hal/olimexpoeiso.h similarity index 100% rename from src/hal/olimexpoeiso.h rename to shared/hal/olimexpoeiso.h diff --git a/src/hal/tinypico.h b/shared/hal/tinypico.h similarity index 100% rename from src/hal/tinypico.h rename to shared/hal/tinypico.h diff --git a/src/hal/tinypicomatrix.h b/shared/hal/tinypicomatrix.h similarity index 100% rename from src/hal/tinypicomatrix.h rename to shared/hal/tinypicomatrix.h diff --git a/src/hal/ttgobeam.h b/shared/hal/ttgobeam.h similarity index 100% rename from src/hal/ttgobeam.h rename to shared/hal/ttgobeam.h diff --git a/src/hal/ttgobeam10.h b/shared/hal/ttgobeam10.h similarity index 100% rename from src/hal/ttgobeam10.h rename to shared/hal/ttgobeam10.h diff --git a/src/hal/ttgofox.h b/shared/hal/ttgofox.h similarity index 100% rename from src/hal/ttgofox.h rename to shared/hal/ttgofox.h diff --git a/src/hal/ttgotdisplay.h b/shared/hal/ttgotdisplay.h similarity index 100% rename from src/hal/ttgotdisplay.h rename to shared/hal/ttgotdisplay.h diff --git a/src/hal/ttgotdisplays3.h b/shared/hal/ttgotdisplays3.h similarity index 100% rename from src/hal/ttgotdisplays3.h rename to shared/hal/ttgotdisplays3.h diff --git a/src/hal/ttgotdongledisplays3.h b/shared/hal/ttgotdongledisplays3.h similarity index 100% rename from src/hal/ttgotdongledisplays3.h rename to shared/hal/ttgotdongledisplays3.h diff --git a/src/hal/ttgotdongles3.h b/shared/hal/ttgotdongles3.h similarity index 100% rename from src/hal/ttgotdongles3.h rename to shared/hal/ttgotdongles3.h diff --git a/src/hal/ttgotwristband.h b/shared/hal/ttgotwristband.h similarity index 100% rename from src/hal/ttgotwristband.h rename to shared/hal/ttgotwristband.h diff --git a/src/hal/ttgov1.h b/shared/hal/ttgov1.h similarity index 100% rename from src/hal/ttgov1.h rename to shared/hal/ttgov1.h diff --git a/src/hal/ttgov2.h b/shared/hal/ttgov2.h similarity index 100% rename from src/hal/ttgov2.h rename to shared/hal/ttgov2.h diff --git a/src/hal/ttgov21new.h b/shared/hal/ttgov21new.h similarity index 100% rename from src/hal/ttgov21new.h rename to shared/hal/ttgov21new.h diff --git a/src/hal/ttgov21old.h b/shared/hal/ttgov21old.h similarity index 100% rename from src/hal/ttgov21old.h rename to shared/hal/ttgov21old.h diff --git a/src/hal/wemos32matrix.h b/shared/hal/wemos32matrix.h similarity index 100% rename from src/hal/wemos32matrix.h rename to shared/hal/wemos32matrix.h diff --git a/src/hal/wemos32oled.h b/shared/hal/wemos32oled.h similarity index 100% rename from src/hal/wemos32oled.h rename to shared/hal/wemos32oled.h