diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3f9d8db --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/traegerController.iml b/.idea/traegerController.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/traegerController.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..97f98cd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index e97fe4c..f884574 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ pico_sdk_init() # Add executable. Default name is the project name, version 0.1 -add_executable(traegerController traegerController.cpp ) +add_executable(traegerController traegerController.cpp traegerLogo.h) pico_set_program_name(traegerController "traegerController") pico_set_program_version(traegerController "0.1") diff --git a/picoprobe.cfg b/picoprobe.cfg new file mode 100644 index 0000000..8850aaa --- /dev/null +++ b/picoprobe.cfg @@ -0,0 +1,5 @@ +source [find interface/picoprobe.cfg] +transport select swd +adapter speed 5000 + +source [find target/rp2040.cfg] \ No newline at end of file diff --git a/traegerController.cpp b/traegerController.cpp index 7bdb763..d602b1a 100644 --- a/traegerController.cpp +++ b/traegerController.cpp @@ -7,6 +7,8 @@ #include "hardware/i2c.h" #include "hardware/timer.h" +#include "traegerLogo.h" + // SPI Defines // We are going to use SPI 0, and allocate it to the following GPIO pins // Pins can be changed, see the GPIO function select table in the datasheet for information on GPIO assignments @@ -32,29 +34,11 @@ int64_t alarm_callback(alarm_id_t id, void *user_data) { return 0; } -void core1_entry() +[[noreturn]] void core1_entry() { - -} - -int main() -{ - stdio_init_all(); - - // SPI initialisation. This example will use SPI at 1MHz. - spi_init(SPI_PORT, 1000*1000); - gpio_set_function(PIN_MISO, GPIO_FUNC_SPI); - gpio_set_function(PIN_CS, GPIO_FUNC_SIO); - gpio_set_function(PIN_SCK, GPIO_FUNC_SPI); - gpio_set_function(PIN_MOSI, GPIO_FUNC_SPI); - - // Chip select is active-low, so we'll initialise it to a driven-high state - gpio_set_dir(PIN_CS, GPIO_OUT); - gpio_put(PIN_CS, 1); - // I2C Initialisation. Using it at 400Khz. i2c_init(I2C_PORT, 400*1000); - + gpio_set_function(I2C_SDA, GPIO_FUNC_I2C); gpio_set_function(I2C_SCL, GPIO_FUNC_I2C); gpio_pull_up(I2C_SDA); @@ -75,6 +59,12 @@ int main() sleep_ms(1000); display.setRotation(1); + display.clearDisplay(); + display.drawBitmap(0, 0, logo, 128, 64, SH110X_WHITE); + display.display(); + + sleep_ms(1000); + display.clearDisplay(); display.display(); @@ -82,25 +72,46 @@ int main() display.setTextSize(1); display.setTextColor(SH110X_WHITE); display.setCursor(0,0); - display.print("Hello from core 0!"); + display.print("Hello! core 1\n"); display.display(); - //multicore_launch_core1(core1_entry); - sleep_ms(1000); + display.setTextSize(2); while(true) { - if (gpio_get(BUTTON_A) == false) display.print("A\n"); - if (gpio_get(BUTTON_B) == false) display.print("B\n"); - if (gpio_get(BUTTON_C) == false) display.print("C\n"); + display.clearDisplay(); + display.setCursor(0,0); + display.print(!gpio_get(BUTTON_A) ? "A\n" : "\n"); + display.print(!gpio_get(BUTTON_B) ? "B\n" : "\n"); + display.print(!gpio_get(BUTTON_C) ? "C\n" : "\n"); display.display(); - sleep_ms(250); + sleep_ms(100); } +} + +int main() +{ + stdio_init_all(); + + // SPI initialisation. This example will use SPI at 1MHz. + spi_init(SPI_PORT, 1000*1000); + gpio_set_function(PIN_MISO, GPIO_FUNC_SPI); + gpio_set_function(PIN_CS, GPIO_FUNC_SIO); + gpio_set_function(PIN_SCK, GPIO_FUNC_SPI); + gpio_set_function(PIN_MOSI, GPIO_FUNC_SPI); + + // Chip select is active-low, so we'll initialise it to a driven-high state + gpio_set_dir(PIN_CS, GPIO_OUT); + gpio_put(PIN_CS, 1); + + multicore_launch_core1(core1_entry); // Timer example code - This example fires off the callback after 2000ms add_alarm_in_ms(2000, alarm_callback, NULL, false); puts("Hello, world!"); - return 0; + while(true) { + tight_loop_contents(); + } } diff --git a/traegerLogo.bmp b/traegerLogo.bmp new file mode 100644 index 0000000..faeb1a9 Binary files /dev/null and b/traegerLogo.bmp differ diff --git a/traegerLogo.h b/traegerLogo.h new file mode 100644 index 0000000..14b1163 --- /dev/null +++ b/traegerLogo.h @@ -0,0 +1,84 @@ +// +// Created by Mikah Chapman on 6/27/22. +// + +#ifndef TRAEGERCONTROLLER_TRAEGERLOGO_H +#define TRAEGERCONTROLLER_TRAEGERLOGO_H +/** + * Made with Marlin Bitmap Converter + * https://marlinfw.org/tools/u8glib/converter.html + * + * This bitmap from the file 'traegerLogo.bmp' + */ +#pragma once + +#define LOGO_BMPWIDTH 128 + +const unsigned char logo[] = { + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11000000,B00000000,B00000000,B00000000,B00100000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11110000,B00000000,B00000000,B00000000,B00110000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11111000,B00000000,B00000000,B00000000,B01110000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B00111100,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000110,B00000000,B00011100,B00001111,B00000000,B00000000,B00000000,B01111000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00001111,B10000000,B01111001,B10000011,B10000000,B00001000,B00000000,B11111000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00111101,B11100000,B11100111,B10000001,B11100000,B00111110,B00000000,B11111000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,B01111011,B11001111,B10000000,B01110001,B11100011,B10000000,B11111100,B00100000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000011,B11001100,B00011111,B00111111,B10000000,B00111111,B10011000,B11000000,B11111000,B01100000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00001111,B00111000,B00001110,B11111111,B00000000,B00011111,B11110000,B00110001,B11111100,B01100000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,B00111011,B11111111,B10000000,B00000111,B11110000,B00001000,B11111000,B01110000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B11111111,B11110000,B01111111,B11111111,B11000000,B00000011,B11111000,B00000001,B11111110,B01110000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B11111111,B01100001,B11111111,B11111111,B10000000,B00000000,B11100000,B00000000,B11111100,B11110000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000111,B11111110,B01000111,B11111110,B11111111,B10000000,B00000000,B01110000,B00000001,B11111110,B01110000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00111111,B11111110,B00001111,B11111100,B11111111,B00000000,B00000000,B00011110,B00000010,B11111100,B11110000,B00000000,B00000000, + B00000000,B00000000,B00000001,B11111111,B11110000,B00111111,B11111001,B11001110,B00000000,B00000000,B00000111,B10000001,B11111100,B11111000,B00000000,B00000000, + B00000000,B00000000,B00011111,B11111110,B01100000,B11111111,B11110001,B10001100,B00000000,B00000000,B00000000,B11100000,B11111100,B11110000,B00000000,B00000000, + B00000000,B00000011,B11111111,B11110000,B01000011,B11111111,B11100011,B00011100,B00000000,B00000000,B00000000,B00011100,B10111001,B11111000,B00000000,B00000000, + B00000000,B00000000,B00000111,B00000000,B00001111,B11111111,B10000010,B00011000,B00000000,B00000000,B00000000,B00000011,B00110000,B11111000,B00000000,B00000000, + B00000000,B00000000,B00111000,B00000000,B01111111,B11111100,B00000000,B00010000,B00000000,B00000000,B00000000,B00000000,B00110000,B11110000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000001,B11110011,B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110100,B00100000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00001111,B00000111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01110001,B11100000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00001110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,B00000000,B00000000,B00000000,B00000000,B01111110,B01000000,B00000000,B00000000,B00000000,B00000000, + B11111111,B11111111,B00011111,B11111110,B00000000,B00000111,B00000000,B00111111,B11111110,B00000001,B11111111,B11100001,B11111111,B11110000,B11111111,B11110000, + B11100001,B11000011,B00001110,B00001111,B00000000,B00000111,B00000000,B00011100,B00000110,B00000111,B10000001,B11100000,B11100000,B00110000,B01110000,B01111100, + B11000001,B10000001,B00001110,B00000011,B10000000,B00001111,B00000000,B00011100,B00000110,B00001110,B00000000,B11100000,B11100000,B00110000,B01110000,B00011100, + B00000001,B10000000,B00001110,B00000011,B10000000,B00001111,B10000000,B00011100,B00000000,B00011100,B00000000,B01100000,B11100000,B00000000,B01110000,B00011100, + B00000001,B10000000,B00001110,B00000011,B10000000,B00011001,B10000000,B00011100,B00000000,B00011100,B00000000,B01000000,B11100000,B00000000,B01110000,B00011100, + B00000001,B10000000,B00001110,B00000011,B10000000,B00011001,B11000000,B00011100,B00000000,B00111000,B00000000,B00000000,B11100000,B00000000,B01110000,B00011100, + B00000001,B10000000,B00001110,B00000111,B00000000,B00010000,B11000000,B00011100,B00000000,B00111000,B00000000,B00000000,B11100000,B00000000,B01110000,B00111000, + B00000001,B10000000,B00001110,B00001110,B00000000,B00110000,B11100000,B00011100,B00001000,B00111000,B00000000,B00000000,B11100000,B01000000,B01110000,B01110000, + B00000001,B10000000,B00001111,B11111100,B00000000,B00110000,B01100000,B00011111,B11111000,B00111000,B00000000,B00000000,B11111111,B11000000,B01111111,B11100000, + B00000001,B10000000,B00001111,B11111100,B00000000,B01100000,B01110000,B00011100,B00001000,B00111000,B00000011,B11111000,B11100000,B01000000,B01111111,B11100000, + B00000001,B10000000,B00001110,B00011100,B00000000,B01111111,B11110000,B00011100,B00000000,B00111000,B00000000,B11100000,B11100000,B00000000,B01110000,B11100000, + B00000001,B10000000,B00001110,B00001110,B00000000,B11111111,B11111000,B00011100,B00000000,B00111000,B00000000,B11100000,B11100000,B00000000,B01110000,B01110000, + B00000001,B10000000,B00001110,B00000111,B00000000,B11000000,B00111000,B00011100,B00000000,B00111000,B00000000,B11100000,B11100000,B00000000,B01110000,B00111000, + B00000001,B10000000,B00001110,B00000111,B00000000,B11000000,B00111000,B00011100,B00000000,B00011100,B00000000,B11100000,B11100000,B00000000,B01110000,B00111000, + B00000001,B10000000,B00001110,B00000011,B10000001,B10000000,B00011100,B00011100,B00000001,B00011110,B00000000,B11100000,B11100000,B00001000,B01110000,B00011100, + B00000001,B10000000,B00001110,B00000011,B10000001,B10000000,B00011100,B00011100,B00000011,B00001111,B00000000,B11100000,B11100000,B00011000,B01110000,B00011100, + B00000011,B11000000,B00011111,B00000011,B11000111,B11000000,B00011110,B00111111,B11111111,B00000111,B11000011,B11000001,B11111111,B11111000,B11111000,B00011110, + B00000111,B11100000,B00011111,B00000111,B11100111,B11100000,B00111111,B00111111,B11111111,B00000001,B11111111,B00000001,B11111111,B11111000,B11111000,B00111111, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000, + B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000 +}; + +#endif //TRAEGERCONTROLLER_TRAEGERLOGO_H diff --git a/traegerLogo.svg b/traegerLogo.svg new file mode 100644 index 0000000..f4a86a1 --- /dev/null +++ b/traegerLogo.svg @@ -0,0 +1 @@ +Logos_Traeger White on Transparent Logo_Traeger-1472x691-57875f7 (1) \ No newline at end of file