Developer World
Spresense SDK Library v3.3.0-375c679
cxd56_ak09912.h
1/****************************************************************************
2 * boards/arm/cxd56xx/spresense/include/cxd56_ak09912.h
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership. The
7 * ASF licenses this file to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance with the
9 * License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 * License for the specific language governing permissions and limitations
17 * under the License.
18 *
19 ****************************************************************************/
20
21#ifndef __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_AK09912_H
22#define __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_AK09912_H
23
24/****************************************************************************
25 * Included Files
26 ****************************************************************************/
27
28#include <nuttx/config.h>
29#include <nuttx/i2c/i2c_master.h>
30
31#ifndef __ASSEMBLY__
32#undef EXTERN
33#if defined(__cplusplus)
34#define EXTERN extern "C"
35extern "C"
36{
37#else
38#define EXTERN extern
39#endif
40
41/****************************************************************************
42 * Public Function Prototypes
43 ****************************************************************************/
44
45/****************************************************************************
46 * Name: board_ak09912_initialize
47 *
48 * Description:
49 * Initialize AK09912 i2c driver and register the AK09912 device.
50 *
51 ****************************************************************************/
52
53#if defined (CONFIG_SENSORS_AK09912) || defined (CONFIG_SENSORS_AK09912_SCU)
54int board_ak09912_initialize(const char *devpath, int bus);
55#endif
56
57#ifdef CONFIG_SENSORS_AK09912_SCU
58/****************************************************************************
59 * Name: ak09912_init
60 *
61 * Description:
62 * Initialize AK09912 magnetometer device
63 *
64 * Input Parameters:
65 * i2c - An instance of the I2C interface to use to communicate with
66 * AK09912
67 * port - I2C port number
68 *
69 * Returned Value:
70 * Zero (OK) on success; a negated errno value on failure.
71 *
72 ****************************************************************************/
73
74int ak09912_init(struct i2c_master_s *i2c, int port);
75
76/****************************************************************************
77 * Name: ak09912_scu_register
78 *
79 * Description:
80 * Register the AK09912 character device as 'devpath'
81 *
82 * Input Parameters:
83 * devpath - The full path to the driver to register. E.g., "/dev/mag0"
84 * minor - The number of sequencer
85 * i2c - An instance of the I2C interface to use to communicate with
86 * AK09912
87 * port - I2C port number
88 *
89 * Returned Value:
90 * Zero (OK) on success; a negated errno value on failure.
91 *
92 ****************************************************************************/
93
94int ak09912_scu_register(const char *devpath, int minor,
95 struct i2c_master_s *i2c, int port);
96
97#endif /* CONFIG_SENSORS_AK09912_SCU */
98
99#undef EXTERN
100#if defined(__cplusplus)
101}
102#endif
103
104#endif /* __ASSEMBLY__ */
105#endif /* __BOARDS_ARM_CXD56XX_SPRESENSE_INCLUDE_CXD56_AK09912_H */