git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9017 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
Giovanni Di Sirio 2016-03-05 11:03:54 +00:00
parent 712ecf57f9
commit ffed4a0266
3 changed files with 42 additions and 14 deletions

View File

@ -171,17 +171,30 @@ void _pal_lld_setgroupmode(ioportid_t port,
uint32_t altrmask, m1, m2, m4;
altrmask = altr << ((bit & 7) * 4);
m4 = 15 << ((bit & 7) * 4);
if (bit < 8)
port->AFRL = (port->AFRL & ~m4) | altrmask;
else
port->AFRH = (port->AFRH & ~m4) | altrmask;
m1 = 1 << bit;
port->OTYPER = (port->OTYPER & ~m1) | otyper;
m2 = 3 << (bit * 2);
m4 = 15 << ((bit & 7) * 4);
port->OTYPER = (port->OTYPER & ~m1) | otyper;
port->OSPEEDR = (port->OSPEEDR & ~m2) | ospeedr;
port->PUPDR = (port->PUPDR & ~m2) | pupdr;
port->MODER = (port->MODER & ~m2) | moder;
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)
port->AFRL = (port->AFRL & ~m4) | altrmask;
else
port->AFRH = (port->AFRH & ~m4) | altrmask;
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;
if (!mask)

View File

@ -156,18 +156,31 @@ void _pal_lld_setgroupmode(ioportid_t port,
uint32_t altrmask, m1, m2, m4;
altrmask = altr << ((bit & 7) * 4);
m4 = 15 << ((bit & 7) * 4);
if (bit < 8)
port->AFRL = (port->AFRL & ~m4) | altrmask;
else
port->AFRH = (port->AFRH & ~m4) | altrmask;
m1 = 1 << bit;
m2 = 3 << (bit * 2);
m4 = 15 << ((bit & 7) * 4);
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;
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)
port->AFRL = (port->AFRL & ~m4) | altrmask;
else
port->AFRH = (port->AFRH & ~m4) | altrmask;
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;
}
mask >>= 1;

View File

@ -95,6 +95,8 @@
- RT: Merged RT4.
- NIL: Merged NIL2.
- 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)
(backported to 3.0.6 and 16.1.4).
- VAR: Fixed wrong flash and ram size in linker script for maple mini