generated from Weckyy702/pico-nix
Initial commit
This commit is contained in:
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
build/
|
||||
.cache
|
||||
.direnv
|
||||
pico_sdk_import.cmake
|
||||
21
CMakeLists.txt
Normal file
21
CMakeLists.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
project(PicoNix C CXX ASM)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
pico_sdk_init()
|
||||
|
||||
add_executable(main
|
||||
src/main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(main
|
||||
pico_stdlib
|
||||
pico_cyw43_arch_none
|
||||
)
|
||||
|
||||
pico_add_extra_outputs(main)
|
||||
42
flake.lock
generated
Normal file
42
flake.lock
generated
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1771369470,
|
||||
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0182a361324364ae3f436a63005877674cf45efb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "systems",
|
||||
"type": "indirect"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
50
flake.nix
Normal file
50
flake.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs =
|
||||
inputs @ { nixpkgs
|
||||
, systems
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
eachSystem = lib.genAttrs (import systems);
|
||||
pkgsFor = eachSystem (system:
|
||||
import nixpkgs {
|
||||
localSystem = system;
|
||||
});
|
||||
in
|
||||
{
|
||||
devShells =
|
||||
eachSystem
|
||||
(system: {
|
||||
default =
|
||||
let
|
||||
pkgs = pkgsFor.${system};
|
||||
pico-sdk = pkgs.pico-sdk.override {
|
||||
withSubmodules = true;
|
||||
};
|
||||
PICO_SDK_PATH = "${pico-sdk}/lib/pico-sdk";
|
||||
in
|
||||
pkgs.mkShell {
|
||||
name = "PicoVGA dev shell";
|
||||
inputsFrom = [ pico-sdk ];
|
||||
packages = with pkgs;
|
||||
[
|
||||
gcc-arm-embedded
|
||||
python3
|
||||
|
||||
usbutils
|
||||
picotool
|
||||
]
|
||||
++ [ pico-sdk ];
|
||||
|
||||
shellHook = ''
|
||||
ln -sf ${PICO_SDK_PATH}/external/pico_sdk_import.cmake pico_sdk_import.cmake
|
||||
'';
|
||||
|
||||
inherit PICO_SDK_PATH;
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
22
src/main.cpp
Normal file
22
src/main.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2022 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "pico/cyw43_arch.h"
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
int main() {
|
||||
stdio_init_all();
|
||||
if (cyw43_arch_init()) {
|
||||
printf("Wi-Fi init failed");
|
||||
return -1;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user