mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
Compare commits
2 commits
34b01c8677
...
f73f486bb4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f73f486bb4 | ||
|
|
fd2d149ffc |
1 changed files with 31 additions and 16 deletions
|
|
@ -242,25 +242,40 @@ uint gpio_get_dir(uint gpio);
|
|||
#if PICO_SECURE
|
||||
void gpio_assign_to_ns(uint gpio, bool ns);
|
||||
#endif
|
||||
|
||||
// debugging
|
||||
#ifndef PICO_DEBUG_PIN_BASE
|
||||
#define PICO_DEBUG_PIN_BASE 19u
|
||||
#endif
|
||||
|
||||
// note these two macros may only be used once per compilation unit
|
||||
#define CU_REGISTER_DEBUG_PINS(p, ...)
|
||||
#define CU_SELECT_DEBUG_PINS(x)
|
||||
#define DEBUG_PINS_ENABLED(p) false
|
||||
|
||||
#define DEBUG_PINS_SET(p, v) ((void)0)
|
||||
#define DEBUG_PINS_CLR(p, v) ((void)0)
|
||||
#define DEBUG_PINS_XOR(p, v) ((void)0)
|
||||
|
||||
void gpio_debug_pins_init();
|
||||
extern void gpio_debug_pins_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// PICO_CONFIG: PICO_DEBUG_PIN_BASE, First pin to use for debug output (if enabled), min=0, max=31 on RP2350B, 29 otherwise, default=19, group=hardware_gpio
|
||||
#ifndef PICO_DEBUG_PIN_BASE
|
||||
#define PICO_DEBUG_PIN_BASE 19u
|
||||
#endif
|
||||
|
||||
// PICO_CONFIG: PICO_DEBUG_PIN_COUNT, Number of pins to use for debug output (if enabled), min=1, max=32 on RP2350B, 30 otherwise, default=3, group=hardware_gpio
|
||||
#ifndef PICO_DEBUG_PIN_COUNT
|
||||
#define PICO_DEBUG_PIN_COUNT 3u
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
// note these two macros may only be used once per and only apply per compilation unit (hence the CU_)
|
||||
#define CU_REGISTER_DEBUG_PINS(...) enum __unused DEBUG_PIN_TYPE { _none = 0, __VA_ARGS__ }; static enum DEBUG_PIN_TYPE __selected_debug_pins;
|
||||
#define CU_SELECT_DEBUG_PINS(x) static enum DEBUG_PIN_TYPE __selected_debug_pins = (x);
|
||||
#define DEBUG_PINS_ENABLED(p) (__selected_debug_pins == (p))
|
||||
#else
|
||||
#define CU_REGISTER_DEBUG_PINS(p...) \
|
||||
enum DEBUG_PIN_TYPE { _none = 0, p }; \
|
||||
template <enum DEBUG_PIN_TYPE> class __debug_pin_settings { \
|
||||
public: \
|
||||
static inline bool enabled() { return false; } \
|
||||
};
|
||||
#define CU_SELECT_DEBUG_PINS(x) template<> inline bool __debug_pin_settings<x>::enabled() { return true; };
|
||||
#define DEBUG_PINS_ENABLED(p) (__debug_pin_settings<p>::enabled())
|
||||
#endif
|
||||
#define DEBUG_PINS_SET(p, v) if (DEBUG_PINS_ENABLED(p)) gpio_set_mask((unsigned)(v)<<PICO_DEBUG_PIN_BASE)
|
||||
#define DEBUG_PINS_CLR(p, v) if (DEBUG_PINS_ENABLED(p)) gpio_clr_mask((unsigned)(v)<<PICO_DEBUG_PIN_BASE)
|
||||
#define DEBUG_PINS_XOR(p, v) if (DEBUG_PINS_ENABLED(p)) gpio_xor_mask((unsigned)(v)<<PICO_DEBUG_PIN_BASE)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue