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

Fw 999 fw 103 hw kien nguyen #310

Closed
wants to merge 7 commits into from
Closed

Conversation

k13nNg
Copy link

@k13nNg k13nNg commented Sep 21, 2024

I have finished FW 103, can you help me look at it?

Copy link
Member

@Akashem06 Akashem06 left a comment

Choose a reason for hiding this comment

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

Review comments. Ask questions in your onboarding thread!


StatusCode ads1115_read_raw(ADS1115_Config *config, ADS1115_Channel channel, int16_t *reading) {
/* TODO: complete function */
i2c_read_reg(config->i2c_port, config->i2c_addr, ADS1115_REG_CONVERSION, (uint8_t *) reading, 8);
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect read size. (16 bit read so it will be 2 bytes)


StatusCode ads1115_read_converted(ADS1115_Config *config, ADS1115_Channel channel, float *reading) {
/* TODO: complete function */
uint16_t reader ;
Copy link
Member

Choose a reason for hiding this comment

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

I believe if you pass in an int16_t instead of uint16_t, the value will be signed when returned. That way you won't need your check if (reader <= 32768). Just a simpler approach, don't need changes here. Everything else is good!


// Write Config register
/* TODO: fill out this value */
cmd = 0x0011;
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect CMD bitset. All bits in the config register should be default (Except for the conversion mode, which you will configure as continuous mode). The default bitset is 0000 0101 1000 0011, as per the datasheet.

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