From e817b7032d9610508e39921c65cda6ba108db357 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 23 Apr 2012 17:43:42 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4128 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/ext.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'os/hal/include/ext.h') diff --git a/os/hal/include/ext.h b/os/hal/include/ext.h index 56e683019..37a7dcd15 100644 --- a/os/hal/include/ext.h +++ b/os/hal/include/ext.h @@ -36,7 +36,7 @@ /*===========================================================================*/ /** - * @name EXT channels modes + * @name EXT channel modes * @{ */ #define EXT_CH_MODE_EDGES_MASK 3 /**< @brief Mask of edges field. */ @@ -104,6 +104,27 @@ typedef struct EXTDriver EXTDriver; * @iclass */ #define extChannelDisableI(extp, channel) ext_lld_channel_disable(extp, channel) + +/** + * @brief Changes the operation mode of a channel. + * @note This function attempts to write over the current configuration + * structure that must have been not declared constant. This + * violates the @p const qualifier in @p extStart() but it is + * intentional. This function cannot be used if the configuration + * structure is declared @p const. + * + * @param[in] extp pointer to the @p EXTDriver object + * @param[in] channel channel to be changed + * @param[in] extcp new configuration for the channel + * + * @api + */ +#define extSetChannelMode(extp, channel, extcp) { \ + chSysLock(); \ + extSetChannelModeI(extp, channel, extcp); \ + chSysUnlock(); \ +} + /** @} */ /*===========================================================================*/ @@ -119,6 +140,9 @@ extern "C" { void extStop(EXTDriver *extp); void extChannelEnable(EXTDriver *extp, expchannel_t channel); void extChannelDisable(EXTDriver *extp, expchannel_t channel); + void extSetChannelModeI(EXTDriver *extp, + expchannel_t channel, + const EXTChannelConfig *extcp); #ifdef __cplusplus } #endif -- cgit v1.2.3