Moved folders.
This commit is contained in:
parent
51d751b698
commit
14078ffda0
|
|
@ -6,7 +6,7 @@ SOURCES := \
|
|||
src/main.c
|
||||
|
||||
# Output target name
|
||||
OUTPUT := GCC_Project
|
||||
OUTPUT := C
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
build
|
||||
.vscode/ccls-cache
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build",
|
||||
"detail": "Build project",
|
||||
"type": "shell",
|
||||
"command": "cmake -H. -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=YES && make -j$(nproc) -C build",
|
||||
"args": [
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": true,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Clean",
|
||||
"detail": "Clean build directory and executable",
|
||||
"type": "shell",
|
||||
"command": "rm -rf build",
|
||||
"args": [
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": false,
|
||||
"reveal": "never",
|
||||
"focus": false,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": false,
|
||||
"clear": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Flash",
|
||||
"detail": "Flash executable",
|
||||
"type": "shell",
|
||||
"dependsOn": "Build",
|
||||
"command": "cd build && make Flash",
|
||||
"args": [
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": true,
|
||||
"panel": "shared",
|
||||
"showReuseMessage": true,
|
||||
"clear": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
# Explicitely define board.
|
||||
set(PICO_BOARD pico)
|
||||
if(NOT DEFINED PICO_BOARD)
|
||||
add_definitions(-DPICO_BOARD=${PICO_BOARD})
|
||||
endif()
|
||||
|
||||
# Need to include pico-sdk cmake support. Must happen before project.
|
||||
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
|
||||
|
||||
project(PicoW_UDP_Tests C CXX ASM)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
pico_sdk_init()
|
||||
|
||||
add_executable(PicoW_UDP_Tests
|
||||
src/main.c
|
||||
)
|
||||
|
||||
target_link_libraries(PicoW_UDP_Tests
|
||||
pico_stdlib
|
||||
)
|
||||
|
||||
# Stdio configuration
|
||||
pico_enable_stdio_usb(PicoW_UDP_Tests 1)
|
||||
pico_enable_stdio_uart(PicoW_UDP_Tests 1)
|
||||
|
||||
pico_add_extra_outputs(PicoW_UDP_Tests)
|
||||
|
||||
add_custom_target(Flash
|
||||
DEPENDS PicoW_UDP_Tests
|
||||
COMMAND picotool load -f ${PROJECT_BINARY_DIR}/PicoW_UDP_Tests.uf2
|
||||
)
|
||||
|
|
@ -0,0 +1 @@
|
|||
build/compile_commands.json
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <pico/stdlib.h>
|
||||
|
||||
#ifdef CYW43_WL_GPIO_LED_PIN
|
||||
// Pico W devices use a GPIO on the WIFI chip for the LED,
|
||||
// so when building for Pico W, CYW43_WL_GPIO_LED_PIN will be defined
|
||||
#include <pico/cyw43_arch.h>
|
||||
#endif
|
||||
|
||||
#ifndef LED_DELAY_MS
|
||||
#define LED_DELAY_MS 250
|
||||
#endif
|
||||
|
||||
// Perform initialisation
|
||||
int pico_led_init(void)
|
||||
{
|
||||
#if defined(PICO_DEFAULT_LED_PIN)
|
||||
// A device like Pico that uses a GPIO for the LED will define PICO_DEFAULT_LED_PIN
|
||||
// so we can use normal GPIO functionality to turn the led on and off
|
||||
gpio_init(PICO_DEFAULT_LED_PIN);
|
||||
gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);
|
||||
return PICO_OK;
|
||||
#elif defined(CYW43_WL_GPIO_LED_PIN)
|
||||
// For Pico W devices we need to initialise the driver etc
|
||||
return cyw43_arch_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Turn the led on or off
|
||||
void pico_set_led(bool led_on)
|
||||
{
|
||||
#if defined(PICO_DEFAULT_LED_PIN)
|
||||
// Just set the GPIO on or off
|
||||
gpio_put(PICO_DEFAULT_LED_PIN, led_on);
|
||||
#elif defined(CYW43_WL_GPIO_LED_PIN)
|
||||
// Ask the wifi "driver" to set the GPIO on or off
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, led_on);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
stdio_init_all();
|
||||
|
||||
hard_assert(pico_led_init() == PICO_OK);
|
||||
|
||||
while(true)
|
||||
{
|
||||
pico_set_led(true);
|
||||
sleep_ms(LED_DELAY_MS);
|
||||
pico_set_led(false);
|
||||
sleep_ms(LED_DELAY_MS);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue