Initial Release
This commit is contained in:
14
reset/hello_reset/CMakeLists.txt
Normal file
14
reset/hello_reset/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
if (TARGET hardware_resets)
|
||||
add_executable(hello_reset
|
||||
hello_reset.c
|
||||
)
|
||||
|
||||
# Pull in our pico_stdlib which pulls in commonly used features
|
||||
target_link_libraries(hello_reset pico_stdlib hardware_resets)
|
||||
|
||||
# create map/bin/hex file etc.
|
||||
pico_add_extra_outputs(hello_reset)
|
||||
|
||||
# add url via pico_set_program_url
|
||||
example_auto_set_url(hello_reset)
|
||||
endif ()
|
||||
31
reset/hello_reset/hello_reset.c
Normal file
31
reset/hello_reset/hello_reset.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/resets.h"
|
||||
|
||||
/// \tag::hello_reset[]
|
||||
int main() {
|
||||
stdio_init_all();
|
||||
|
||||
printf("Hello, reset!\n");
|
||||
|
||||
// Put the PWM block into reset
|
||||
reset_block(RESETS_RESET_PWM_BITS);
|
||||
|
||||
// And bring it out
|
||||
unreset_block_wait(RESETS_RESET_PWM_BITS);
|
||||
|
||||
// Put the PWM and RTC block into reset
|
||||
reset_block(RESETS_RESET_PWM_BITS | RESETS_RESET_RTC_BITS);
|
||||
|
||||
// Wait for both to come out of reset
|
||||
unreset_block_wait(RESETS_RESET_PWM_BITS | RESETS_RESET_RTC_BITS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/// \end::hello_reset[]
|
||||
Reference in New Issue
Block a user