+
+ /**
+ * \addtogroup i2c_api
+ * \{
+ */
+#if COMPILER_C99
+ #define i2c_init(...) PP_CAT(i2c_init ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__)
+ #define i2c_start_w(...) PP_CAT(i2c_start_w ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__)
+ #define i2c_start_r(...) PP_CAT(i2c_start_r ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__)
+#else
+ /**
+ * Initialize I2C module.
+ *
+ * To initialize the module you can write this code:
+ * \code
+ * I2c ctx;
+ * i2c_init(&ctx, 0, CONFIG_I2C_FREQ);
+ * \endcode
+ * This macro expands in two versions, depending on the number of
+ * parameters, to maintain compatibility with old API:
+ * \li i2c_init_3(I2c *i2c, int dev, uint32_t clock)
+ * \li i2c_init_0(void)
+ *
+ * Do NOT use the above functions directly, use i2c_init().
+ * \note Use the version with 3 parameters, the other one is only for
+ * legacy code.
+ */
+ #define i2c_init(args...) PP_CAT(i2c_init ## _, COUNT_PARMS(args)) (args)
+
+ /**
+ * Start a write session.
+ *
+ * To start a write session, use the following code:
+ * \code
+ * i2c_start_w(i2c, dev, bytes, I2C_STOP);
+ * \endcode
+ *
+ * This macro expands in two versions, depending on the number of parameters:
+ * \li i2c_start_w_4(I2c *i2c, uint16_t slave_addr, size_t size, int flags)
+ * \li i2c_builtin_start_w(uint8_t id): Deprecated API, don't use in new projects
+ * \li i2c_bitbang_start_w(uint8_t id): Deprecated API, don't use in new projects
+ *
+ * Do NOT use the above functions directly, use i2c_start_w().
+ * \note Use the version with 4 parameters, the others are only for legacy code
+ */
+ #define i2c_start_w(args...) PP_CAT(i2c_start_w ## _, COUNT_PARMS(args)) (args)
+
+ /**
+ * Start a read session.
+ *
+ * To start a read session, use the following code:
+ * \code
+ * i2c_start_r(i2c, dev, bytes, I2C_STOP);
+ * \endcode
+ *
+ * This macro expands in two versions, depending on the number of parameters:
+ * \li i2c_start_r_4(I2c *i2c, uint16_t slave_addr, size_t size, int flags)
+ * \li i2c_builtin_start_r(uint8_t id): Deprecated API, don't use in new projects
+ * \li i2c_bitbang_start_r(uint8_t id): Deprecated API, don't use in new projects
+ *
+ * Do NOT use the above functions directly, use i2c_start_r().
+ * \note Use the version with 4 parameters, the others are only for legacy code
+ */
+ #define i2c_start_r(args...) PP_CAT(i2c_start_r ## _, COUNT_PARMS(args)) (args)
+#endif
+/**\}*/