Several other interrupt button implementations had the same problem as did the sam4s-xplained

This commit is contained in:
Gregory Nutt
2014-06-15 12:55:48 -06:00
parent 4bac220b77
commit b013a0fa48
5 changed files with 59 additions and 16 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* configs/sure-pic32mx/src/pic32mx_buttons.c
*
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -211,12 +211,14 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler)
if (id < NUM_BUTTONS)
{
pic32mx_gpioirqdisable(g_buttoncn[id]);
oldhandler = pic32mx_gpioattach(g_buttonset[id], g_buttoncn[id], irqhandler);
if (irqbuttron)
if (irqhandler != NULL)
{
pic32mx_gpioirqenable(g_buttoncn[id]);
}
}
return oldhandler;
}
#endif