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

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