Commit 621bff85 authored by Takeo Takahashi's avatar Takeo Takahashi Committed by Damien George

renesas-ra/machine_pin: Support drive keyword and fix GPIO setting.

Changes are:
- Support drive= keyword argument.
- Fix trigger keyword check.
- Fix GPIO pin setting.
Signed-off-by: default avatarTakeo Takahashi <takeo.takahashi.xv@renesas.com>
parent 85a25895
......@@ -47,8 +47,8 @@
// Switch
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_USRSW_PIN (pin_P304)
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PULL (MP_HAL_PIN_PULL_NONE)
#define MICROPY_HW_USRSW_EXTI_MODE (MP_HAL_PIN_TRIGGER_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)
// LEDs
......
......@@ -59,8 +59,8 @@
// Switch
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_USRSW_PIN (pin_P105)
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PULL (MP_HAL_PIN_PULL_NONE)
#define MICROPY_HW_USRSW_EXTI_MODE (MP_HAL_PIN_TRIGGER_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)
// LEDs
......
......@@ -58,8 +58,8 @@
// Switch
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_USRSW_PIN (pin_P402)
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PULL (MP_HAL_PIN_PULL_NONE)
#define MICROPY_HW_USRSW_EXTI_MODE (MP_HAL_PIN_TRIGGER_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)
// LEDs
......
......@@ -64,8 +64,8 @@
// Switch
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_USRSW_PIN (pin_P415)
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PULL (MP_HAL_PIN_PULL_NONE)
#define MICROPY_HW_USRSW_EXTI_MODE (MP_HAL_PIN_TRIGGER_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)
// LEDs
......
......@@ -77,8 +77,8 @@
// Switch
#define MICROPY_HW_HAS_SWITCH (1)
#define MICROPY_HW_USRSW_PIN (pin_P105)
#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL)
#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING)
#define MICROPY_HW_USRSW_PULL (MP_HAL_PIN_PULL_NONE)
#define MICROPY_HW_USRSW_EXTI_MODE (MP_HAL_PIN_TRIGGER_FALLING)
#define MICROPY_HW_USRSW_PRESSED (0)
// LEDs
......
......@@ -138,8 +138,8 @@ uint extint_register(mp_obj_t pin_obj, uint32_t mode, uint32_t pull, mp_obj_t ca
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("The Pin object(%d) doesn't have EXTINT feature"), pin_idx);
}
}
if (pull != GPIO_NOPULL &&
pull != GPIO_PULLUP) {
if ((pull != MP_HAL_PIN_PULL_NONE) &&
(pull != MP_HAL_PIN_PULL_UP)) {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("invalid ExtInt Pull: %d"), pull);
}
mp_obj_t *cb = &MP_STATE_PORT(pyb_extint_callback)[v_line];
......@@ -153,7 +153,6 @@ uint extint_register(mp_obj_t pin_obj, uint32_t mode, uint32_t pull, mp_obj_t ca
extint_disable(v_line);
*cb = callback_obj;
// ToDo: mode should be handled
pyb_extint_mode[v_line] = mode;
pyb_extint_callback_arg[v_line] = MP_OBJ_NEW_SMALL_INT(v_line);
if (*cb != mp_const_none) {
......@@ -200,7 +199,6 @@ void extint_register_pin(const machine_pin_obj_t *pin, uint32_t mode, bool hard_
extint_disable(line);
*cb = callback_obj;
// ToDo: mode should be handled
pyb_extint_mode[line] = mode;
if (*cb != mp_const_none) {
......@@ -255,16 +253,16 @@ void extint_trigger_mode(uint line, uint32_t mode) {
// cond: 0: falling, 1: rising, 2: both edge, 3 low level
// Enable or disable the rising detector
uint32_t cond = 0;
if ((mode == GPIO_MODE_IT_RISING) || (mode == GPIO_MODE_EVT_RISING)) {
cond = 1;
} else if ((mode == GPIO_MODE_IT_FALLING) || (mode == GPIO_MODE_EVT_FALLING)) {
cond = 0;
} else if ((mode == GPIO_MODE_IT_RISING_FALLING) || (mode == GPIO_MODE_EVT_RISING_FALLING)) {
cond = 2;
} else if (mode == GPIO_IRQ_LOWLEVEL) {
if (mode & MP_HAL_PIN_TRIGGER_LOWLEVEL) {
cond = 3;
} else if (mode & MP_HAL_PIN_TRIGGER_FALLING) {
if (mode & MP_HAL_PIN_TRIGGER_RISING) {
cond = 2;
} else {
cond = 0;
}
} else {
mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("The device doesn't have (%d) feature"), (uint32_t)mode);
cond = 1;
}
ra_icu_trigger_irq_no((uint8_t)line, cond);
enable_irq(irq_state);
......@@ -372,14 +370,6 @@ STATIC const mp_rom_map_elem_t extint_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_disable), MP_ROM_PTR(&extint_obj_disable_obj) },
{ MP_ROM_QSTR(MP_QSTR_swint), MP_ROM_PTR(&extint_obj_swint_obj) },
{ MP_ROM_QSTR(MP_QSTR_regs), MP_ROM_PTR(&extint_regs_obj) },
// class constants
/// \constant IRQ_RISING - interrupt on a rising edge
/// \constant IRQ_FALLING - interrupt on a falling edge
/// \constant IRQ_RISING_FALLING - interrupt on a rising or falling edge
{ MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(GPIO_MODE_IT_RISING) },
{ MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(GPIO_MODE_IT_FALLING) },
{ MP_ROM_QSTR(MP_QSTR_IRQ_RISING_FALLING), MP_ROM_INT(GPIO_MODE_IT_RISING_FALLING) },
};
STATIC MP_DEFINE_CONST_DICT(extint_locals_dict, extint_locals_dict_table);
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2018 Damien P. George
* Copyright (c) 2021 Renesas Electronics Corporation
* Copyright (c) 2021-2022 Renesas Electronics Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -69,13 +69,21 @@ static inline mp_uint_t mp_hal_ticks_cpu(void) {
#define MP_HAL_PIN_PULL_NONE (GPIO_NOPULL)
#define MP_HAL_PIN_PULL_UP (GPIO_PULLUP)
#define MP_HAL_PIN_PULL_DOWN (GPIO_PULLDOWN)
#define MP_HAL_PIN_TRIGGER_FALLING (GPIO_IRQ_FALLING)
#define MP_HAL_PIN_TRIGGER_RISING (GPIO_IRQ_RISING)
#define MP_HAL_PIN_TRIGGER_LOWLEVEL (GPIO_IRQ_LOWLEVEL)
#define MP_HAL_PIN_TRIGGER_HIGHLEVEL (GPIO_IRQ_HIGHLEVEL)
#define MP_HAL_PIN_DRIVE_0 (GPIO_LOW_POWER)
#define MP_HAL_PIN_DRIVE_1 (GPIO_MID_POWER)
#define MP_HAL_PIN_DRIVE_2 (GPIO_MID_FAST_POWER)
#define MP_HAL_PIN_DRIVE_3 (GPIO_HIGH_POWER)
#define mp_hal_pin_obj_t const machine_pin_obj_t *
#define mp_hal_get_pin_obj(o) machine_pin_find(o)
#define mp_hal_pin_name(p) ((p)->name)
#define mp_hal_pin_input(p) ra_gpio_mode_input((p)->pin)
#define mp_hal_pin_output(p) ra_gpio_mode_output((p)->pin)
#define mp_hal_pin_open_drain(p) ra_gpio_config((p)->pin, GPIO_MODE_OUTPUT_OD, 0, 0, 0)
#define mp_hal_pin_open_drain(p) ra_gpio_config((p)->pin, MP_HAL_PIN_MODE_OPEN_DRAIN, MP_HAL_PIN_PULL_NONE, MP_HAL_PIN_DRIVE_0, 0)
#define mp_hal_pin_high(p) ra_gpio_write((p)->pin, 1)
#define mp_hal_pin_low(p) ra_gpio_write((p)->pin, 0)
#define mp_hal_pin_toggle(p) ra_gpio_toggle((p)->pin)
......
......@@ -31,23 +31,17 @@ void ra_gpio_config(uint32_t pin, uint32_t mode, uint32_t pull, uint32_t drive,
uint32_t port = GPIO_PORT(pin);
uint32_t bit = GPIO_BIT(pin);
pwpr_unprotect();
_PXXPFS(port, bit) &= ~(PMR_MASK | ASEL_MASK | NCODR_MASK | PCR_MASK | PDR_MASK | DSCR1_MASK | DSCR_MASK);
switch (mode) {
case GPIO_MODE_INPUT:
_PXXPFS(port, bit) &= ~(PMR_MASK | ASEL_MASK); // GPIO
_PXXPFS(port, bit) &= ~PDR_MASK; // input
if (pull != 0) {
if (pull == GPIO_PULLUP) {
_PXXPFS(port, bit) |= PCR_MASK; // set pullup
} else {
_PXXPFS(port, bit) &= ~PCR_MASK; // clear pullup
}
break;
case GPIO_MODE_OUTPUT_PP:
_PXXPFS(port, bit) &= ~(PMR_MASK | ASEL_MASK); // GPIO
_PXXPFS(port, bit) |= PDR_MASK; // output
_PXXPFS(port, bit) &= ~PCR_MASK; // pullup clear
break;
case GPIO_MODE_OUTPUT_OD:
_PXXPFS(port, bit) &= ~(PMR_MASK | ASEL_MASK); // GPIO
_PXXPFS(port, bit) |= (PDR_MASK | NCODR_MASK);
break;
case GPIO_MODE_AF_PP:
......@@ -56,20 +50,23 @@ void ra_gpio_config(uint32_t pin, uint32_t mode, uint32_t pull, uint32_t drive,
case GPIO_MODE_AF_OD:
_PXXPFS(port, bit) |= (PMR_MASK | PDR_MASK | NCODR_MASK);
break;
case GPIO_MODE_ANALOG:
_PXXPFS(port, bit) |= ASEL_MASK;
break;
}
switch (drive) {
case GPIO_HIGH_POWER:
_PXXPFS(port, bit) |= (DSCR1_MASK | DSCR_MASK);
break;
case GPIO_MED_POWER:
_PXXPFS(port, bit) &= ~DSCR1_MASK;
case GPIO_MID_FAST_POWER:
_PXXPFS(port, bit) |= DSCR1_MASK;
break;
case GPIO_MID_POWER:
_PXXPFS(port, bit) |= DSCR_MASK;
break;
case GPIO_LOW_POWER:
_PXXPFS(port, bit) &= ~(DSCR1_MASK | DSCR_MASK);
break;
default: /* GPIO_NOTOUCH_POWER */
/* do not modify */
default:
/* Bits are already cleared */
break;
}
_PXXPFS(port, bit) &= ~(uint32_t)(0x1f000000);
......@@ -102,7 +99,6 @@ void ra_gpio_toggle(uint32_t pin) {
uint32_t port = GPIO_PORT(pin);
uint32_t bit = GPIO_BIT(pin);
pwpr_unprotect();
_PXXPFS(port, bit) &= ~(PMR_MASK | ASEL_MASK); // GPIO
_PXXPFS(port, bit) ^= 1;
pwpr_protect();
}
......@@ -111,7 +107,6 @@ void ra_gpio_write(uint32_t pin, uint32_t value) {
uint32_t port = GPIO_PORT(pin);
uint32_t bit = GPIO_BIT(pin);
pwpr_unprotect();
_PXXPFS(port, bit) &= ~(PMR_MASK | ASEL_MASK); // GPIO
if (value != 0) {
_PXXPFS(port, bit) |= 1;
} else {
......@@ -123,15 +118,26 @@ void ra_gpio_write(uint32_t pin, uint32_t value) {
uint32_t ra_gpio_read(uint32_t pin) {
uint32_t port = GPIO_PORT(pin);
uint32_t bit = GPIO_BIT(pin);
return ((_PXXPFS(port, bit) &= PIDR_MASK) != 0) ? 1 : 0;
return ((_PXXPFS(port, bit) & PIDR_MASK) != 0) ? 1 : 0;
}
uint32_t ra_gpio_get_mode(uint32_t pin) {
uint8_t mode = 0;
uint32_t port = GPIO_PORT(pin);
uint32_t bit = GPIO_BIT(pin);
if ((_PXXPFS(port, bit) &= PDR_MASK) != 0) {
mode = GPIO_MODE_OUTPUT_PP;
uint32_t pfs = _PXXPFS(GPIO_PORT(pin), GPIO_BIT(pin));
if ((pfs & ASEL_MASK) != 0) {
mode = GPIO_MODE_ANALOG;
} else if ((pfs & PMR_MASK) != 0) {
if ((pfs & NCODR_MASK) != 0) {
mode = GPIO_MODE_AF_OD;
} else {
mode = GPIO_MODE_AF_PP;
}
} else if ((pfs & PDR_MASK) != 0) {
if ((pfs & NCODR_MASK) != 0) {
mode = GPIO_MODE_OUTPUT_OD;
} else {
mode = GPIO_MODE_OUTPUT_PP;
}
} else {
mode = GPIO_MODE_INPUT;
}
......@@ -142,7 +148,7 @@ uint32_t ra_gpio_get_pull(uint32_t pin) {
uint8_t pull = 0;
uint32_t port = GPIO_PORT(pin);
uint32_t bit = GPIO_BIT(pin);
if ((_PXXPFS(port, bit) &= PCR_MASK) != 0) {
if ((_PXXPFS(port, bit) & PCR_MASK) != 0) {
pull = GPIO_PULLUP;
} else {
pull = GPIO_NOPULL;
......@@ -153,19 +159,22 @@ uint32_t ra_gpio_get_pull(uint32_t pin) {
uint32_t ra_gpio_get_af(uint32_t pin) {
uint32_t port = GPIO_PORT(pin);
uint32_t bit = GPIO_BIT(pin);
return (_PXXPFS(port, bit) &= PMR_MASK) != 0;
return (_PXXPFS(port, bit) & PMR_MASK) != 0;
}
uint32_t ra_gpio_get_drive(uint32_t pin) {
uint8_t drive = 0;
uint32_t port = GPIO_PORT(pin);
uint32_t bit = GPIO_BIT(pin);
switch (_PXXPFS(port, bit) &= (DSCR1_MASK | DSCR_MASK)) {
switch (_PXXPFS(port, bit) & (DSCR1_MASK | DSCR_MASK)) {
case (DSCR1_MASK | DSCR_MASK):
drive = GPIO_HIGH_POWER;
break;
case DSCR1_MASK:
drive = GPIO_MID_FAST_POWER;
break;
case DSCR_MASK:
drive = GPIO_MED_POWER;
drive = GPIO_MID_POWER;
break;
case 0:
default:
......
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Renesas Electronics Corporation
* Copyright (c) 2021,2022 Renesas Electronics Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -69,47 +69,42 @@ enum AF_INDEX {
AF_END = 0xff,
};
#define GPIO_MODE_INPUT 1
#define GPIO_MODE_OUTPUT_PP 2
#define GPIO_MODE_OUTPUT_OD 3
#define GPIO_MODE_AF_PP 4
#define GPIO_MODE_AF_OD 5
#define GPIO_MODE_ANALOG 6
#define GPIO_MODE_IT_RISING 7
#define GPIO_MODE_IT_FALLING 8
#define GPIO_MODE_IT_RISING_FALLING 9
#define GPIO_MODE_EVT_RISING 10
#define GPIO_MODE_EVT_FALLING 11
#define GPIO_MODE_EVT_RISING_FALLING 12
#define GPIO_NOPULL 13
#define GPIO_PULLUP 14
#define GPIO_PULLDOWN 15
#define GPIO_PULLHOLD 16
#define GPIO_LOW_POWER 17
#define GPIO_MED_POWER 18
#define GPIO_HIGH_POWER 19
#define GPIO_NOTOUCH_POWER 20
#define GPIO_IRQ_LOWLEVEL 21
#define GPIO_IRQ_HIGHLEVEL 22
#define GPIO_MODE_INPUT 0
#define GPIO_MODE_OUTPUT_PP 1
#define GPIO_MODE_OUTPUT_OD 2
#define GPIO_MODE_AF_PP 3
#define GPIO_MODE_AF_OD 4
#define GPIO_MODE_ANALOG 5
#define GPIO_IRQ_FALLING 0x1
#define GPIO_IRQ_RISING 0x2
#define GPIO_IRQ_LOWLEVEL 0x4
#define GPIO_IRQ_HIGHLEVEL 0x8
#define GPIO_NOPULL 0
#define GPIO_PULLUP 1
#define GPIO_PULLDOWN 2
#define GPIO_LOW_POWER 0
#define GPIO_MID_POWER 1
#define GPIO_MID_FAST_POWER 2
#define GPIO_HIGH_POWER 3
#define IS_GPIO_MODE(MODE) (((MODE) == GPIO_MODE_INPUT) || \
((MODE) == GPIO_MODE_OUTPUT_PP) || \
((MODE) == GPIO_MODE_OUTPUT_OD) || \
((MODE) == GPIO_MODE_AF_PP) || \
((MODE) == GPIO_MODE_AF_OD) || \
((MODE) == GPIO_MODE_IT_RISING) || \
((MODE) == GPIO_MODE_IT_FALLING) || \
((MODE) == GPIO_MODE_IT_RISING_FALLING) || \
((MODE) == GPIO_MODE_EVT_RISING) || \
((MODE) == GPIO_MODE_EVT_FALLING) || \
((MODE) == GPIO_MODE_EVT_RISING_FALLING) || \
((MODE) == GPIO_MODE_ANALOG))
#define IS_GPIO_DRIVE(DRIVE) (((DRIVE) == GPIO_LOW_POWER) || \
((DRIVE) == GPIO_MED_POWER) || \
((DRIVE) == GPIO_MID_POWER) || \
((DRIVE) == GPIO_MID_FAST_POWER) || \
((DRIVE) == GPIO_HIGH_POWER))
#define IS_GPIO_PULL(PULL) (((PULL) == GPIO_NOPULL) || ((PULL) == GPIO_PULLUP))
#define IS_GPIO_PULL(PULL) (((PULL) == GPIO_NOPULL) || \
((PULL) == GPIO_PULLUP) || \
((PULL) == GPIO_PULLDOWN))
#define IS_GPIO_AF(AF) ((AF) <= (uint8_t)0x1F)
......
......@@ -362,8 +362,8 @@ void ra_i2c_set_baudrate(R_IIC0_Type *i2c_inst, uint32_t baudrate) {
void ra_i2c_init(R_IIC0_Type *i2c_inst, uint32_t scl, uint32_t sda, uint32_t baudrate) {
ra_i2c_module_start(i2c_inst);
ra_gpio_config(scl, GPIO_MODE_AF_OD, 0, GPIO_NOTOUCH_POWER, AF_I2C);
ra_gpio_config(sda, GPIO_MODE_AF_OD, 0, GPIO_NOTOUCH_POWER, AF_I2C);
ra_gpio_config(scl, GPIO_MODE_AF_OD, GPIO_NOPULL, GPIO_LOW_POWER, AF_I2C);
ra_gpio_config(sda, GPIO_MODE_AF_OD, GPIO_NOPULL, GPIO_LOW_POWER, AF_I2C);
ra_i2c_priority(i2c_inst, RA_PRI_I2C);
i2c_inst->ICCR1_b.ICE = 0; // I2C disable
i2c_inst->ICCR1_b.IICRST = 1; // I2C internal reset
......
......@@ -788,7 +788,7 @@ static void ra_sci_tx_set_pin(uint32_t pin) {
uint32_t af;
find = ra_af_find_ch_af((ra_af_pin_t *)&ra_sci_tx_pins, SCI_TX_PINS_SIZE, pin, &ch, &af);
if (find) {
ra_gpio_config(pin, GPIO_MODE_AF_PP, 0, 0, af);
ra_gpio_config(pin, GPIO_MODE_AF_PP, GPIO_NOPULL, GPIO_LOW_POWER, af);
}
}
......@@ -798,7 +798,7 @@ static void ra_sci_rx_set_pin(uint32_t pin) {
uint32_t af;
find = ra_af_find_ch_af((ra_af_pin_t *)&ra_sci_rx_pins, SCI_RX_PINS_SIZE, pin, &ch, &af);
if (find) {
ra_gpio_config(pin, GPIO_MODE_INPUT, 1, 0, af);
ra_gpio_config(pin, GPIO_MODE_INPUT, GPIO_PULLUP, GPIO_LOW_POWER, af);
}
}
......@@ -808,7 +808,7 @@ static void ra_sci_cts_set_pin(uint32_t pin) {
uint32_t af;
find = ra_af_find_ch_af((ra_af_pin_t *)&ra_sci_cts_pins, SCI_CTS_PINS_SIZE, pin, &ch, &af);
if (find) {
ra_gpio_config(pin, GPIO_MODE_INPUT, 1, 0, af);
ra_gpio_config(pin, GPIO_MODE_INPUT, GPIO_PULLUP, GPIO_LOW_POWER, af);
}
}
......@@ -1134,7 +1134,7 @@ void ra_sci_init_with_flow(uint32_t ch, uint32_t tx_pin, uint32_t rx_pin, uint32
}
if (rts_pin != (uint32_t)PIN_END) {
m_rts_pin[idx] = rts_pin;
ra_gpio_config(rts_pin, GPIO_MODE_OUTPUT_PP, false, 0, 0);
ra_gpio_config(rts_pin, GPIO_MODE_OUTPUT_PP, GPIO_NOPULL, GPIO_LOW_POWER, 0);
ra_gpio_write(rts_pin, 0);
}
}
......
......@@ -196,9 +196,9 @@ static void ra_spi_module_stop(uint32_t ch) {
static void ra_spi_set_pin(uint32_t pin, bool miso) {
if (miso) {
ra_gpio_config(pin, GPIO_MODE_INPUT, 1, 0, AF_SPI);
ra_gpio_config(pin, GPIO_MODE_INPUT, GPIO_PULLUP, GPIO_LOW_POWER, AF_SPI);
} else {
ra_gpio_config(pin, GPIO_MODE_AF_PP, 0, 0, AF_SPI);
ra_gpio_config(pin, GPIO_MODE_AF_PP, GPIO_NOPULL, GPIO_LOW_POWER, AF_SPI);
}
}
......
......@@ -54,7 +54,7 @@
// this function inits the switch GPIO so that it can be used
void switch_init0(void) {
mp_hal_pin_config(MICROPY_HW_USRSW_PIN, MP_HAL_PIN_MODE_INPUT, MICROPY_HW_USRSW_PULL, GPIO_LOW_POWER, 0);
mp_hal_pin_config(MICROPY_HW_USRSW_PIN, MP_HAL_PIN_MODE_INPUT, MICROPY_HW_USRSW_PULL, MP_HAL_PIN_DRIVE_0, 0);
}
int switch_get(void) {
......
Markdown is supported
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