1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2019-05-08     flaybreak    add sensor port file
9  */
10 
11 #include <board.h>
12 
13 #ifdef BSP_USING_ICM20608
14 #include <sensor_inven_mpu6xxx.h>
15 
rt_hw_icm20608_port(void)16 static int rt_hw_icm20608_port(void)
17 {
18     struct rt_sensor_config cfg;
19 
20     cfg.intf.dev_name = "i2c3";
21     cfg.intf.type = RT_SENSOR_INTF_I2C;
22     cfg.intf.arg = (void *)MPU6XXX_ADDR_DEFAULT;
23     cfg.irq_pin.pin  = PIN_IRQ_PIN_NONE;
24 
25     rt_hw_mpu6xxx_init("icm", &cfg);
26 
27     return RT_EOK;
28 }
29 INIT_ENV_EXPORT(rt_hw_icm20608_port);
30 #endif /* BSP_USING_ICM20608 */
31 
32 #ifdef BSP_USING_AP3216C
33 #include <sensor_lsc_ap3216c.h>
34 
rt_hw_ap3216c_port(void)35 static int rt_hw_ap3216c_port(void)
36 {
37     struct rt_sensor_config cfg;
38 
39     cfg.intf.dev_name  = "i2c3";
40     cfg.intf.type = RT_SENSOR_INTF_I2C;
41     cfg.intf.arg = RT_NULL;
42     cfg.irq_pin.pin  = PIN_IRQ_PIN_NONE;
43 
44     rt_hw_ap3216c_init("ap3216c", &cfg);
45 
46     return RT_EOK;
47 }
48 INIT_ENV_EXPORT(rt_hw_ap3216c_port);
49 #endif /* BSP_USING_AP3216C */
50 
51 #ifdef BSP_USING_AHT10
52 #include <sensor_asair_aht10.h>
53 
rt_hw_aht10_port(void)54 static int rt_hw_aht10_port(void)
55 {
56     struct rt_sensor_config cfg;
57 
58     cfg.intf.dev_name  = "i2c4";
59     cfg.intf.type = RT_SENSOR_INTF_I2C;
60     cfg.intf.arg = (void *)AHT10_I2C_ADDR;
61     cfg.irq_pin.pin  = PIN_IRQ_PIN_NONE;
62 
63     rt_hw_aht10_init("aht10", &cfg);
64 
65     return RT_EOK;
66 }
67 INIT_ENV_EXPORT(rt_hw_aht10_port);
68 #endif /* BSP_USING_AHT10 */
69