Kionix KX123 accelerometer C++ driver. Can be used for some extend also with kx022, kx023, kx122, etc. when used features are present in sensor.

Dependents:   kionix-kx123-hello

Committer:
MikkoZ
Date:
Fri Sep 30 11:52:29 2016 +0000
Revision:
1:f328083fb80b
Parent:
0:a3f43eb92f86
Child:
2:62891556d47b
Added doxygen documentation for library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikkoZ 0:a3f43eb92f86 1 /* Copyright 2016 Rohm Semiconductor
MikkoZ 0:a3f43eb92f86 2
MikkoZ 0:a3f43eb92f86 3 Licensed under the Apache License, Version 2.0 (the "License");
MikkoZ 0:a3f43eb92f86 4 you may not use this file except in compliance with the License.
MikkoZ 0:a3f43eb92f86 5 You may obtain a copy of the License at
MikkoZ 0:a3f43eb92f86 6
MikkoZ 0:a3f43eb92f86 7 http://www.apache.org/licenses/LICENSE-2.0
MikkoZ 0:a3f43eb92f86 8
MikkoZ 0:a3f43eb92f86 9 Unless required by applicable law or agreed to in writing, software
MikkoZ 0:a3f43eb92f86 10 distributed under the License is distributed on an "AS IS" BASIS,
MikkoZ 0:a3f43eb92f86 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MikkoZ 0:a3f43eb92f86 12 See the License for the specific language governing permissions and
MikkoZ 0:a3f43eb92f86 13 limitations under the License.
MikkoZ 0:a3f43eb92f86 14 */
MikkoZ 0:a3f43eb92f86 15 #ifndef KX123_H
MikkoZ 0:a3f43eb92f86 16 #define KX123_H
MikkoZ 0:a3f43eb92f86 17
MikkoZ 0:a3f43eb92f86 18 #include "RegisterWriter/RegisterWriter/rohm_hal2.h"
MikkoZ 0:a3f43eb92f86 19 #include "RegisterWriter/RegisterWriter/RegisterWriter.h"
MikkoZ 0:a3f43eb92f86 20
MikkoZ 1:f328083fb80b 21 #include "kx123_registers.h"
MikkoZ 0:a3f43eb92f86 22
MikkoZ 0:a3f43eb92f86 23 /**
MikkoZ 1:f328083fb80b 24 * Kionix KX123 accelerometer i2c driver. For some extend can be used also with
MikkoZ 1:f328083fb80b 25 * kx012, kx022, kx023, kx23h, kx112, kx122, kx124, kx222 and kx224. Driver uses
MikkoZ 1:f328083fb80b 26 * RegisterWriter -class as (i2c) hardware abstraction layer.
MikkoZ 0:a3f43eb92f86 27 */
MikkoZ 0:a3f43eb92f86 28 class KX123
MikkoZ 0:a3f43eb92f86 29 {
MikkoZ 0:a3f43eb92f86 30 public:
MikkoZ 1:f328083fb80b 31
MikkoZ 0:a3f43eb92f86 32 KX123(RegisterWriter &i2c_obj, uint8_t sad = KX123_DEFAULT_SLAVE_ADDRESS, uint8_t wai = KX123_WHO_AM_I_WAI_ID);
MikkoZ 0:a3f43eb92f86 33 ~KX123();
MikkoZ 0:a3f43eb92f86 34
MikkoZ 0:a3f43eb92f86 35 bool set_defaults(void);
MikkoZ 0:a3f43eb92f86 36 bool getresults_raw(int16_t* buf);
MikkoZ 0:a3f43eb92f86 37 bool getresults_g(float* buf);
MikkoZ 0:a3f43eb92f86 38
MikkoZ 0:a3f43eb92f86 39 private:
MikkoZ 0:a3f43eb92f86 40 void set_tilt_position_defaults();
MikkoZ 0:a3f43eb92f86 41
MikkoZ 0:a3f43eb92f86 42 RegisterWriter i2c_rw;
MikkoZ 0:a3f43eb92f86 43 uint16_t resolution_divider;
MikkoZ 1:f328083fb80b 44 uint8_t _sad;
MikkoZ 1:f328083fb80b 45 uint8_t _wai;
MikkoZ 0:a3f43eb92f86 46 };
MikkoZ 0:a3f43eb92f86 47
MikkoZ 0:a3f43eb92f86 48 #endif