-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apps: Add I2C Gyroscope and Accelerometer example #73
base: master
Are you sure you want to change the base?
Conversation
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
db247da
to
68a929b
Compare
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
knot_data_config(i, KNOT_EVT_FLAG_CHANGE, NULL); | ||
} | ||
for (i = 0; i < AXIS_NO; i++) { | ||
knot_data_register(i+3, name_list[i+3], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add spaces between the operator '+' and create a define for 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Just fix minor changes on code formatting.
apps/i2c-accelerometer-gyroscope/src/i2c-accelerometer-gyroscope.c
Outdated
Show resolved
Hide resolved
#define TIME_INTERVAL 200 | ||
|
||
#define REGISTERS_NO 6 | ||
#define AXIS_NO 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define AXIS_NO 3 | |
#define AXIS_NO 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nops
#define MPU6050_GYRO_REG_DATA_START 0X43 | ||
|
||
/* Full Scale Range to +- 2g */ | ||
#define FS_SEL 0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define FS_SEL 0x00 | |
#define FS_SEL 0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
/* Full Scale Range to +- 2g */ | ||
#define FS_SEL 0x00 | ||
/* Full Scal Range to 250deg/seg */ | ||
#define AFS_SEL 0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define AFS_SEL 0x00 | |
#define AFS_SEL 0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
8a294b3
to
c5bd719
Compare
}; | ||
|
||
/* Name list vector for KNoT sensors */ | ||
char *name_list[SENSORS_NO] = { "ACCELX", "ACCELY", "ACCELZ", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can declare this array on setup function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
#define MPU6050_GYRO_REG_DATA_START 0X43 | ||
|
||
/* Full Scale Range to +- 2g */ | ||
#define FS_SEL0x00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
#include <knot/knot_protocol.h> | ||
|
||
/* I2C slave address */ | ||
#define MPU_ADDRESS0X68 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
#define TIME_INTERVAL 200 | ||
|
||
#define REGISTERS_NO 6 | ||
#define AXIS_NO 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nops
7007e99
to
52fe0a2
Compare
This patch adds a new example that uses I2C communication to get acceleration and angular velocity data from a GY-251 sensor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Waiting for protocol request changes to be approved.
This patch adds a new example that uses I2C communication to get
acceleration and angular velocity data from a GY-251 sensor.
Depends on protocol request changes to be approved.