mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 12:33:34 +08:00
Fix a critical PIC32 GPIO configuration bug
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4867 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -160,7 +160,7 @@ int pic32mx_configgpio(uint16_t cfgset)
|
||||
sched_lock();
|
||||
if (pic32mx_output(cfgset))
|
||||
{
|
||||
/* It is an output; set the corresponding bit in the TRIS register */
|
||||
/* It is an output; clear the corresponding bit in the TRIS register */
|
||||
|
||||
putreg32(1 << pin, base + PIC32MX_IOPORT_TRISCLR_OFFSET);
|
||||
|
||||
@@ -189,11 +189,9 @@ int pic32mx_configgpio(uint16_t cfgset)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It is an input; clear the corresponding bit in the TRIS
|
||||
* register.
|
||||
*/
|
||||
/* It is an input; set the corresponding bit in the TRIS register. */
|
||||
|
||||
putreg32(1 << pin, base + PIC32MX_IOPORT_TRISCLR_OFFSET);
|
||||
putreg32(1 << pin, base + PIC32MX_IOPORT_TRISSET_OFFSET);
|
||||
putreg32(1 << pin, base + PIC32MX_IOPORT_ODCCLR_OFFSET);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
# define PIC32MX_IOPORT_ODCCLR_OFFSET 0x0044 /* Open drain control clear register */
|
||||
# define PIC32MX_IOPORT_ODCSET_OFFSET 0x0048 /* Open drain control set register */
|
||||
# define PIC32MX_IOPORT_ODCINV_OFFSET 0x004c /* Open drain control invert register */
|
||||
|
||||
# define PIC32MX_IOPORT_CNPU_OFFSET 0x0050 /* Change Notification Pull-up register */
|
||||
# define PIC32MX_IOPORT_CNPUCLR_OFFSET 0x0054 /* Change Notification Pull-up clear register */
|
||||
# define PIC32MX_IOPORT_CNPUSET_OFFSET 0x0058 /* Change Notification Pull-up set register */
|
||||
|
||||
Reference in New Issue
Block a user