Add missing extern "C" to header files (closes #104)

This commit is contained in:
Luke Wren 2021-02-09 14:47:16 +00:00 committed by graham sanderson
parent 0f4a5f8e60
commit d4c9dced40
11 changed files with 85 additions and 0 deletions

View File

@ -48,6 +48,10 @@
* leaving the other bits unchanged. * leaving the other bits unchanged.
*/ */
#ifdef __cplusplus
extern "C" {
#endif
#define check_hw_layout(type, member, offset) static_assert(offsetof(type, member) == (offset), "hw offset mismatch") #define check_hw_layout(type, member, offset) static_assert(offsetof(type, member) == (offset), "hw offset mismatch")
#define check_hw_size(type, size) static_assert(sizeof(type) == (size), "hw size mismatch") #define check_hw_size(type, size) static_assert(sizeof(type) == (size), "hw size mismatch")
@ -120,4 +124,8 @@ inline static void hw_write_masked(io_rw_32 *addr, uint32_t values, uint32_t wri
hw_xor_bits(addr, (*addr ^ values) & write_mask); hw_xor_bits(addr, (*addr ^ values) & write_mask);
} }
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -32,6 +32,10 @@
* 3. Finding unused resources * 3. Finding unused resources
*/ */
#ifdef __cplusplus
extern "C" {
#endif
/*! \brief Atomically claim a resource, panicking if it is already in use /*! \brief Atomically claim a resource, panicking if it is already in use
* \ingroup hardware_claim * \ingroup hardware_claim
* *
@ -98,4 +102,8 @@ uint32_t hw_claim_lock(void);
*/ */
void hw_claim_unlock(uint32_t token); void hw_claim_unlock(uint32_t token);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -36,6 +36,10 @@
* \include hello_divider.c * \include hello_divider.c
*/ */
#ifdef __cplusplus
extern "C" {
#endif
typedef uint64_t divmod_result_t; typedef uint64_t divmod_result_t;
/*! \brief Start a signed asynchronous divide /*! \brief Start a signed asynchronous divide
@ -392,4 +396,8 @@ void hw_divider_save_state(hw_divider_state_t *dest);
void hw_divider_restore_state(hw_divider_state_t *src); void hw_divider_restore_state(hw_divider_state_t *src);
#ifdef __cplusplus
}
#endif
#endif // _HARDWARE_DIVIDER_H #endif // _HARDWARE_DIVIDER_H

View File

@ -44,6 +44,9 @@
* \include flash_program.c * \include flash_program.c
*/ */
#ifdef __cplusplus
extern "C" {
#endif
/*! \brief Erase areas of flash /*! \brief Erase areas of flash
* \ingroup hardware_flash * \ingroup hardware_flash
@ -75,4 +78,8 @@ void flash_range_program(uint32_t flash_offs, const uint8_t *data, size_t count)
*/ */
void flash_get_unique_id(uint8_t *id_out); void flash_get_unique_id(uint8_t *id_out);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -56,6 +56,10 @@
* \include hello_reset.c * \include hello_reset.c
*/ */
#ifdef __cplusplus
extern "C" {
#endif
/// \tag::reset_funcs[] /// \tag::reset_funcs[]
/*! \brief Reset the specified HW blocks /*! \brief Reset the specified HW blocks
@ -88,4 +92,8 @@ static inline void unreset_block_wait(uint32_t bits) {
} }
/// \end::reset_funcs[] /// \end::reset_funcs[]
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -28,6 +28,9 @@
* \include hello_rtc.c * \include hello_rtc.c
*/ */
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*rtc_callback_t)(void); typedef void (*rtc_callback_t)(void);
@ -71,4 +74,8 @@ void rtc_set_alarm(datetime_t *t, rtc_callback_t user_callback);
*/ */
void rtc_disable_alarm(void); void rtc_disable_alarm(void);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -25,6 +25,10 @@
* \include hello_watchdog.c * \include hello_watchdog.c
*/ */
#ifdef __cplusplus
extern "C" {
#endif
/*! \brief Define actions to perform at watchdog timeout /*! \brief Define actions to perform at watchdog timeout
* \ingroup hardware_watchdog * \ingroup hardware_watchdog
* *
@ -84,4 +88,8 @@ bool watchdog_caused_reboot(void);
*/ */
uint32_t watchdog_get_count(void); uint32_t watchdog_get_count(void);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -14,6 +14,9 @@
* Access to functions and data in the RP2040 bootrom * Access to functions and data in the RP2040 bootrom
*/ */
#ifdef __cplusplus
extern "C" {
#endif
/*! \brief Return a bootrom lookup code based on two ASCII characters /*! \brief Return a bootrom lookup code based on two ASCII characters
* \ingroup pico_bootrom * \ingroup pico_bootrom
@ -82,4 +85,8 @@ static inline void __attribute__((noreturn)) reset_usb_boot(uint32_t usb_activit
func(usb_activity_gpio_pin_mask, disable_interface_mask); func(usb_activity_gpio_pin_mask, disable_interface_mask);
} }
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -22,6 +22,10 @@
#define PICO_STDIO_SEMIHOSTING_DEFAULT_CRLF PICO_STDIO_DEFAULT_CRLF #define PICO_STDIO_SEMIHOSTING_DEFAULT_CRLF PICO_STDIO_DEFAULT_CRLF
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
extern stdio_driver_t stdio_semihosting; extern stdio_driver_t stdio_semihosting;
/*! \brief Explicitly initialize stdout over semihosting and add it to the current set of stdout targets /*! \brief Explicitly initialize stdout over semihosting and add it to the current set of stdout targets
@ -31,4 +35,8 @@ extern stdio_driver_t stdio_semihosting;
*/ */
void stdio_semihosting_init(void); void stdio_semihosting_init(void);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -23,6 +23,10 @@
#define PICO_STDIO_UART_DEFAULT_CRLF PICO_STDIO_DEFAULT_CRLF #define PICO_STDIO_UART_DEFAULT_CRLF PICO_STDIO_DEFAULT_CRLF
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
extern stdio_driver_t stdio_uart; extern stdio_driver_t stdio_uart;
/*! \brief Explicitly initialize stdin/stdout over UART and add it to the current set of stdin/stdout drivers /*! \brief Explicitly initialize stdin/stdout over UART and add it to the current set of stdin/stdout drivers
@ -59,4 +63,8 @@ void stdin_uart_init(void);
*/ */
void stdio_uart_init_full(uart_inst_t *uart, uint baud_rate, int tx_pin, int rx_pin); void stdio_uart_init_full(uart_inst_t *uart, uint baud_rate, int tx_pin, int rx_pin);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -42,6 +42,10 @@
#define PICO_STDIO_USB_LOW_PRIORITY_IRQ 31 #define PICO_STDIO_USB_LOW_PRIORITY_IRQ 31
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
extern stdio_driver_t stdio_usb; extern stdio_driver_t stdio_usb;
/*! \brief Explicitly initialize USB stdio and add it to the current set of stdin drivers /*! \brief Explicitly initialize USB stdio and add it to the current set of stdin drivers
@ -49,4 +53,8 @@ extern stdio_driver_t stdio_usb;
*/ */
bool stdio_usb_init(void); bool stdio_usb_init(void);
#ifdef __cplusplus
}
#endif
#endif #endif