diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c index 036b7db127..dedd017cf7 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "button.h" | 29 | #include "button.h" |
30 | #include "backlight.h" | 30 | #include "backlight.h" |
31 | #include "powermgmt.h" | 31 | #include "powermgmt.h" |
32 | #include "aic3x.h" | ||
32 | 33 | ||
33 | //#define BUTTON_DEBUG | 34 | //#define BUTTON_DEBUG |
34 | 35 | ||
@@ -405,6 +406,26 @@ void GIO0(void) | |||
405 | /* interrupt will be enabled back after button read */ | 406 | /* interrupt will be enabled back after button read */ |
406 | queue_post(&btn_queue, BTN_INTERRUPT, 0); | 407 | queue_post(&btn_queue, BTN_INTERRUPT, 0); |
407 | } | 408 | } |
409 | |||
410 | void GIO2(void) __attribute__ ((section(".icode"))); | ||
411 | void GIO2(void) | ||
412 | { | ||
413 | /* Clear interrupt */ | ||
414 | IO_INTC_IRQ1 = (1 << 7); | ||
415 | /* Disable interrupt */ | ||
416 | IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; | ||
417 | |||
418 | if (IO_GIO_BITSET0 & 0x04) | ||
419 | { | ||
420 | aic3x_switch_output(false); | ||
421 | } | ||
422 | else | ||
423 | { | ||
424 | aic3x_switch_output(true); | ||
425 | } | ||
426 | |||
427 | IO_INTC_EINT1 |= INTR_EINT1_EXT2; | ||
428 | } | ||
408 | #endif | 429 | #endif |
409 | 430 | ||
410 | void button_init_device(void) | 431 | void button_init_device(void) |
@@ -425,12 +446,13 @@ void button_init_device(void) | |||
425 | avr_hid_get_state(); | 446 | avr_hid_get_state(); |
426 | 447 | ||
427 | #ifndef BOOTLOADER | 448 | #ifndef BOOTLOADER |
428 | IO_GIO_IRQPORT |= 0x01; /* Enable GIO0 external interrupt */ | 449 | IO_GIO_IRQPORT |= 0x05; /* Enable GIO0/GIO2 external interrupt */ |
429 | IO_GIO_INV0 &= ~0x01; /* Clear INV for GIO0 (falling edge detection) */ | 450 | IO_GIO_INV0 &= ~0x05; /* Clear INV for GIO0/GIO2 */ |
430 | IO_GIO_IRQEDGE &= ~0x01; /* Set edge detection (falling) */ | 451 | /* falling edge detection on GIO0, any edge on GIO2 */ |
452 | IO_GIO_IRQEDGE = (IO_GIO_IRQEDGE & ~0x01) | 0x04; | ||
431 | 453 | ||
432 | /* Enable GIO0 interrupt */ | 454 | /* Enable GIO0 and GIO2 interrupts */ |
433 | IO_INTC_EINT1 |= INTR_EINT1_EXT0; | 455 | IO_INTC_EINT1 |= INTR_EINT1_EXT0 | INTR_EINT1_EXT2; |
434 | #endif | 456 | #endif |
435 | } | 457 | } |
436 | 458 | ||