Kionix KX123 accelerometer C++ driver. Can be used for some extend also with kx022, kx023, kx122, etc. when used features are present in sensor.
Fork of kionix-kx123-driver by
kx123.h
- Committer:
- MikkoZ
- Date:
- 2016-09-30
- Revision:
- 1:f328083fb80b
- Parent:
- 0:a3f43eb92f86
- Child:
- 2:62891556d47b
File content as of revision 1:f328083fb80b:
/* Copyright 2016 Rohm Semiconductor Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #ifndef KX123_H #define KX123_H #include "RegisterWriter/RegisterWriter/rohm_hal2.h" #include "RegisterWriter/RegisterWriter/RegisterWriter.h" #include "kx123_registers.h" /** * Kionix KX123 accelerometer i2c driver. For some extend can be used also with * kx012, kx022, kx023, kx23h, kx112, kx122, kx124, kx222 and kx224. Driver uses * RegisterWriter -class as (i2c) hardware abstraction layer. */ class KX123 { public: KX123(RegisterWriter &i2c_obj, uint8_t sad = KX123_DEFAULT_SLAVE_ADDRESS, uint8_t wai = KX123_WHO_AM_I_WAI_ID); ~KX123(); bool set_defaults(void); bool getresults_raw(int16_t* buf); bool getresults_g(float* buf); private: void set_tilt_position_defaults(); RegisterWriter i2c_rw; uint16_t resolution_divider; uint8_t _sad; uint8_t _wai; }; #endif