Skip to content

Add interrupt feature #7

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

marqdevx
Copy link
Member

I've added the minimun configuration to enable the interrupt pin

@github-actions
Copy link

Memory usage change @ 8af9c21

Board flash % RAM for global variables %
arduino:mbed_nano:nano33ble 🔺 +64 - +64 +0.01 - +0.01 0 - 0 0.0 - 0.0
Click for full report table
Board examples/ReadSensors
flash
% examples/ReadSensors
RAM for global variables
% examples/ReadSensorsImperial
flash
% examples/ReadSensorsImperial
RAM for global variables
%
arduino:mbed_nano:nano33ble 64 0.01 0 0.0 64 0.01 0 0.0
Click for full report CSV
Board,examples/ReadSensors<br>flash,%,examples/ReadSensors<br>RAM for global variables,%,examples/ReadSensorsImperial<br>flash,%,examples/ReadSensorsImperial<br>RAM for global variables,%
arduino:mbed_nano:nano33ble,64,0.01,0,0.0,64,0.01,0,0.0

Comment on lines +21 to +26
enableDataReady KEYWORD2
disableDataReady KEYWORD2
setOpenDrain KEYWORD2
setPushPull KEYWORD2
setActiveHigh KEYWORD2
setActiveLow KEYWORD2
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
enableDataReady KEYWORD2
disableDataReady KEYWORD2
setOpenDrain KEYWORD2
setPushPull KEYWORD2
setActiveHigh KEYWORD2
setActiveLow KEYWORD2
enableDataReady KEYWORD2
disableDataReady KEYWORD2
setOpenDrain KEYWORD2
setPushPull KEYWORD2
setActiveHigh KEYWORD2
setActiveLow KEYWORD2

In order to be recognized by the Arduino IDE, the keyword fields must be separated by a single true tab (not spaces):
https://arduino.github.io/arduino-cli/latest/library-specification/#keywordstxt-format

#########################################
# Constants
#########################################

FAHRENHEIT LITERAL1
FAHRENHEIT LITERAL1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
FAHRENHEIT LITERAL1
FAHRENHEIT LITERAL1

@@ -26,6 +26,7 @@
#define HTS221_WHO_AM_I_REG 0x0f
#define HTS221_CTRL1_REG 0x20
#define HTS221_CTRL2_REG 0x21
#define HTS221_CTRL3_REG 0x22 //Dara Ready (b7 0 active high)(open drain, b6 1)(b2, 1 enable data ready)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the comment

Comment on lines +79 to +108
void HTS221Class::enableDataReady(){
uint8_t data = i2cRead(HTS221_CTRL3_REG) & 0b11111000;
i2cWrite(HTS221_CTRL3_REG, data | 0b1 << 2);
}

void HTS221Class::disableDataReady(){
uint8_t data = i2cRead(HTS221_CTRL3_REG) & 0b11111000;
i2cWrite(HTS221_CTRL3_REG, data | 0b0 << 2);
}

void HTS221Class::setOpenDrain(){
uint8_t data = i2cRead(HTS221_CTRL3_REG) & 0b10111100;
i2cWrite(HTS221_CTRL3_REG, data | 0b1 << 6);
}

void HTS221Class::setPushPull(){
uint8_t data = i2cRead(HTS221_CTRL3_REG) & 0b10111100;
i2cWrite(HTS221_CTRL3_REG, data);
}

void HTS221Class::setActiveHigh(){
uint8_t data = i2cRead(HTS221_CTRL3_REG) & 0b01111111;
i2cWrite(HTS221_CTRL3_REG, data);
}

void HTS221Class::setActiveLow(){
uint8_t data = i2cRead(HTS221_CTRL3_REG) & 0b01111111;
i2cWrite(HTS221_CTRL3_REG, data | 0b1 << 7);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

do you need all these methods? where are they used? i think that is better implement only the part we need for the library

@aentinger
Copy link
Contributor

@marqdevx please have a look at @Rocketct feedback and iterate on it, if this PR is no longer relevant than please close it.

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.

4 participants