Skip to content

Commit 8bd3081

Browse files
committed
boot/zephyr: cleanup GPIO pin setup
Removed configuration of gpio pin using flags which were removed for zephyr-project long ago. Also old method of read the pin value was removed. No sense to keep that as nowadays MCUboot is also not compatible with zephyr version which supports these flags and methods. Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
1 parent de51807 commit 8bd3081

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

boot/zephyr/main.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -380,20 +380,12 @@ static bool detect_pin(const char* port, int pin, uint32_t expected, int delay)
380380
* use the raw interface.
381381
*/
382382
rc = gpio_pin_configure(detect_port, pin,
383-
#ifdef GPIO_INPUT
384-
GPIO_INPUT | GPIO_PULL_UP
385-
#else
386-
GPIO_DIR_IN | GPIO_PUD_PULL_UP
387-
#endif
388-
);
383+
GPIO_INPUT | GPIO_PULL_UP);
389384
__ASSERT(rc == 0, "Failed to initialize boot detect pin.\n");
390385

391-
#ifdef GPIO_INPUT
392386
rc = gpio_pin_get_raw(detect_port, pin);
393387
detect_value = rc;
394-
#else
395-
rc = gpio_pin_read(detect_port, pin, &detect_value);
396-
#endif
388+
397389
__ASSERT(rc >= 0, "Failed to read boot detect pin.\n");
398390

399391
if (detect_value == expected) {
@@ -404,12 +396,8 @@ static bool detect_pin(const char* port, int pin, uint32_t expected, int delay)
404396
int64_t timestamp = k_uptime_get();
405397

406398
for(;;) {
407-
#ifdef GPIO_INPUT
408399
rc = gpio_pin_get_raw(detect_port, pin);
409400
detect_value = rc;
410-
#else
411-
rc = gpio_pin_read(detect_port, pin, &detect_value);
412-
#endif
413401
__ASSERT(rc >= 0, "Failed to read boot detect pin.\n");
414402

415403
/* Get delta from when this started */

0 commit comments

Comments
 (0)