-
Notifications
You must be signed in to change notification settings - Fork 3k
UBLOX C030: I2C avoid any RTOS waits #6117
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
Conversation
--none-- |
char read_from_i2c(int slave_addr, int reg_addr, int* data_read, i2c_t i2c_obj) | ||
{ | ||
char ret_code = 0; | ||
if(!i2c_start(&i2c_obj)){ |
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.
can you use if ()
- space there, then {
}
for each if this is lot of conditions, would it make sense to squeeze in if (start && write && write ....) ?
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
data_read = data_read & MIN_BATTERY_VOLTAGE_MASK; | ||
write_to_i2c(BQ24295_I2C_ADDRESS, 0, data_read, i2c_obj); | ||
//Battery Voltage is set to 3880mV | ||
} |
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.
} else {
/morph build |
Build : SUCCESSBuild number : 1167 Triggering tests/morph test |
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.
Looks good to me.
Glad to see this alternative can unblock the situation :-) |
Exporter Build : SUCCESSBuild number : 843 |
Test : FAILUREBuild number : 972 |
Needs a restart, was aborted /morph test |
Test : SUCCESSBuild number : 973 |
Description
Type: Enhancement
Related issues: #5957, #5995, #6011 and #6034
Fixes issues: #5995, #6011
Priority: Blocker
Replacing
i2c_read/i2c_write
function calls in boot code withi2c_byte_read/i2c_byte_write
. This PR addresses the following:Reduces the binary size overhead to ~0.5 KB
The C++
BatteryChargerI2c
class previously introduced for C030 Battery Charger Voltage Fix #5677 has been eliminated as the I2C is now using different functions and does not require the initialization parameters which were necessary in the previous case.The functions
i2c_byte_read/i2c_byte_write
functions in the STM HAL are not using thewait_us()
functions so for now a target hook post-RTOS-initiailisation is not required.The platform critical section tests which were failing previously (C030 boards fail new platform critical section test #5995) are all passing now (except a few but they are not related to this PR).
@RobMeades @LMESTM @0xc0170 please review