diff --git a/Arduino/.gitignore b/Arduino/.gitignore new file mode 100644 index 0000000..03f4a3c --- /dev/null +++ b/Arduino/.gitignore @@ -0,0 +1 @@ +.pio diff --git a/Arduino/include/README b/Arduino/include/README new file mode 100644 index 0000000..194dcd4 --- /dev/null +++ b/Arduino/include/README @@ -0,0 +1,39 @@ + +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 usual convention is to give header files names that end with `.h'. +It is most portable to use only letters, digits, dashes, and underscores in +header file names, and at most one dot. + +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 diff --git a/Arduino/lib/README b/Arduino/lib/README new file mode 100644 index 0000000..6debab1 --- /dev/null +++ b/Arduino/lib/README @@ -0,0 +1,46 @@ + +This directory is intended for project specific (private) libraries. +PlatformIO will compile them to static libraries and link into executable file. + +The source code of each library should be placed in a an own separate directory +("lib/your_library_name/[here are source files]"). + +For example, see a structure of the following two libraries `Foo` and `Bar`: + +|--lib +| | +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| | |- library.json (optional, 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 + +and a contents of `src/main.c`: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +PlatformIO Library Dependency Finder will find automatically dependent +libraries scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/Arduino/platformio.ini b/Arduino/platformio.ini new file mode 100644 index 0000000..5627e2a --- /dev/null +++ b/Arduino/platformio.ini @@ -0,0 +1,39 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html +; + +[platformio] +default_envs = nanoatmega168 + +[env] +build_flags = + -D PINS_CHORUS +; -D PINS_PIDFLIGHT + +[env:pro8MHzatmega328] +platform = atmelavr +board = pro8MHzatmega328 +framework = arduino + +[env:nanoatmega328] +platform = atmelavr +board = nanoatmega328 +framework = arduino + +[env:nanoatmega168] +platform = atmelavr +board = nanoatmega168 +framework = arduino + +[env:nanoatmega328new] +platform = atmelavr +board = nanoatmega328new +framework = arduino + diff --git a/Arduino/chorus_rf_laptimer/channels.h b/Arduino/src/channels.h similarity index 100% rename from Arduino/chorus_rf_laptimer/channels.h rename to Arduino/src/channels.h diff --git a/Arduino/chorus_rf_laptimer/chorus_rf_laptimer.ino b/Arduino/src/chorus_rf_laptimer.ino similarity index 100% rename from Arduino/chorus_rf_laptimer/chorus_rf_laptimer.ino rename to Arduino/src/chorus_rf_laptimer.ino diff --git a/Arduino/chorus_rf_laptimer/fastADC.h b/Arduino/src/fastADC.h similarity index 100% rename from Arduino/chorus_rf_laptimer/fastADC.h rename to Arduino/src/fastADC.h diff --git a/Arduino/chorus_rf_laptimer/fastReadWrite.h b/Arduino/src/fastReadWrite.h similarity index 100% rename from Arduino/chorus_rf_laptimer/fastReadWrite.h rename to Arduino/src/fastReadWrite.h diff --git a/Arduino/chorus_rf_laptimer/lapDetectionRoutines.h b/Arduino/src/lapDetectionRoutines.h similarity index 100% rename from Arduino/chorus_rf_laptimer/lapDetectionRoutines.h rename to Arduino/src/lapDetectionRoutines.h diff --git a/Arduino/chorus_rf_laptimer/mainDetectionAlgorithm.h b/Arduino/src/mainDetectionAlgorithm.h similarity index 100% rename from Arduino/chorus_rf_laptimer/mainDetectionAlgorithm.h rename to Arduino/src/mainDetectionAlgorithm.h diff --git a/Arduino/chorus_rf_laptimer/pinAssignments.h b/Arduino/src/pinAssignments.h similarity index 84% rename from Arduino/chorus_rf_laptimer/pinAssignments.h rename to Arduino/src/pinAssignments.h index 6343f93..2074b02 100644 --- a/Arduino/chorus_rf_laptimer/pinAssignments.h +++ b/Arduino/src/pinAssignments.h @@ -29,6 +29,8 @@ SOFTWARE. // Pin definitions +#if defined(PINS_CHORUS) +// Chorus Default #define ledPin 13 #define spiDataPin 10 #define slaveSelectPin 11 @@ -38,6 +40,18 @@ SOFTWARE. #define voltagePinA 0 //analog #define buzzerPin 9 // PWM buzzer +#elif defined(PINS_PIDFLIGHT) +// PIDFLIGHT BOARD REV2 +#define ledPin 13 +#define spiDataPin 10 +#define slaveSelectPin 11 +#define spiClockPin 12 +#define pinRaspiInt 5 //digital +#define rssiPinA 6 //analog +#define voltagePinA 0 //analog +#define buzzerPin 9 // PWM buzzer +#endif + #ifdef DEBUG #define loopTimerPin 4 #define serialTimerPin 3 diff --git a/Arduino/chorus_rf_laptimer/rx5808spi.h b/Arduino/src/rx5808spi.h similarity index 100% rename from Arduino/chorus_rf_laptimer/rx5808spi.h rename to Arduino/src/rx5808spi.h diff --git a/Arduino/chorus_rf_laptimer/sendSerialHex.h b/Arduino/src/sendSerialHex.h similarity index 100% rename from Arduino/chorus_rf_laptimer/sendSerialHex.h rename to Arduino/src/sendSerialHex.h diff --git a/Arduino/chorus_rf_laptimer/sounds.h b/Arduino/src/sounds.h similarity index 100% rename from Arduino/chorus_rf_laptimer/sounds.h rename to Arduino/src/sounds.h diff --git a/Arduino/test/README b/Arduino/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/Arduino/test/README @@ -0,0 +1,11 @@ + +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 diff --git a/README.md b/README.md index 327f0d9..f22a387 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,9 @@ I tried using different types of antennas and shields with RX5808 to achieve the ### Arduino Download the project from Arduino folder, open **chorus-rf-laptimer.ino** file with Arduino IDE and upload to each Solo device. +#### Platformio +You can now use plaformio to build and flash your devices + ### Android App The app is now available on Google Play.