Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luigiluz
Copy link

@luigiluz luigiluz commented Jan 21, 2020

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.

@luigiluz luigiluz requested review from vitbaq and alla3 January 21, 2020 14:36
@luigiluz luigiluz self-assigned this Jan 21, 2020
@alla3 alla3 requested a review from ramonhpr January 22, 2020 22:37
@luigiluz luigiluz force-pushed the i2c-gy-251 branch 3 times, most recently from db247da to 68a929b Compare January 28, 2020 11:40
@alla3 alla3 requested review from alla3 and ramonhpr January 28, 2020 20:12
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],
Copy link
Collaborator

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link

@ramonhpr ramonhpr left a 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.

#define TIME_INTERVAL 200

#define REGISTERS_NO 6
#define AXIS_NO 3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define AXIS_NO 3
#define AXIS_NO 3

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define FS_SEL 0x00
#define FS_SEL 0x00

Copy link
Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define AFS_SEL 0x00
#define AFS_SEL 0x00

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@luigiluz luigiluz force-pushed the i2c-gy-251 branch 3 times, most recently from 8a294b3 to c5bd719 Compare January 30, 2020 11:48
};

/* Name list vector for KNoT sensors */
char *name_list[SENSORS_NO] = { "ACCELX", "ACCELY", "ACCELZ",
Copy link
Collaborator

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.

Copy link
Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a tab

Copy link
Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a tab

Copy link
Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nops

@luigiluz luigiluz force-pushed the i2c-gy-251 branch 2 times, most recently from 7007e99 to 52fe0a2 Compare January 31, 2020 19:09
This patch adds a new example that uses I2C communication to get
acceleration and angular velocity data from a GY-251 sensor.
Copy link
Collaborator

@alla3 alla3 left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants