move hal files from /src to /shared
This commit is contained in:
parent
c73b190137
commit
2deaec1aed
@ -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:<br> 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/<board.h\>`):
|
||||
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/<board.h\>`):
|
||||
|
||||
```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.
|
||||
|
||||
|
@ -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`.<br>
|
||||
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.<br>
|
||||
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.<br>
|
||||
|
||||
### 3D printed cases
|
||||
Some 3D printable cases can be found (and, if wanted so, ordered) on Thingiverse, see
|
||||
|
@ -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
|
||||
|
@ -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
|
@ -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")
|
||||
|
@ -1,34 +1,34 @@
|
||||
// clang-format off
|
||||
// upload_speed 921600
|
||||
// board esp32dev
|
||||
|
||||
#ifndef _FIPY_H
|
||||
#define _FIPY_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// 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<WS2812, GPIO_NUM_0, GRB>(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 <stdint.h>
|
||||
|
||||
// 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<WS2812, GPIO_NUM_0, GRB>(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
|
Loading…
Reference in New Issue
Block a user