generated from Weckyy702/pico-nix
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:
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20)
|
|||||||
|
|
||||||
include(pico_sdk_import.cmake)
|
include(pico_sdk_import.cmake)
|
||||||
|
|
||||||
project(PicoNix C CXX ASM)
|
project(PicoVGA C CXX ASM)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
@@ -15,7 +15,9 @@ add_executable(main
|
|||||||
|
|
||||||
target_link_libraries(main
|
target_link_libraries(main
|
||||||
pico_stdlib
|
pico_stdlib
|
||||||
pico_cyw43_arch_none
|
hardware_gpio
|
||||||
)
|
)
|
||||||
|
|
||||||
pico_add_extra_outputs(main)
|
pico_add_extra_outputs(main)
|
||||||
|
pico_enable_stdio_usb(main 0)
|
||||||
|
pico_enable_stdio_uart(main 1)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
usbutils
|
usbutils
|
||||||
picotool
|
picotool
|
||||||
|
picocom
|
||||||
]
|
]
|
||||||
++ [ pico-sdk ];
|
++ [ pico-sdk ];
|
||||||
|
|
||||||
|
|||||||
33
src/main.cpp
33
src/main.cpp
@@ -1,22 +1,25 @@
|
|||||||
/**
|
#include "hardware/gpio.h"
|
||||||
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "pico/cyw43_arch.h"
|
|
||||||
#include "pico/stdlib.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() {
|
int main() {
|
||||||
stdio_init_all();
|
stdio_init_all();
|
||||||
if (cyw43_arch_init()) {
|
|
||||||
printf("Wi-Fi init failed");
|
for (uint offset{}; offset != 14; ++offset) {
|
||||||
return -1;
|
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);
|
for (uint16_t pixel{};; ++pixel) {
|
||||||
sleep_ms(500);
|
auto const set_mask = (pixel & 0xFFF) << start_pin;
|
||||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, 0);
|
printf("Set mask=%03x", pixel);
|
||||||
sleep_ms(500);
|
gpio_put_masked(pin_mask, set_mask);
|
||||||
|
sleep_ms(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user