-
Notifications
You must be signed in to change notification settings - Fork 47
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
NON-OS SDK support. Tested on v2.0.0. #10
Conversation
Thanks! Will check on the weekend! |
// 7 Bit Slave Address; SCL Frequency in Steps of 100 KHz, range: 100 -- 1000 KHz | ||
|
||
i2c_slave_address = slave_address; | ||
if (i2c_SCL_frequency != SCL_frequency_KHz) { | ||
uint16_t fr_sel = round(SCL_frequency_KHz / 100.0); |
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.
I would like to keep that with the round(.), such that frequencies are rounded up to next 100 level. Guess that's ok for NON-OS as well.
@@ -708,13 +726,14 @@ void ICACHE_RAM_ATTR brzo_i2c_read(uint8_t *data, uint8_t nr_of_bytes, boolean r | |||
return; | |||
} | |||
|
|||
void ICACHE_RAM_ATTR brzo_i2c_start_transaction(uint8_t slave_address, uint16_t SCL_frequency_KHz) { | |||
void ICACHE_FLASH_ATTR brzo_i2c_start_transaction(uint8_t slave_address, uint16_t SCL_frequency_KHz) |
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.
Although wasting a bit of IRAM, I would like to keep the brzo_i2c_start_transaction
and its counterpart bzro_i2c_end_transaction
in IRAM, i.e. not ICACHE_FLASH_ATTR
. As I learned (the hard way), moving from ROM to RAM can take up 3--4 usec, cf. my issue here. There are many use cases, where you want to start i2c transactions right away, thus I would keep RAM attribute.
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.
Just had a few little comments.
Besides that, tested and works fine.
Thanks!
About round(). I prefer to not use floating point calculation in embedded development when it is possible to implement functionality without it. In your case this can be achieved next way: |
Related discussion - #9