-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19cf5b6
commit 11f0d97
Showing
7 changed files
with
746 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,7 @@ modules.order | |
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
|
||
# Cmake build output folder | ||
build/ | ||
lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Set min req version of Cmake | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
# Set project name | ||
project(ICM20948_Driver_Lib) | ||
|
||
# Set our lib include directories | ||
include_directories(src inc) | ||
|
||
# Set the lib output folder | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ../lib) | ||
|
||
# Create or our static library | ||
ADD_LIBRARY( _icm20948 STATIC src/icm20948.c src/icm20948.h ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,37 @@ | ||
# icm20948 | ||
C Driver for the IC-20948 9-Axis Telemetry sensor | ||
# ICM-20948 9-Axis MEMS Motion Tracking Sensor Driver | ||
C Driver for the IC-20948 9-Axis Telemetry sensor. This driver can be included directly into a developers source or a static library can be created and then linked against. | ||
|
||
|
||
## Retrieving the Source | ||
The source is located on Github and can be either downloaded and included directly into a developers source directoriy or the developer can add this repo as a submodule into their source (The latter is the preferred method). | ||
|
||
To include the driver as a git submodule | ||
```bash | ||
$ cd ./${DIR_WHERE_YOU_WANT_TO_ADD_THE_MODULE} | ||
$ git submodule add https://github.com/stephendpmurphy/icm20948.git | ||
``` | ||
|
||
## Integration | ||
#### Creating & Linking against a static library | ||
To create a static library to link against, exectue the following commands. | ||
```bash | ||
$ mkdir build && cd build | ||
$ cmake .. | ||
$ make | ||
``` | ||
The output library (lib_icm20948.a) can be found in the *lib/* folder. Link against this file, and include the icm20948_api.h header file into your source include directories. | ||
```c | ||
#include "icm20948_api.h" | ||
``` | ||
|
||
#### Adding to your own source/project | ||
The other option for integrating the source into your project, is to include everything directly into your project | ||
* Set your include directories to both the inc/ and src/ folders. | ||
* Add the icm20948.c to your source list to be compiled. | ||
* Include the API header file wherever you intended to implement the driver source. | ||
```c | ||
#include "icm20948_api.h" | ||
``` | ||
|
||
## Implementing the driver | ||
// TO-DO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/**************************************************************************** | ||
ICM-20948 9-Axis MEMS Motion Tracking Device Driver | ||
Copyright (C) 2020 Stephen Murphy - github.com/stephendpmurphy | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
****************************************************************************/ | ||
|
||
/*! @file icm20948_api.h | ||
* @brief Public header file for the ICM20948 9-Axis MEMS device API. | ||
*/ | ||
|
||
#ifndef _ICM20948_API_H_ | ||
#define _ICM20948_API_H_ | ||
|
||
int icm20948_init(void); | ||
|
||
#endif // _ICM20948_API_H_ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/**************************************************************************** | ||
ICM-20948 9-Axis MEMS Motion Tracking Device Driver | ||
Copyright (C) 2020 Stephen Murphy - github.com/stephendpmurphy | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
****************************************************************************/ | ||
|
||
/*! @file icm20948.c | ||
* @brief Source file for the ICM20948 9-Axis MEMS device driver. | ||
*/ | ||
|
||
#include "icm20948.h" | ||
#include "icm20948_api.h" | ||
|
||
int icm20948_init(void) | ||
{ | ||
icm20948_reg_bank_1_t reg_bank1 = {0}; | ||
|
||
reg_bank1.bytes.XA_OFFS_L.bits.XA_OFFS = 0x03; | ||
|
||
return reg_bank1.bytes.XA_OFFS_L.bits.XA_OFFS; | ||
} |
Oops, something went wrong.