Verified Commit 609e3947 authored by Rahix's avatar Rahix
Browse files

fix(portexpander): Fix only configuring with MXC_ASSERT enabled



When MXC_ASSERT is disabled, the portexpander_config() call is not
compiled into the bootloader which leads to the portexpander not being
setup correctly and thus neither the screen turns on nor does the button
to switch into MSC mode work correctly (bootloader always goes into MSC
mode).

Fix this by moving the portexpander_config() call outside the MXC_ASSERT
and only keep the return value check inside.  Additionally fix the
pull-up/pull-down selection in portexpander_config() not being set
correctly.

Ref #171

Signed-off-by: Rahix's avatarRahix <rahix@rahix.de>
parent d70f6e30
...@@ -102,9 +102,8 @@ int portexpander_init(void) ...@@ -102,9 +102,8 @@ int portexpander_init(void)
// Enable outputs for the transistors, the LED and the LCD reset // Enable outputs for the transistors, the LED and the LCD reset
for (int i = 0; i < sizeof(pe_pin_config) / sizeof(pe_pin_config[0]); for (int i = 0; i < sizeof(pe_pin_config) / sizeof(pe_pin_config[0]);
i++) { i++) {
MXC_ASSERT( ret = portexpander_config(&pe_pin_config[i]);
portexpander_config(&pe_pin_config[i]) == E_NO_ERROR MXC_ASSERT(ret == E_NO_ERROR);
);
} }
// Latch inputs so we can figure out whether an interrupt was caused by a rising or falling edge // Latch inputs so we can figure out whether an interrupt was caused by a rising or falling edge
...@@ -161,7 +160,7 @@ int portexpander_config(const portexpander_cfg_t *cfg) ...@@ -161,7 +160,7 @@ int portexpander_config(const portexpander_cfg_t *cfg)
return E_BAD_PARAM; return E_BAD_PARAM;
} }
portexpander_write(PE_C_PULL_ENABLE, pull_selection_state); portexpander_write(PE_C_PULL_SEL, pull_selection_state);
portexpander_write(PE_C_PULL_ENABLE, pull_enable_state); portexpander_write(PE_C_PULL_ENABLE, pull_enable_state);
return E_NO_ERROR; return E_NO_ERROR;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment