X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fi2c.h;h=a962d171548d6050cf80047732337e49b0c90a22;hb=1d80bcc0499da60198f8c52e5c3004a7e885dae5;hp=f07c083d333686664489d5d88544e0173667fb12;hpb=03c14d1d807783de7b8560727843802c00b19d0f;p=bertos.git diff --git a/bertos/drv/i2c.h b/bertos/drv/i2c.h index f07c083d..a962d171 100644 --- a/bertos/drv/i2c.h +++ b/bertos/drv/i2c.h @@ -30,11 +30,17 @@ * * --> * - * \brief I2C generic driver functions (interface). + * \brief I2C generic driver functions. * * \version $Id$ * \author Francesco Sacchi + * + * $WIZ$ module_name = "i2c" + * $WIZ$ module_configuration = "bertos/cfg/cfg_i2c.h" + * $WIZ$ module_hw = "bertos/hw/hw_i2c_bitbang.h" + * $WIZ$ module_supports = "not atmega103 and not atmega168 and not at91" */ + #ifndef DRV_I2C_H #define DRV_I2C_H @@ -45,26 +51,48 @@ /** * I2C Backends. - * \{ + * Sometimes your cpu does not have a builtin + * i2c driver or you don't want, for some reason, to + * use that. + * With this you can choose, at compile time, which backend to use. + * + * $WIZ$ i2c_backend = "I2C_BACKEND_BUILTIN", "I2C_BACKEND_BITBANG" */ #define I2C_BACKEND_BUILTIN 0 ///< Uses cpu builtin i2c driver #define I2C_BACKEND_BITBANG 1 ///< Uses emulated bitbang driver -/*\}*/ + +/** + * I2c builtin prototypes. + * Do NOT use these function directly, instead, + * you can call the ones named without "_builtin_" + * and specify in cfg_i2c.h ( \see CONFIG_I2C_BACKEND) + * that you want the builtin backend. + * \{ + */ void i2c_builtin_init(void); bool i2c_builtin_start_w(uint8_t id); bool i2c_builtin_start_r(uint8_t id); void i2c_builtin_stop(void); bool i2c_builtin_put(uint8_t _data); int i2c_builtin_get(bool ack); +/*\}*/ +/** + * I2c bitbang prototypes. + * Same thing here: do NOT use these function directly, instead, + * you can call the ones named without "_bitbang_" + * and specify in cfg_i2c.h ( \see CONFIG_I2C_BACKEND) + * that you want the bitbang backend. + * \{ + */ void i2c_bitbang_init(void); bool i2c_bitbang_start_w(uint8_t id); bool i2c_bitbang_start_r(uint8_t id); void i2c_bitbang_stop(void); bool i2c_bitbang_put(uint8_t _data); int i2c_bitbang_get(bool ack); - +/*\}*/ #if CONFIG_I2C_BACKEND == I2C_BACKEND_BUILTIN #define i2c_init i2c_builtin_init