diff --git a/CMakeLists.txt b/CMakeLists.txt index 979cd2e..90958b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20) include(pico_sdk_import.cmake) -project(PicoNix C CXX ASM) +project(PicoVGA C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 23) @@ -15,7 +15,9 @@ add_executable(main target_link_libraries(main pico_stdlib - pico_cyw43_arch_none + hardware_gpio ) pico_add_extra_outputs(main) +pico_enable_stdio_usb(main 0) +pico_enable_stdio_uart(main 1) diff --git a/flake.nix b/flake.nix index 72df09d..f4fe9c1 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,7 @@ usbutils picotool + picocom ] ++ [ pico-sdk ]; diff --git a/src/main.cpp b/src/main.cpp index 83cf410..8c53019 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,22 +1,25 @@ -/** - * Copyright (c) 2022 Raspberry Pi (Trading) Ltd. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "pico/cyw43_arch.h" +#include "hardware/gpio.h" #include "pico/stdlib.h" +#include +#include +#include + +constexpr static uint start_pin = 2; +constexpr static uint pin_mask = (0xFFF) << start_pin; int main() { stdio_init_all(); - if (cyw43_arch_init()) { - printf("Wi-Fi init failed"); - return -1; + + for (uint offset{}; offset != 14; ++offset) { + auto const pin = start_pin + offset; + gpio_init(pin); + gpio_set_dir(pin, GPIO_OUT); } - while (true) { - cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 1); - sleep_ms(500); - cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0); - sleep_ms(500); + + for (uint16_t pixel{};; ++pixel) { + auto const set_mask = (pixel & 0xFFF) << start_pin; + printf("Set mask=%03x", pixel); + gpio_put_masked(pin_mask, set_mask); + sleep_ms(100); } }