Skip to content
Snippets Groups Projects
Commit 20cba973 authored by rahix's avatar rahix
Browse files

chore(buttons): Port to new hwlock API


Port the buttons module to the new hardware lock API which can no longer
fail.

Signed-off-by: default avatarRahix <rahix@rahix.de>
parent b46a9e7a
No related branches found
No related tags found
No related merge requests found
......@@ -17,13 +17,10 @@ uint8_t epic_buttons_read(uint8_t mask)
{
uint8_t ret = 0;
if (portexpander_detected() && (mask & 0x7)) {
if (hwlock_acquire_timeout(HWLOCK_I2C, portMAX_DELAY) < 0) {
LOG_ERR("buttons", "Can't acquire I2C bus");
return 0;
}
hwlock_acquire(HWLOCK_I2C);
/*
* Not using PB_Get() here as that performs one I2C transcation
* Not using PB_Get() here as that performs one I2C transaction
* per button.
*/
uint8_t pin_status = ~portexpander_in_get(0xFF);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment