Loading...
Searching...
No Matches
qma6100p_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Baptiste Le Duc <baptiste.leduc@etik.com>
3 * SPDX-FileCopyrightText: 2026 Léandre Le Duc <leandre.leduc38@gmail.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
19
20#include "board.h"
21#include "periph/gpio.h"
22#include "periph/i2c.h"
23#include "qma6100p.h"
24#include "saul_reg.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
34
40#define QMA6100P_I2C_ADDR_LOW (0x12)
41#define QMA6100P_I2C_ADDR_HIGH (0x13)
43
45#ifndef QMA6100P_PARAM_I2C
46# define QMA6100P_PARAM_I2C (I2C_DEV(0))
47#endif
48
50#ifndef CONFIG_QMA6100P_I2C_ADDR
51# define CONFIG_QMA6100P_I2C_ADDR (QMA6100P_I2C_ADDR_LOW)
52#endif
53
55#ifndef QMA6100P_PARAM_I2C_ADDR
56# define QMA6100P_PARAM_I2C_ADDR (CONFIG_QMA6100P_I2C_ADDR)
57#endif
58
60#if IS_ACTIVE(CONFIG_QMA6100P_ODR_100HZ)
61# define QMA6100P_PARAM_RATE (QMA6100P_ODR_100HZ)
62#elif IS_ACTIVE(CONFIG_QMA6100P_ODR_200HZ)
63# define QMA6100P_PARAM_RATE (QMA6100P_ODR_200HZ)
64#elif IS_ACTIVE(CONFIG_QMA6100P_ODR_400HZ)
65# define QMA6100P_PARAM_RATE (QMA6100P_ODR_400HZ)
66#elif IS_ACTIVE(CONFIG_QMA6100P_ODR_800HZ)
67# define QMA6100P_PARAM_RATE (QMA6100P_ODR_800HZ)
68#elif IS_ACTIVE(CONFIG_QMA6100P_ODR_1600HZ)
69# define QMA6100P_PARAM_RATE (QMA6100P_ODR_1600HZ)
70#elif IS_ACTIVE(CONFIG_QMA6100P_ODR_50HZ)
71# define QMA6100P_PARAM_RATE (QMA6100P_ODR_50HZ)
72#elif IS_ACTIVE(CONFIG_QMA6100P_ODR_25HZ)
73# define QMA6100P_PARAM_RATE (QMA6100P_ODR_25HZ)
74#elif IS_ACTIVE(CONFIG_QMA6100P_ODR_12HZ5)
75# define QMA6100P_PARAM_RATE (QMA6100P_ODR_12HZ5)
76#endif
77#ifndef QMA6100P_PARAM_RATE
78# define QMA6100P_PARAM_RATE (QMA6100P_ODR_100HZ)
79#endif
80
82#if IS_ACTIVE(CONFIG_QMA6100P_RANGE_2G)
83# define QMA6100P_PARAM_RANGE (QMA6100P_RANGE_2G)
84#elif IS_ACTIVE(CONFIG_QMA6100P_RANGE_4G)
85# define QMA6100P_PARAM_RANGE (QMA6100P_RANGE_4G)
86#elif IS_ACTIVE(CONFIG_QMA6100P_RANGE_8G)
87# define QMA6100P_PARAM_RANGE (QMA6100P_RANGE_8G)
88#elif IS_ACTIVE(CONFIG_QMA6100P_RANGE_16G)
89# define QMA6100P_PARAM_RANGE (QMA6100P_RANGE_16G)
90#elif IS_ACTIVE(CONFIG_QMA6100P_RANGE_32G)
91# define QMA6100P_PARAM_RANGE (QMA6100P_RANGE_32G)
92#endif
93#ifndef QMA6100P_PARAM_RANGE
94# define QMA6100P_PARAM_RANGE (QMA6100P_RANGE_2G)
95#endif
96
98#if IS_ACTIVE(CONFIG_QMA6100P_PM_MCLK_51K2)
99# define QMA6100P_PARAM_MCLK (QMA6100P_PM_MCLK_51K2)
100#elif IS_ACTIVE(CONFIG_QMA6100P_PM_MCLK_25K6)
101# define QMA6100P_PARAM_MCLK (QMA6100P_PM_MCLK_25K6)
102#elif IS_ACTIVE(CONFIG_QMA6100P_PM_MCLK_12K8)
103# define QMA6100P_PARAM_MCLK (QMA6100P_PM_MCLK_12K8)
104#elif IS_ACTIVE(CONFIG_QMA6100P_PM_MCLK_6K4)
105# define QMA6100P_PARAM_MCLK (QMA6100P_PM_MCLK_6K4)
106#endif
107#ifndef QMA6100P_PARAM_MCLK
108# define QMA6100P_PARAM_MCLK (QMA6100P_PM_MCLK_51K2)
109#endif
110
115#ifndef QMA6100P_PARAM_INT1_PIN
116# define QMA6100P_PARAM_INT1_PIN (GPIO_UNDEF)
117#endif
118
123#ifndef QMA6100P_PARAM_INT2_PIN
124# define QMA6100P_PARAM_INT2_PIN (GPIO_UNDEF)
125#endif
126
128#if IS_ACTIVE(CONFIG_QMA6100P_INTPIN_ACTIVE_HIGH)
129# define QMA6100P_PARAM_INT_ACTIVE_LEVEL (QMA6100P_INTPIN_ACTIVE_HIGH)
130#elif IS_ACTIVE(CONFIG_QMA6100P_INTPIN_ACTIVE_LOW)
131# define QMA6100P_PARAM_INT_ACTIVE_LEVEL (QMA6100P_INTPIN_ACTIVE_LOW)
132#endif
133#ifndef QMA6100P_PARAM_INT_ACTIVE_LEVEL
134# define QMA6100P_PARAM_INT_ACTIVE_LEVEL (QMA6100P_INTPIN_ACTIVE_HIGH)
135#endif
136
138#if IS_ACTIVE(CONFIG_QMA6100P_INTPIN_PUSH_PULL)
139# define QMA6100P_PARAM_INT_PIN_MODE (QMA6100P_INTPIN_PUSH_PULL)
140#elif IS_ACTIVE(CONFIG_QMA6100P_INTPIN_OPEN_DRAIN)
141# define QMA6100P_PARAM_INT_PIN_MODE (QMA6100P_INTPIN_OPEN_DRAIN)
142#endif
143#ifndef QMA6100P_PARAM_INT_PIN_MODE
144# define QMA6100P_PARAM_INT_PIN_MODE (QMA6100P_INTPIN_PUSH_PULL)
145#endif
146
148#if IS_ACTIVE(CONFIG_QMA6100P_INT_CFG_SHADOW_DIS)
149# define QMA6100P_PARAM_INT_SHADOW (QMA6100P_INT_CFG_SHADOW_DIS)
150#elif IS_ACTIVE(CONFIG_QMA6100P_INT_CFG_SHADOW_EN)
151# define QMA6100P_PARAM_INT_SHADOW (QMA6100P_INT_CFG_SHADOW_EN)
152#endif
153#ifndef QMA6100P_PARAM_INT_SHADOW
154# define QMA6100P_PARAM_INT_SHADOW (QMA6100P_INT_CFG_SHADOW_DIS)
155#endif
156
158#ifndef QMA6100P_PARAMS
159# define QMA6100P_PARAMS { .i2c = QMA6100P_PARAM_I2C, \
160 .addr = QMA6100P_PARAM_I2C_ADDR, \
161 .int1_pin = QMA6100P_PARAM_INT1_PIN, \
162 .int2_pin = QMA6100P_PARAM_INT2_PIN, \
163 .rate = QMA6100P_PARAM_RATE, \
164 .range = QMA6100P_PARAM_RANGE, \
165 .mclk = QMA6100P_PARAM_MCLK, \
166 .interrupt_shadow = QMA6100P_PARAM_INT_SHADOW }
167#endif
168
170#ifndef QMA6100P_SAUL_INFO
171# define QMA6100P_SAUL_INFO { .name = "qma6100p" }
172#endif
174
181
188
189#ifdef __cplusplus
190}
191#endif
192
Low-level GPIO peripheral driver interface definitions.
Low-level I2C peripheral driver interface definition.
Interface definition for the QMA6100P accelerometer driver.
#define QMA6100P_SAUL_INFO
Additional SAUL registry information.
static const saul_reg_info_t qma6100p_saul_info[]
Additional meta information to keep in the SAUL registry.
static const qma6100p_params_t qma6100p_params[]
QMA6100P defaults params if not defined for a board or application.
#define QMA6100P_PARAMS
Default configuration parameters structure for QMA6100P devices.
SAUL registry interface definition.
Configuration parameters.
Definition qma6100p.h:145
Additional data to collect for each entry.
Definition saul_reg.h:45