AP_HAL_AVR: expose gpio pin 70 for mpu6000 interrupt input

This commit is contained in:
Pat Hickey 2012-12-20 22:41:27 -08:00 committed by Andrew Tridgell
parent 1678dcc6f0
commit 563ca3f79b
3 changed files with 9 additions and 2 deletions

View File

@ -95,11 +95,15 @@ void AVRGPIO::write(uint8_t pin, uint8_t value) {
/* Implement GPIO Interrupt 6, used for MPU6000 data ready on APM2. */
bool AVRGPIO::attach_interrupt(
uint8_t interrupt_num, AP_HAL::Proc proc, uint8_t mode) {
if (!((mode == 0)||(mode == 1)||(mode==3))) return false;
/* Mode is to set the ISCn0 and ISCn1 bits.
* These correspond to the GPIO_INTERRUPT_ defs in AP_HAL.h */
if (!((mode == 0)||(mode == 1)||(mode == 2)||(mode==3))) return false;
if (interrupt_num == 6) {
uint8_t oldSREG = SREG;
cli();
_interrupt_6 = proc;
/* Set the ISC60 and ICS61 bits in EICRB according to the value
* of mode. */
EICRB = (EICRB & ~((1 << ISC60) | (1 << ISC61))) | (mode << ISC60);
EIMSK |= (1 << INT6);
SREG = oldSREG;

View File

@ -125,6 +125,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PK , // PK 5 ** 67 ** A13
PK , // PK 6 ** 68 ** A14
PK , // PK 7 ** 69 ** A15
PE , // PE 6 ** 70 ** APM only
};
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
@ -200,6 +201,7 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
_BV( 5 ) , // PK 5 ** 67 ** A13
_BV( 6 ) , // PK 6 ** 68 ** A14
_BV( 7 ) , // PK 7 ** 69 ** A15
_BV( 6 ) , // PE 6 ** 70 ** APM only
};
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
@ -275,6 +277,7 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
NOT_ON_TIMER , // PK 5 ** 67 ** A13
NOT_ON_TIMER , // PK 6 ** 68 ** A14
NOT_ON_TIMER , // PK 7 ** 69 ** A15
NOT_ON_TIMER , // PE 6 ** 70 ** APM only
};
#endif

View File

@ -67,7 +67,7 @@ extern "C" {
#define TIMER5C 17
#define NUM_DIGITAL_PINS 70
#define NUM_DIGITAL_PINS 71
#define NUM_ANALOG_INPUTS 16
#define analogInputToDigitalPin(p) ((p < 16) ? (p) + 54 : -1)
#define digitalPinHasPWM(p) (((p) >= 2 && (p) <= 13) || ((p) >= 44 && (p)<= 46))