Skip to content
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

hal/imxrt117x: fix IOpad #367

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions hal/armv7m/imxrt/117x/imxrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ __attribute__((section(".noxip"))) int _imxrt_setIOpad(int pad, char sre, char d
return -1;
}

if (((pad >= pctl_pad_gpio_emc_b1_00) && (pad <= pctl_pad_gpio_emc_b2_20)) ||
((pad >= pctl_pad_gpio_sd_b1_00) && (pad <= pctl_pad_gpio_disp_b2_15))) {
if ((pad <= pctl_pad_gpio_emc_b2_20) || ((pad >= pctl_pad_gpio_sd_b1_00) && (pad <= pctl_pad_gpio_disp_b1_11))) {
/* Fields have slightly diffrent meaning... */
if (pue == 0) {
pull = 3;
Expand All @@ -178,14 +177,22 @@ __attribute__((section(".noxip"))) int _imxrt_setIOpad(int pad, char sre, char d
t = *reg & ~0x1f;
t |= (!!sre) | (!!dse << 1) | (!!pue << 2) | (!!pus << 3);

if ((pad >= pctl_pad_test_mode) && (pad <= pctl_pad_gpio_snvs_09)) {
if (pad <= pctl_pad_gpio_disp_b2_15) {
t &= ~(1 << 4);
t |= !!ode << 4;
}
else if ((pad >= pctl_pad_wakeup) && (pad <= pctl_pad_gpio_snvs_09)) {
t &= ~(1 << 6);
t |= !!ode << 6;
}
else {
else if (pad >= pctl_pad_gpio_lpsr_00) {
t &= ~(1 << 5);
t |= !!ode << 5;
}
julianuziemblo marked this conversation as resolved.
Show resolved Hide resolved
else {
/* MISRA */
/* pctl_pad_test_mode, pctl_pad_por_b, pctl_pad_onoff - no ode field */
}
}

/* APC field is not documented. Leave it alone for now. */
Expand Down
Loading