/***************************************************************************** */
/* GPIO Interrupts Callbacks */
-static void (*gpio_calbacks_port0[PORT0_NB_PINS]) (uint32_t);
-static void (*gpio_calbacks_port1[PORT1_NB_PINS]) (uint32_t);
-static void (*gpio_calbacks_port2[PORT2_NB_PINS]) (uint32_t);
+static void (*gpio_callbacks_port0[PORT0_NB_PINS]) (uint32_t);
+static void (*gpio_callbacks_port1[PORT1_NB_PINS]) (uint32_t);
+static void (*gpio_callbacks_port2[PORT2_NB_PINS]) (uint32_t);
int set_gpio_callback(void (*callback) (uint32_t), const struct pio* gpio, uint8_t sense)
{
case 0:
if (gpio->pin >= PORT0_NB_PINS)
return -EINVAL;
- gpio_calbacks_port0[gpio->pin] = callback;
+ gpio_callbacks_port0[gpio->pin] = callback;
irq = PIO_0_IRQ;
break;
case 1:
if (gpio->pin >= PORT1_NB_PINS)
return -EINVAL;
- gpio_calbacks_port1[gpio->pin] = callback;
+ gpio_callbacks_port1[gpio->pin] = callback;
irq = PIO_1_IRQ;
break;
case 2:
if (gpio->pin >= PORT2_NB_PINS)
return -EINVAL;
- gpio_calbacks_port2[gpio->pin] = callback;
+ gpio_callbacks_port2[gpio->pin] = callback;
irq = PIO_2_IRQ;
break;
default:
case 0:
if (gpio->pin >= PORT0_NB_PINS)
return;
- gpio_calbacks_port0[gpio->pin] = NULL;
+ gpio_callbacks_port0[gpio->pin] = NULL;
irq = PIO_0_IRQ;
break;
case 1:
if (gpio->pin >= PORT1_NB_PINS)
return;
- gpio_calbacks_port1[gpio->pin] = NULL;
+ gpio_callbacks_port1[gpio->pin] = NULL;
irq = PIO_1_IRQ;
break;
case 2:
if (gpio->pin >= PORT2_NB_PINS)
return;
- gpio_calbacks_port2[gpio->pin] = NULL;
+ gpio_callbacks_port2[gpio->pin] = NULL;
irq = PIO_2_IRQ;
break;
default:
while (status) {
if (status & 1) {
/* Is there an handler for this one ? */
- if (gpio_calbacks_port0[i] != NULL) {
- gpio_calbacks_port0[i](i);
+ if (gpio_callbacks_port0[i] != NULL) {
+ gpio_callbacks_port0[i](i);
}
/* Clear edge detection logic */
gpio0->int_clear |= (1 << i);
while (status) {
if (status & 1) {
/* Is there an handler for this one ? */
- if (gpio_calbacks_port1[i] != NULL) {
- gpio_calbacks_port1[i](i);
+ if (gpio_callbacks_port1[i] != NULL) {
+ gpio_callbacks_port1[i](i);
}
/* Clear pending interrupt */
gpio1->int_clear |= (1 << i);
while (status) {
if (status & 1) {
/* Is there an handler for this one ? */
- if (gpio_calbacks_port2[i] != NULL) {
- gpio_calbacks_port2[i](i);
+ if (gpio_callbacks_port2[i] != NULL) {
+ gpio_callbacks_port2[i](i);
}
/* Clear pending interrupt */
gpio2->int_clear |= (1 << i);
}
/* RTC Interrupts Callbacks */
-static void (*rtc_calback) (uint32_t);
+static void (*rtc_callback) (uint32_t);
void setup_callback(uint32_t ticks)
{
int ret = 0;
/* Register the callback */
- rtc_calback = callback;
+ rtc_callback = callback;
if (rtc_get_count() != 0) {
rtc_set_match(when, period, ((period == 0) ? 0 : 1));
} else {
struct lpc_rtc* rtc = LPC_RTC;
/* Remove the handler */
- rtc_calback = NULL;
+ rtc_callback = NULL;
rtc->intr_control = LPC_RTC_INT_DISABLE;
/* And disable the interrupt */
NVIC_DisableIRQ(RTC_IRQ);
{
struct lpc_rtc* rtc = LPC_RTC;
/* Call interrupt handler */
- if (rtc_calback != NULL) {
- rtc_calback(rtc->data);
+ if (rtc_callback != NULL) {
+ rtc_callback(rtc->data);
}
rtc->intr_clear = LPC_RTC_CLEAR_INTR;
if (periodic_match == 1) {