AppNearMe µNFC stack for the NXP PN532 chip License: You can use the stack free of charge to prototype with mbed; if you want to use the stack with your commercial product, get in touch!
Dependents: IOT_sensor_nfc AppNearMe_MuNFC_PN532_Test p2p_nfc_test NFCMoodLamp ... more
License
You can use the stack free of charge to prototype with mbed; if you want to use the stack with your commercial product, get in touch!
Diff: PN532/MuNFCMbedPlatform.cpp
- Revision:
- 9:621a03f8d2f3
- Parent:
- 6:15b1c45d50d4
--- a/PN532/MuNFCMbedPlatform.cpp Thu Aug 16 15:40:15 2012 +0000 +++ b/PN532/MuNFCMbedPlatform.cpp Wed Aug 29 11:59:09 2012 +0000 @@ -71,7 +71,8 @@ */ void pn532_io_init(void) { - #if defined( TARGET_LPC11U24 ) + nfc_irq_pin_isr->mode(PullUp); + #if 0//defined( TARGET_LPC11U24 ) nfc_irq_pin_isr->rise(pn532_irq); //Cannot trigger on falling edge #else nfc_irq_pin_isr->fall(pn532_irq); @@ -85,7 +86,7 @@ bool pn532_irq_pin_get(void) { //return (nfc_irq_pin_int->read() ? false : true); - #if defined( TARGET_LPC11U24 ) + #if 0//defined( TARGET_LPC11U24 ) return (nfc_irq_pin_isr->read() ? true : false); #else return (nfc_irq_pin_isr->read() ? false : true); @@ -97,7 +98,8 @@ */ void pn532_cs_set(void) { - *nfc_cs_pin = 0; + //*nfc_cs_pin = 0; + nfc_cs_pin->write(0); } /* @@ -106,7 +108,6 @@ void pn532_cs_clear(void) { *nfc_cs_pin = 1; - //wait_us(10); } /* @@ -129,20 +130,8 @@ return pSem; } -DigitalOut led1(LED2); -DigitalOut led2(LED3); -DigitalOut led3(LED4); int rtos_semaphore_produce(struct rtos_semaphore* pSem) { - static int count = 0; - count ++; - if(count >= 8) - count = 0; - - led1 = (count&1)?1:0; - led2 = (count&2)?1:0; - led3 = (count&4)?1:0; - pSem->s->release(); return OK; } @@ -161,12 +150,10 @@ if(resid>0) { while( pSem->s->wait(0) > 0 ); - //printf("S\n"); return OK; } else { - //printf("T\n"); return ERR_TIMEOUT; } } @@ -314,10 +301,6 @@ writeb = reverse(writeb); #endif - #if defined( TARGET_LPC11U24 ) - //wait_us(30); - #endif - readb = nfc_spi->write(writeb); #if NFC_CONTROLLER == PN532