Update code to work on fabricated PCB
This commit is contained in:
Symlink
+1
@@ -0,0 +1 @@
|
||||
.pio/build/server/compile_commands.json
|
||||
@@ -0,0 +1,10 @@
|
||||
import os
|
||||
Import("env")
|
||||
|
||||
# include toolchain paths
|
||||
env.Replace(COMPILATIONDB_INCLUDE_TOOLCHAIN=True)
|
||||
|
||||
# override compilation DB path
|
||||
env.Replace(COMPILATIONDB_PATH=os.path.join("$BUILD_DIR", "compile_commands.json"))
|
||||
|
||||
env.AddPostAction("buildprog", lambda *_, **__: env.Execute("pio run -t compiledb"))
|
||||
@@ -1,37 +0,0 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the convention is to give header files names that end with `.h'.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into the executable file.
|
||||
|
||||
The source code of each library should be placed in a separate directory
|
||||
("lib/your_library_name/[Code]").
|
||||
|
||||
For example, see the structure of the following example libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional. for custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
Example contents of `src/main.c` using Foo and Bar:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
The PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries by scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
@@ -8,19 +8,25 @@
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:esp32-c3-devkitm-1]
|
||||
[env:server]
|
||||
platform = espressif32
|
||||
board = esp32-c3-devkitm-1
|
||||
board = esp32dev
|
||||
board_build.mcu = esp32c3
|
||||
board_build.f_cpu = 160000000L
|
||||
framework = arduino
|
||||
extra_scripts = pre:extra_script.py
|
||||
|
||||
build_unflags = -std=gnu++11 ; remove this default from compile flags
|
||||
build_flags =
|
||||
-std=c++2a
|
||||
-I"${platformio.packages_dir}/framework-arduinoespressif32/libraries/WiFi/src" ; doesnt work for compile_commands.json ootb
|
||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||
-DARDUINO_USB_MODE=1
|
||||
-DARDUINO_TINYUSB=1
|
||||
-DCORE_DEBUG_LEVEL=5 ; set the debug level (0-5, with 5 being the most verbose)
|
||||
|
||||
lib_deps =
|
||||
WiFi
|
||||
|
||||
monitor_filters =
|
||||
esp32_exception_decoder
|
||||
|
||||
+21
-11
@@ -5,17 +5,23 @@
|
||||
|
||||
#include "secrets.h"
|
||||
|
||||
// Default IP address = 192.168.4.1
|
||||
// Default gateway = 192.168.4.1
|
||||
// Default IP address = 192.168.4.2
|
||||
|
||||
#define PORT 1234
|
||||
#define CHANNEL 11
|
||||
#define HIDDEN true
|
||||
#define MAX_CONNECTION 1
|
||||
|
||||
#define POWER_PIN 2
|
||||
#define RESET_PIN 3
|
||||
#define POWER_BUTTON_PIN 10
|
||||
#define RESET_BUTTON_PIN 2
|
||||
#define POWER_LED_PIN 3
|
||||
#define RESET_LED_PIN 1
|
||||
|
||||
WiFiServer server(PORT);
|
||||
#define POWER_GATE_PIN 6
|
||||
#define RESET_GATE_PIN 7
|
||||
|
||||
WiFiServer server(PORT, MAX_CONNECTION);
|
||||
|
||||
bool powerPressed = false;
|
||||
bool resetPressed = false;
|
||||
@@ -29,12 +35,11 @@ void setup()
|
||||
Serial.begin(9600);
|
||||
Serial.setDebugOutput(true);
|
||||
|
||||
pinMode(POWER_PIN, OUTPUT);
|
||||
pinMode(RESET_PIN, OUTPUT);
|
||||
pinMode(POWER_GATE_PIN, OUTPUT);
|
||||
pinMode(POWER_LED_PIN, OUTPUT);
|
||||
pinMode(RESET_GATE_PIN, OUTPUT);
|
||||
pinMode(RESET_LED_PIN, OUTPUT);
|
||||
|
||||
// Wait for a USB connection to be established
|
||||
while (!Serial)
|
||||
(void)0;
|
||||
delay(3000);
|
||||
Serial.println("Server booted!");
|
||||
|
||||
@@ -110,11 +115,16 @@ void processButtons()
|
||||
void setPowerPin(bool enable)
|
||||
{
|
||||
powerPressed = enable;
|
||||
digitalWrite(POWER_PIN, (enable) ? HIGH : LOW);
|
||||
// digitalWrite(POWER_GATE_PIN, (enable) ? HIGH : LOW);
|
||||
digitalWrite(POWER_LED_PIN, (enable) ? HIGH : LOW);
|
||||
}
|
||||
|
||||
void setResetPin(bool enable)
|
||||
{
|
||||
resetPressed = enable;
|
||||
digitalWrite(RESET_PIN, (enable) ? HIGH : LOW);
|
||||
// digitalWrite(RESET_GATE_PIN, (enable) ? HIGH : LOW);
|
||||
digitalWrite(RESET_LED_PIN, (enable) ? HIGH : LOW);
|
||||
}
|
||||
|
||||
// connect + to drain
|
||||
// connect - to source
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
This directory is intended for PlatformIO Test Runner and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PlatformIO Unit Testing:
|
||||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||
Reference in New Issue
Block a user