X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fao_btm.c;h=44155ec142aa934863daa384500726f503a3af09;hb=01aee9ebe517ed657692e0a39a31ae0ddfb5b8b0;hp=172004e9c6aae746f0b30b64201c249e8ba1a57b;hpb=8be559baa979c15e78f8dba7879b383dbe3936d3;p=fw%2Faltos diff --git a/src/ao_btm.c b/src/ao_btm.c index 172004e9..44155ec1 100644 --- a/src/ao_btm.c +++ b/src/ao_btm.c @@ -17,21 +17,6 @@ #include "ao.h" -#if BT_LINK_ON_P2 -#define BT_PICTL_ICON PICTL_P2ICON -#define BT_PIFG P2IFG -#define BT_PDIR P2DIR -#define BT_PINP P2INP -#define BT_IEN2_PIE IEN2_P2IE -#endif -#if BT_LINK_ON_P1 -#define BT_PICTL_ICON PICTL_P1ICON -#define BT_PIFG P1IFG -#define BT_PDIR P1DIR -#define BT_PINP P1INP -#define BT_IEN2_PIE IEN2_P1IE -#endif - int8_t ao_btm_stdio; __xdata uint8_t ao_btm_connected; @@ -181,15 +166,6 @@ ao_btm(void) */ ao_delay(AO_SEC_TO_TICKS(3)); -#if BT_LINK_ON_P1 - if ((P1DIR & (1 << 6)) == 0) - ao_panic(AO_PANIC_BT); - if ((P1DIR & (1 << 7)) != 0) - ao_panic(AO_PANIC_BT); - if ((P0SEL & ((1 << 5) | (1 << 4) | (1 << 3) | (1 << 2))) != - ((1 << 5) | (1 << 4) | (1 << 3) | (1 << 2))) - ao_panic(AO_PANIC_BT); -#endif #if HAS_BEEP ao_beep_for(AO_BEEP_MID, AO_MS_TO_TICKS(200)); #endif @@ -236,6 +212,21 @@ ao_btm(void) __xdata struct ao_task ao_btm_task; +#if BT_LINK_ON_P2 +#define BT_PICTL_ICON PICTL_P2ICON +#define BT_PIFG P2IFG +#define BT_PDIR P2DIR +#define BT_PINP P2INP +#define BT_IEN2_PIE IEN2_P2IE +#endif +#if BT_LINK_ON_P1 +#define BT_PICTL_ICON PICTL_P1ICON +#define BT_PIFG P1IFG +#define BT_PDIR P1DIR +#define BT_PINP P1INP +#define BT_IEN2_PIE IEN2_P1IE +#endif + void ao_btm_check_link() __critical { @@ -257,6 +248,9 @@ ao_btm_isr(void) __interrupt 15 #endif { +#if BT_LINK_ON_P1 + P1IF = 0; +#endif if (BT_PIFG & (1 << BT_LINK_PIN_INDEX)) { ao_btm_check_link(); ao_wakeup(&ao_btm_connected);