MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_hw_iic_init

Function rt_hw_iic_init

bsp/efm32/drv_iic.c:834–869  ·  view source on GitHub ↗

/ * @brief * Initialize all IIC module related hardware and register IIC device to kernel * * @details * * @note ******************************************************************************/

Source from the content-addressed store, hash-verified

832 * @note
833 ******************************************************************************/
834void rt_hw_iic_init(void)
835{
836 struct efm32_iic_device_t *iic;
837 rt_uint32_t flag;
838
839 do
840 {
841 flag = RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX;
842 /* Initialize and register iic0 */
843 if ((iic = rt_hw_iic_unit_init(&iic0, 0, RT_USING_IIC0)) != RT_NULL)
844 {
845 rt_hw_iic_register(&iic0.device, RT_IIC0_NAME, flag, iic);
846 }
847 else
848 {
849 break;
850 }
851
852#if (I2C_COUNT > 1)
853 /* Initialize and register iic1 */
854 if ((iic = rt_hw_iic_unit_init(&iic1, 1, RT_USING_IIC1)) != RT_NULL)
855 {
856 rt_hw_iic_register(&iic1.device, RT_IIC1_NAME, flag, iic);
857 }
858 else
859 {
860 break;
861 }
862#endif
863
864 iic_debug("IIC: H/W init OK!\n");
865 return;
866 } while (0);
867
868 rt_kprintf("IIC: H/W init failed!\n");
869}
870
871#endif /* (defined(RT_USING_IIC0) || defined(RT_USING_IIC1)) */
872/***************************************************************************//**

Callers 1

rt_hw_driver_initFunction · 0.70

Calls 3

rt_hw_iic_unit_initFunction · 0.85
rt_hw_iic_registerFunction · 0.85
rt_kprintfFunction · 0.85

Tested by

no test coverage detected