Compare commits
10 commits
master
...
add-gpio-o
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b73332122d | ||
|
|
a2576202ff | ||
|
|
26fd36f853 | ||
|
|
3ad5e1570c | ||
|
|
a2c7d7507b | ||
|
|
ea40696827 | ||
|
|
5867849b17 | ||
|
|
6f7dc67791 | ||
|
|
090c5cd83b | ||
|
|
20b9823aca |
9 changed files with 43 additions and 69 deletions
|
|
@ -1,12 +1,20 @@
|
|||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, pico_base
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, group=pico_base
|
||||
set(PICO_SDK_VERSION_MAJOR 1)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, pico_base
|
||||
set(PICO_SDK_VERSION_MINOR 1)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, pico_base
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_MINOR, SDK minor version number, type=int, group=pico_base
|
||||
set(PICO_SDK_VERSION_MINOR 2)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, group=pico_base
|
||||
set(PICO_SDK_VERSION_REVISION 0)
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_PRE_RELEASE_ID, optional SDK pre-release version identifier, type=string, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_PRE_RELEASE_ID, optional SDK pre-release version identifier, type=string, group=pico_base
|
||||
set(PICO_SDK_VERSION_PRE_RELEASE_ID develop)
|
||||
|
||||
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_STRING, SDK version, type=string, group=pico_base
|
||||
# PICO_CONFIG: PICO_SDK_VERSION_STRING, SDK version, type=string, group=pico_base
|
||||
set(PICO_SDK_VERSION_STRING "${PICO_SDK_VERSION_MAJOR}.${PICO_SDK_VERSION_MINOR}.${PICO_SDK_VERSION_REVISION}")
|
||||
|
||||
if (PICO_SDK_VERSION_PRE_RELEASE_ID)
|
||||
set(PICO_SDK_VERSION_STRING "${PICO_SDK_VERSION_STRING}-${PICO_SDK_VERSION_PRE_RELEASE_ID}")
|
||||
endif()
|
||||
|
|
@ -17,7 +17,7 @@ typedef struct {
|
|||
io_ro_32 gpio_hi_in;
|
||||
uint32_t _pad;
|
||||
|
||||
io_wo_32 gpio_out;
|
||||
io_rw_32 gpio_out;
|
||||
io_wo_32 gpio_set;
|
||||
io_wo_32 gpio_clr;
|
||||
io_wo_32 gpio_togl;
|
||||
|
|
@ -27,7 +27,7 @@ typedef struct {
|
|||
io_wo_32 gpio_oe_clr;
|
||||
io_wo_32 gpio_oe_togl;
|
||||
|
||||
io_wo_32 gpio_hi_out;
|
||||
io_rw_32 gpio_hi_out;
|
||||
io_wo_32 gpio_hi_set;
|
||||
io_wo_32 gpio_hi_clr;
|
||||
io_wo_32 gpio_hi_togl;
|
||||
|
|
|
|||
|
|
@ -415,6 +415,26 @@ static inline void gpio_put(uint gpio, bool value) {
|
|||
gpio_clr_mask(mask);
|
||||
}
|
||||
|
||||
/*! \brief Determine whether a GPIO is currently driven high or low
|
||||
* \ingroup hardware_gpio
|
||||
*
|
||||
* This function returns the high/low output level most recently assigned to a
|
||||
* GPIO via gpio_put() or similar. This is the value that is presented outward
|
||||
* to the IO muxing, *not* the input level back from the pad (which can be
|
||||
* read using gpio_get()).
|
||||
*
|
||||
* To avoid races, this function must not be used for read-modify-write
|
||||
* sequences when driving GPIOs -- instead functions like gpio_put() should be
|
||||
* used to atomically update GPIOs. This accessor is intended for debug use
|
||||
* only.
|
||||
*
|
||||
* \param gpio GPIO number
|
||||
* \return true if the GPIO output level is high, false if low.
|
||||
*/
|
||||
static inline bool gpio_get_out_level(uint gpio) {
|
||||
return !!(sio_hw->gpio_out & 1u << gpio);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Direction
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static_assert(PIO_INSTRUCTION_COUNT <= 32, "");
|
|||
static uint32_t _used_instruction_space[2];
|
||||
|
||||
static int _pio_find_offset_for_program(PIO pio, const pio_program_t *program) {
|
||||
assert(program->length < PIO_INSTRUCTION_COUNT);
|
||||
assert(program->length <= PIO_INSTRUCTION_COUNT);
|
||||
uint32_t used_mask = _used_instruction_space[pio_get_index(pio)];
|
||||
uint32_t program_mask = (1u << program->length) - 1;
|
||||
if (program->origin >= 0) {
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ inline static void restore_interrupts(uint32_t status) {
|
|||
* \return The spinlock instance
|
||||
*/
|
||||
inline static spin_lock_t *spin_lock_instance(uint lock_num) {
|
||||
invalid_params_if(SYNC, lock_num >= NUM_SPIN_LOCKS);
|
||||
return (spin_lock_t *) (SIO_BASE + SIO_SPINLOCK0_OFFSET + lock_num * 4);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,10 +84,10 @@ static inline bool multicore_fifo_rvalid(void) {
|
|||
return !!(sio_hw->fifo_st & SIO_FIFO_ST_VLD_BITS);
|
||||
}
|
||||
|
||||
/*! \brief Check the FIFO to see if the write FIFO is full
|
||||
/*! \brief Check the write FIFO to see if it is ready for more data
|
||||
* \ingroup multicore_fifo
|
||||
*
|
||||
* @return true if the FIFO is full, false otherwise
|
||||
* @return true if the FIFO has room for more data, false otherwise
|
||||
*/
|
||||
static inline bool multicore_fifo_wready(void) {
|
||||
return !!(sio_hw->fifo_st & SIO_FIFO_ST_RDY_BITS);
|
||||
|
|
|
|||
|
|
@ -44,17 +44,3 @@ function(pico_add_uf2_output TARGET)
|
|||
COMMAND ELF2UF2 ${TARGET}${CMAKE_EXECUTABLE_SUFFIX} ${TARGET}.uf2)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if (NOT DEFINED PICO_BUILD_PICOFLASH)
|
||||
if (DEFINED ENV{PICO_BUILD_PICOFLASH})
|
||||
set(PICO_BUILD_PICOFLASH $ENV{PICO_BUILD_PICOFLASH})
|
||||
else()
|
||||
# for now
|
||||
set(PICO_BUILD_PICOFLASH 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (PICO_BUILD_PICOTOOL)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools)
|
||||
find_package(Picotool REQUIRED)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
# Finds (or builds) the PICOTOOL executable
|
||||
#
|
||||
# This will define the following variables
|
||||
#
|
||||
# PICOTOOL_FOUND
|
||||
#
|
||||
# and the following imported targets
|
||||
#
|
||||
# PICOTOOL
|
||||
#
|
||||
|
||||
if (NOT PICOTOOL_FOUND)
|
||||
# todo we would like to use pckgconfig to look for it first
|
||||
# see https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
set(PICOTOOL_SOURCE_DIR ${PICO_SDK_PATH}/tools/picotool)
|
||||
set(PICOTOOL_BINARY_DIR ${CMAKE_BINARY_DIR}/picotool)
|
||||
|
||||
set(PICOTOOL_BUILD_TARGET PicotoolBuild)
|
||||
set(PICOTOOL_TARGET Picotool)
|
||||
|
||||
if (NOT TARGET ${PICOTOOL_BUILD_TARGET})
|
||||
message("PICOTOOL will need to be built")
|
||||
ExternalProject_Add(${PICOTOOL_BUILD_TARGET}
|
||||
PREFIX picotool SOURCE_DIR ${PICOTOOL_SOURCE_DIR}
|
||||
BINARY_DIR ${PICOTOOL_BINARY_DIR}
|
||||
BUILD_ALWAYS 1 # force dependency checking
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
|
||||
set(PICOTOOL_EXECUTABLE ${PICOTOOL_BINARY_DIR}/picotool)
|
||||
if(NOT TARGET ${PICOTOOL_TARGET})
|
||||
add_executable(${PICOTOOL_TARGET} IMPORTED)
|
||||
endif()
|
||||
set_property(TARGET ${PICOTOOL_TARGET} PROPERTY IMPORTED_LOCATION
|
||||
${PICOTOOL_EXECUTABLE})
|
||||
|
||||
add_dependencies(${PICOTOOL_TARGET} ${PICOTOOL_BUILD_TARGET})
|
||||
set(PICOTOOL_FOUND 1)
|
||||
endif()
|
||||
|
|
@ -68,6 +68,8 @@ struct c_sdk_output : public output_format {
|
|||
|
||||
header(out, "This file is autogenerated by pioasm; do not edit!");
|
||||
|
||||
fprintf(out, "#pragma once\n");
|
||||
fprintf(out, "\n");
|
||||
fprintf(out, "#if !PICO_NO_HARDWARE\n");
|
||||
fprintf(out, "#include \"hardware/pio.h\"\n");
|
||||
fprintf(out, "#endif\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue