Initial Release
This commit is contained in:
4
hello_world/CMakeLists.txt
Normal file
4
hello_world/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
if (NOT PICO_NO_HARDWARE)
|
||||
add_subdirectory(usb)
|
||||
add_subdirectory(serial)
|
||||
endif ()
|
||||
12
hello_world/serial/CMakeLists.txt
Normal file
12
hello_world/serial/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
add_executable(hello_serial
|
||||
hello_serial.c
|
||||
)
|
||||
|
||||
# Pull in our pico_stdlib which aggregates commonly used features
|
||||
target_link_libraries(hello_serial pico_stdlib)
|
||||
|
||||
# create map/bin/hex/uf2 file etc.
|
||||
pico_add_extra_outputs(hello_serial)
|
||||
|
||||
# add url via pico_set_program_url
|
||||
example_auto_set_url(hello_serial)
|
||||
17
hello_world/serial/hello_serial.c
Normal file
17
hello_world/serial/hello_serial.c
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
int main() {
|
||||
stdio_init_all();
|
||||
while (true) {
|
||||
printf("Hello, world!\n");
|
||||
sleep_ms(1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
16
hello_world/usb/CMakeLists.txt
Normal file
16
hello_world/usb/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
add_executable(hello_usb
|
||||
hello_usb.c
|
||||
)
|
||||
|
||||
# Pull in our pico_stdlib which aggregates commonly used features
|
||||
target_link_libraries(hello_usb pico_stdlib)
|
||||
|
||||
# enable usb output, disable uart output
|
||||
pico_enable_stdio_usb(hello_usb 1)
|
||||
pico_enable_stdio_uart(hello_usb 0)
|
||||
|
||||
# create map/bin/hex/uf2 file etc.
|
||||
pico_add_extra_outputs(hello_usb)
|
||||
|
||||
# add url via pico_set_program_url
|
||||
example_auto_set_url(hello_usb)
|
||||
17
hello_world/usb/hello_usb.c
Normal file
17
hello_world/usb/hello_usb.c
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
|
||||
int main() {
|
||||
stdio_init_all();
|
||||
while (true) {
|
||||
printf("Hello, world!\n");
|
||||
sleep_ms(1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user