Change the driving mode of GPIO current.
This commit is contained in:
parent
43886c36f5
commit
017f5f22f0
|
@ -94,16 +94,14 @@ void _pal_lld_setgroupmode(ioportid_t port, ioportmask_t mask, iomode_t mode) {
|
|||
uint32_t ospeedr = (mode & PAL_WB32_OSPEED_MASK) >> 3;
|
||||
uint32_t pupdr = (mode & PAL_WB32_PUPDR_MASK) >> 5;
|
||||
uint32_t altr = (mode & PAL_WB32_ALTERNATE_MASK) >> 7;
|
||||
uint32_t current = (mode & PAL_WB32_CURRENT_MASK) >> 11;
|
||||
|
||||
port->CFGMSK = ~mask;
|
||||
port->MODER = (moder & 0x3) * 0x55555555U;
|
||||
port->OTYPER = (otyper & 0x1) * 0xFFFFFFFFU;
|
||||
port->OSPEEDR = (ospeedr & 0x3) * 0x55555555U;
|
||||
port->PUPDR = (pupdr & 0x3) * 0x55555555U;
|
||||
|
||||
#ifdef WB32_GPIO_CURRENT
|
||||
port->CURRENT = (WB32_GPIO_CURRENT & 0x03) * 0x55555555U;
|
||||
#endif
|
||||
port->CURRENT = (current & 0x03) * 0x55555555U;
|
||||
|
||||
tmp = altr * 0x11111111U;
|
||||
port->AFRL = tmp;
|
||||
|
|
|
@ -44,11 +44,6 @@
|
|||
#undef PAL_MODE_OUTPUT_PUSHPULL
|
||||
#undef PAL_MODE_OUTPUT_OPENDRAIN
|
||||
|
||||
/* GPIO drive current, Value range 0-3 */
|
||||
#ifndef WB32_GPIO_CURRENT
|
||||
#define WB32_GPIO_CURRENT 0x03
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name WB32-specific I/O mode flags
|
||||
* @{
|
||||
|
@ -75,6 +70,12 @@
|
|||
#define PAL_WB32_ALTERNATE_MASK (15U << 7U)
|
||||
#define PAL_WB32_ALTERNATE(n) ((n) << 7U)
|
||||
|
||||
#define PAL_WB32_CURRENT_MASK (3U << 11U)
|
||||
#define PAL_WB32_CURRENT_LEVE0 (0U << 11U)
|
||||
#define PAL_WB32_CURRENT_LEVE1 (1U << 11U)
|
||||
#define PAL_WB32_CURRENT_LEVE2 (2U << 11U)
|
||||
#define PAL_WB32_CURRENT_LEVE3 (3U << 11U)
|
||||
|
||||
/**
|
||||
* @brief Alternate function.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue