diff --git a/Docs/sch_oled_0.49_v1.0.0.pdf b/Docs/sch_oled_0.49_v1.0.0.pdf new file mode 100644 index 0000000..4310bf1 Binary files /dev/null and b/Docs/sch_oled_0.49_v1.0.0.pdf differ diff --git a/TechInc Badge.eprj b/TechInc Badge.eprj index 865aa7a..9534fd5 100644 Binary files a/TechInc Badge.eprj and b/TechInc Badge.eprj differ diff --git a/TestJig/.gitignore b/TestJig/.gitignore new file mode 100644 index 0000000..5bea0e9 --- /dev/null +++ b/TestJig/.gitignore @@ -0,0 +1,11 @@ +/.pio +/.vscode/.browse.c_cpp.db* +/.vscode/c_cpp_properties.json +/.vscode/launch.json +/.vscode/ipch +/CMakeCache.txt +/cmake_install.cmake +/Makefile +/CMakeFiles +/cmake-build-debug +/.idea diff --git a/TestJig/.vscode/extensions.json b/TestJig/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/TestJig/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/TestJig/CMakeLists.txt b/TestJig/CMakeLists.txt new file mode 100644 index 0000000..2fcbe6d --- /dev/null +++ b/TestJig/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.29) +project(TestJig) + +set(CMAKE_CXX_STANDARD 14) +include_directories( + .pio/libdeps/pico/Adafruit Neopixel + .pio/libdeps/pico/Adafruit GFX Library + .pio/libdeps/pico/Adafruit BusIO + .pio/libdeps/pico/Adafruit SSD1306 + + .pio/packages/framework-arduinopico/cores/rp2040 +) + +add_executable(TestJig + src/main.cpp) diff --git a/TestJig/include/README b/TestJig/include/README new file mode 100644 index 0000000..194dcd4 --- /dev/null +++ b/TestJig/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/TestJig/lib/README b/TestJig/lib/README new file mode 100644 index 0000000..2593a33 --- /dev/null +++ b/TestJig/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 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/TestJig/platformio.ini b/TestJig/platformio.ini new file mode 100644 index 0000000..d7f41b8 --- /dev/null +++ b/TestJig/platformio.ini @@ -0,0 +1,50 @@ +; 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 = pico +platforms_dir = .pio/platforms +libdeps_dir = .pio/libdeps +cache_dir = .pio/cache +build_dir = .pio/build +build_cache_dir = .pio/build_cache +packages_dir = .pio/packages + +[common] +build_flags = + -std=c++17 +build_unflags = + -std=gnu++11 +lib_deps = + adafruit/Adafruit NeoPixel@^1.12.3 + olikraus/U8g2@^2.35.30 + +[env:pico] +platform = https://github.com/maxgerhardt/platform-raspberrypi.git +board = vccgnd_yd_rp2040 +framework = arduino +board_build.core = earlephilhower +board_build.mcu = rp2040 +board_build.f_cpu = 133000000L + +# Used for overloading linker script to do fucky things +#board_build.ldscript = memmap.ld + +# Used for using debug probe +#debug_tool = cmsis-dap +#upload_protocol = cmsis-dap +#debug_init_break = + +monitor_raw = yes +build_flags = + ${common.build_flags} +build_unflags = + ${common.build_unflags} +lib_deps = + ${common.lib_deps} \ No newline at end of file diff --git a/TestJig/src/main.cpp b/TestJig/src/main.cpp new file mode 100644 index 0000000..4b619a2 --- /dev/null +++ b/TestJig/src/main.cpp @@ -0,0 +1,171 @@ +#include +#include +#include +#include +#include +#include + +#define PIXEL_COUNT 124 +#define PIXEL_PIN 16 +#define PIXEL_BRIGHTNESS 10 +//#define SCREEN_RESET_PIN 22 +#define SCREEN_RESET_PIN U8X8_PIN_NONE + +U8X8_SSD1306_72X40_ER_HW_I2C u8x8(SCREEN_RESET_PIN); + +Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800); + +int count = 0; + +void rainbow(int wait) { + for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) { + // apply rainbow to the first 64 pixels + for(int i=0; i<=63; i++) { + int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels()); + strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue))); + } + + // Blank everything over pixel 64 + //for(int j=65; j<=124; j++) strip.setPixelColor(j-1, strip.Color(0,0,0)); + // 65->72 to mirror 4 + for(int j=65; j<=72; j++) strip.setPixelColor(j-1, strip.getPixelColor(4-1)); + // 73->79 to mirror 12 + for(int j=73; j<=79; j++) strip.setPixelColor(j-1, strip.getPixelColor(12-1)); + // 80->86 to mirror 20 + for(int j=80; j<=86; j++) strip.setPixelColor(j-1, strip.getPixelColor(20-1)); + // 87->94 to mirror 28 + for(int j=87; j<=94; j++) strip.setPixelColor(j-1, strip.getPixelColor(28-1)); + // 95->102 to mirror 36 + for(int j=95; j<=102; j++) strip.setPixelColor(j-1, strip.getPixelColor(36-1)); + // 103->109 to mirror 44 + for(int j=103; j<=109; j++) strip.setPixelColor(j-1, strip.getPixelColor(44-1)); + // 110->116 to mirror 52 + for(int j=110; j<=116; j++) strip.setPixelColor(j-1, strip.getPixelColor(52-1)); + // 117->124 to mirror 60 + for(int j=117; j<=124; j++) strip.setPixelColor(j-1, strip.getPixelColor(60-1)); + + // Show and wait + strip.show(); + delay(wait); + } + +} +void all(uint8_t red, uint8_t green, uint8_t blue){ + for(int i=0; i