Fixed bug #723.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9017 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
712ecf57f9
commit
ffed4a0266
|
@ -171,18 +171,31 @@ void _pal_lld_setgroupmode(ioportid_t port,
|
||||||
uint32_t altrmask, m1, m2, m4;
|
uint32_t altrmask, m1, m2, m4;
|
||||||
|
|
||||||
altrmask = altr << ((bit & 7) * 4);
|
altrmask = altr << ((bit & 7) * 4);
|
||||||
|
m1 = 1 << bit;
|
||||||
|
m2 = 3 << (bit * 2);
|
||||||
m4 = 15 << ((bit & 7) * 4);
|
m4 = 15 << ((bit & 7) * 4);
|
||||||
|
port->OTYPER = (port->OTYPER & ~m1) | otyper;
|
||||||
|
port->OSPEEDR = (port->OSPEEDR & ~m2) | ospeedr;
|
||||||
|
port->PUPDR = (port->PUPDR & ~m2) | pupdr;
|
||||||
|
if (moder == PAL_STM32_MODE_ALTERNATE) {
|
||||||
|
/* If going in alternate mode then the alternate number is set
|
||||||
|
before switching mode in order to avoid glitches.*/
|
||||||
if (bit < 8)
|
if (bit < 8)
|
||||||
port->AFRL = (port->AFRL & ~m4) | altrmask;
|
port->AFRL = (port->AFRL & ~m4) | altrmask;
|
||||||
else
|
else
|
||||||
port->AFRH = (port->AFRH & ~m4) | altrmask;
|
port->AFRH = (port->AFRH & ~m4) | altrmask;
|
||||||
m1 = 1 << bit;
|
|
||||||
port->OTYPER = (port->OTYPER & ~m1) | otyper;
|
|
||||||
m2 = 3 << (bit * 2);
|
|
||||||
port->OSPEEDR = (port->OSPEEDR & ~m2) | ospeedr;
|
|
||||||
port->PUPDR = (port->PUPDR & ~m2) | pupdr;
|
|
||||||
port->MODER = (port->MODER & ~m2) | moder;
|
port->MODER = (port->MODER & ~m2) | moder;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* If going into a non-alternate mode then the mode is switched
|
||||||
|
before setting the alternate mode in order to avoid glitches.*/
|
||||||
|
port->MODER = (port->MODER & ~m2) | moder;
|
||||||
|
if (bit < 8)
|
||||||
|
port->AFRL = (port->AFRL & ~m4) | altrmask;
|
||||||
|
else
|
||||||
|
port->AFRH = (port->AFRH & ~m4) | altrmask;
|
||||||
|
}
|
||||||
|
}
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
if (!mask)
|
if (!mask)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -156,18 +156,31 @@ void _pal_lld_setgroupmode(ioportid_t port,
|
||||||
uint32_t altrmask, m1, m2, m4;
|
uint32_t altrmask, m1, m2, m4;
|
||||||
|
|
||||||
altrmask = altr << ((bit & 7) * 4);
|
altrmask = altr << ((bit & 7) * 4);
|
||||||
|
m1 = 1 << bit;
|
||||||
|
m2 = 3 << (bit * 2);
|
||||||
m4 = 15 << ((bit & 7) * 4);
|
m4 = 15 << ((bit & 7) * 4);
|
||||||
|
port->OTYPER = (port->OTYPER & ~m1) | otyper;
|
||||||
|
port->ASCR = (port->ASCR & ~m1) | ascr;
|
||||||
|
port->OSPEEDR = (port->OSPEEDR & ~m2) | ospeedr;
|
||||||
|
port->PUPDR = (port->PUPDR & ~m2) | pupdr;
|
||||||
|
if (moder == PAL_STM32_MODE_ALTERNATE) {
|
||||||
|
/* If going in alternate mode then the alternate number is set
|
||||||
|
before switching mode in order to avoid glitches.*/
|
||||||
if (bit < 8)
|
if (bit < 8)
|
||||||
port->AFRL = (port->AFRL & ~m4) | altrmask;
|
port->AFRL = (port->AFRL & ~m4) | altrmask;
|
||||||
else
|
else
|
||||||
port->AFRH = (port->AFRH & ~m4) | altrmask;
|
port->AFRH = (port->AFRH & ~m4) | altrmask;
|
||||||
m1 = 1 << bit;
|
|
||||||
port->OTYPER = (port->OTYPER & ~m1) | otyper;
|
|
||||||
port->ASCR = (port->ASCR & ~m1) | ascr;
|
|
||||||
m2 = 3 << (bit * 2);
|
|
||||||
port->OSPEEDR = (port->OSPEEDR & ~m2) | ospeedr;
|
|
||||||
port->PUPDR = (port->PUPDR & ~m2) | pupdr;
|
|
||||||
port->MODER = (port->MODER & ~m2) | moder;
|
port->MODER = (port->MODER & ~m2) | moder;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* If going into a non-alternate mode then the mode is switched
|
||||||
|
before setting the alternate mode in order to avoid glitches.*/
|
||||||
|
port->MODER = (port->MODER & ~m2) | moder;
|
||||||
|
if (bit < 8)
|
||||||
|
port->AFRL = (port->AFRL & ~m4) | altrmask;
|
||||||
|
else
|
||||||
|
port->AFRH = (port->AFRH & ~m4) | altrmask;
|
||||||
|
}
|
||||||
port->LOCKR = (port->LOCKR & ~m1) | lockr;
|
port->LOCKR = (port->LOCKR & ~m1) | lockr;
|
||||||
}
|
}
|
||||||
mask >>= 1;
|
mask >>= 1;
|
||||||
|
|
|
@ -95,6 +95,8 @@
|
||||||
- RT: Merged RT4.
|
- RT: Merged RT4.
|
||||||
- NIL: Merged NIL2.
|
- NIL: Merged NIL2.
|
||||||
- NIL: Added STM32F7 demo.
|
- NIL: Added STM32F7 demo.
|
||||||
|
- VAR: Fixed palSetMode glitching outputs (bug #723)(backported to 3.0.6
|
||||||
|
and 16.1.4).
|
||||||
- VAR: Fixed error in STM32 PWM driver regarding channels 4 and 5 (bug #722)
|
- VAR: Fixed error in STM32 PWM driver regarding channels 4 and 5 (bug #722)
|
||||||
(backported to 3.0.6 and 16.1.4).
|
(backported to 3.0.6 and 16.1.4).
|
||||||
- VAR: Fixed wrong flash and ram size in linker script for maple mini
|
- VAR: Fixed wrong flash and ram size in linker script for maple mini
|
||||||
|
|
Loading…
Reference in New Issue