Rebuild DAC and first functioning PoC

By just counting the gpio mask up, we can see the different voltages update they should :^)
This commit is contained in:
Weckyy702
2026-02-23 23:59:10 +01:00
parent 9adbcce9c6
commit ceb9d9fc17
3 changed files with 23 additions and 17 deletions

View File

@@ -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)

View File

@@ -36,6 +36,7 @@
usbutils
picotool
picocom
]
++ [ pico-sdk ];

View File

@@ -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 <cstdint>
#include <cstdio>
#include <pico/time.h>
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);
}
}