v0.9.8 - Ongoing
================
+- Added I2C driver for PN532
+- Updated and added PN532 examples at
+ /tools/examples/sensors/PN532
- updated touchscreen.h to be a bit clearer during
calibration, though it can still be much better
organised
OBJS += mcp4725.o
# RFID/NFC
-VPATH += drivers/sensors/pn532
-OBJS += pn532.o
+VPATH += drivers/sensors/pn532 drivers/sensors/pn532/helpers
+OBJS += pn532.o pn532_bus_i2c.o pn532_bus_uart.o
+OBJS += pn532_mifare_classic.o pn532_mifare_ultralight.o
# TAOS Light Sensors
VPATH += drivers/sensors/tcs3414 drivers/sensors/tsl2561
<int Value="1" Name="m_selectedTab"/>
<wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\build\codelite\LPC1343 Workspace.workspace" Name="m_workspaceName"/>
<TabInfoArray Name="TabInfoArray">
+ <TabInfo>
+ <wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\Makefile" Name="FileName"/>
+ <int Value="55" Name="FirstVisibleLine"/>
+ <int Value="60" Name="CurrentLine"/>
+ <wxArrayString Name="Bookmarks"/>
+ </TabInfo>
<TabInfo>
<wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" Name="FileName"/>
- <int Value="46" Name="FirstVisibleLine"/>
- <int Value="19" Name="CurrentLine"/>
+ <int Value="0" Name="FirstVisibleLine"/>
+ <int Value="14" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
<TabInfo>
<wxString Value="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\projectconfig.h" Name="FileName"/>
- <int Value="18" Name="FirstVisibleLine"/>
- <int Value="36" Name="CurrentLine"/>
+ <int Value="0" Name="FirstVisibleLine"/>
+ <int Value="27" Name="CurrentLine"/>
<wxArrayString Name="Bookmarks"/>
</TabInfo>
</TabInfoArray>
<VirtualDirectory Name="pn532">
<File Name="../../drivers/sensors/pn532/pn532.c"/>
<File Name="../../drivers/sensors/pn532/pn532.h"/>
- <File Name="../../drivers/sensors/pn532/pn532_drvr.h"/>
- <File Name="../../drivers/sensors/pn532/pn532_drvr_uart.c"/>
+ <VirtualDirectory Name="helpers">
+ <File Name="../../drivers/sensors/pn532/helpers/pn532_mifare.h"/>
+ <File Name="../../drivers/sensors/pn532/helpers/pn532_mifare_classic.c"/>
+ <File Name="../../drivers/sensors/pn532/helpers/pn532_mifare_classic.h"/>
+ <File Name="../../drivers/sensors/pn532/helpers/pn532_mifare_ultralight.c"/>
+ <File Name="../../drivers/sensors/pn532/helpers/pn532_mifare_ultralight.h"/>
+ </VirtualDirectory>
+ <File Name="../../drivers/sensors/pn532/pn532_bus.h"/>
+ <File Name="../../drivers/sensors/pn532/pn532_bus_i2c.c"/>
+ <File Name="../../drivers/sensors/pn532/pn532_bus_uart.c"/>
</VirtualDirectory>
<VirtualDirectory Name="tcs3414">
<File Name="../../drivers/sensors/tcs3414/tcs3414.c"/>
<file file_name="../../drivers/sensors/pn532/pn532.c">
<configuration Name="THUMB Flash Release" build_exclude_from_build="No"/>
</file>
- <file file_name="../../drivers/sensors/pn532/pn532_bus_uart.c"/>
+ <file file_name="../../drivers/sensors/pn532/pn532_bus_uart.c">
+ <configuration Name="THUMB Flash Debug" build_exclude_from_build="No"/>
+ </file>
<folder Name="helpers">
<file file_name="../../drivers/sensors/pn532/helpers/pn532_mifare_classic.c"/>
<file file_name="../../drivers/sensors/pn532/helpers/pn532_mifare_ultralight.c"/>
</ETMWindow>
<ExecutionCountWindow/>
<Memory1>
- <MemoryWindow autoEvaluate="0" addressText="0x100003d0" numColumns="8" sizeText="12" dataSize="1" radix="16" addressSpace="" />
+ <MemoryWindow autoEvaluate="0" addressText="&pbtResponse" numColumns="8" sizeText="64" dataSize="1" radix="16" addressSpace="" />
</Memory1>
<Memory2>
<MemoryWindow autoEvaluate="0" addressText="" numColumns="8" sizeText="" dataSize="1" radix="16" addressSpace="" />
<ProjectSessionItem path="LPC1343_CodeBase" name="unnamed" />
<ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase" name="unnamed" />
<ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;project" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;project;commands" name="unnamed" />
- <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;project;commands;drawing" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;sensors" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;sensors;pn532" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;Source Files;drivers;sensors;pn532;helpers" name="unnamed" />
+ <ProjectSessionItem path="LPC1343_CodeBase;LPC1343_CodeBase;System Files" name="unnamed" />
</Project>
<Register1>
<RegisterWindow openNodes="USB;USB/USBRxPLen;USB/USBTxPLen;USB/USBCtrl" binaryNodes="" hiddenNodes="" unsignedNodes="" visibleGroups="CPU;USB" decimalNodes="" octalNodes="" asciiNodes="" />
<Watches active="0" update="Never" />
</Watch4>
<Files>
- <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="43" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="32" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="31" />
+ <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" y="48" path="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\main.c" left="0" selected="1" name="unnamed" top="33" />
</Files>
- <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="Segger J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\sensors\pn532" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Release" />
+ <ARMCrossStudioWindow activeProject="LPC1343_CodeBase" autoConnectTarget="Segger J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dropbox\microBuilder\Code\LPC1343\LPC1343_CodeBase_GIT\drivers\sensors\pn532" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388991" debugSearchPath="" buildConfiguration="THUMB Flash Debug" />
</session>
** Function name: I2CStart
**
** Descriptions: Create I2C start condition, a timeout
-** value is set if the I2C never gets started,
-** and timed out. It's a fatal error.
+** value is set if the I2C never gets started,
+** and timed out. It's a fatal error.
**
** parameters: None
** Returned value: true or false, return false if timed out
**
** parameters: I2c mode is either MASTER or SLAVE
** Returned value: true or false, return false if the I2C
-** interrupt handler was not installed correctly
+** interrupt handler was not installed correctly
**
*****************************************************************************/
uint32_t i2cInit( uint32_t I2cMode )
** Function name: I2CEngine
**
** Descriptions: The routine to complete a I2C transaction
-** from start to stop. All the intermitten
-** steps are handled in the interrupt handler.
-** Before this routine is called, the read
-** length, write length and I2C master buffer
-** need to be filled.
+** from start to stop. All the intermitten
+** steps are handled in the interrupt handler.
+** Before this routine is called, the read
+** length, write length and I2C master buffer
+** need to be filled.
**
** parameters: None
** Returned value: Any of the I2CSTATE_... values. See i2c.h
Fast Mode (400KHz) = CFG_CPU_CCLK / 800000
Fast- Mode Plus (1MHz) = CFG_CPU_CCLK / 2000000 */
-#define I2SCLH_SCLH CFG_CPU_CCLK / 800000 /* Standard Mode I2C SCL Duty Cycle High (400KHz) */
-#define I2SCLL_SCLL CFG_CPU_CCLK / 800000 /* Fast Mode I2C SCL Duty Cycle Low (400KHz) */
+#define I2SCLH_SCLH CFG_CPU_CCLK / 200000 /* Standard Mode I2C SCL Duty Cycle High (400KHz) */
+#define I2SCLL_SCLL CFG_CPU_CCLK / 200000 /* Fast Mode I2C SCL Duty Cycle Low (400KHz) */
#define I2SCLH_HS_SCLH CFG_CPU_CCLK / 2000000 /* Fast Plus I2C SCL Duty Cycle High Reg */
#define I2SCLL_HS_SCLL CFG_CPU_CCLK / 2000000 /* Fast Plus I2C SCL Duty Cycle Low Reg */
#include "projectconfig.h"
// These may need to be enlarged for multi card support
-#define PN532_RESPONSELEN_INLISTPASSIVETARGET (32)
-#define PN532_RESPONSELEN_INDATAEXCHANGE (32)
+#define PN532_RESPONSELEN_INLISTPASSIVETARGET (64)
+#define PN532_RESPONSELEN_INDATAEXCHANGE (64)
typedef enum pn532_mifare_cmd_e
{
{
/* Card appears to be Mifare Classic */
*szCUIDLen = abtResponse[12];
- for (uint8_t i=0; i < *szCUIDLen; i++)
+ uint8_t i;
+ for (i=0; i < *szCUIDLen; i++)
{
pbtCUID[i] = abtResponse[13+i];
}
{
/* Card appears to be Mifare Ultralight */
*szCUIDLen = abtResponse[12];
- for (uint8_t i=0; i < *szCUIDLen; i++)
+ uint8_t i;
+ for (i=0; i < *szCUIDLen; i++)
{
pbtCUID[i] = abtResponse[13+i];
}
return PN532_ERROR_NONE;
}
-//static bool
-//read_card (void)
-//{
-// uint32_t page;
-// bool bFailure = false;
-// uint32_t uiReadedPages = 0;
-//
-// printf ("Reading %d pages |", uiBlocks + 1);
-//
-// for (page = 0; page <= uiBlocks; page += 4) {
-// // Try to read out the data block
-// if (nfc_initiator_mifare_cmd (pnd, MC_READ, page, &mp)) {
-// memcpy (mtDump.amb[page / 4].mbd.abtData, mp.mpd.abtData, 16);
-// } else {
-// bFailure = true;
-// break;
-// }
-//
-// print_success_or_failure (bFailure, &uiReadedPages);
-// print_success_or_failure (bFailure, &uiReadedPages);
-// print_success_or_failure (bFailure, &uiReadedPages);
-// print_success_or_failure (bFailure, &uiReadedPages);
-// }
-// printf ("|\n");
-// printf ("Done, %d of %d pages readed.\n", uiReadedPages, uiBlocks + 1);
-// fflush (stdout);
-//
-// return (!bFailure);
-//}
{
pn532_error_t error = PN532_ERROR_NONE;
pn532_pcb_t *pn532 = pn532GetPCB();
- uint32_t ready_timeout = 0;
// Check if we're busy
if (pn532->state == PN532_STATE_BUSY)
/**************************************************************************/
pn532_error_t pn532_bus_Wakeup(void)
{
- size_t szLen;
pn532_error_t error = PN532_ERROR_NONE;
byte_t abtWakeUp[] = { 0x55,0x55,0x00,0x00,0x00,0x00,0x00,0xff,0x03,0xfd,0xd4,0x14,0x01,0x17,0x00,0x00,0xff,0x03,0xfd,0xd4,0x14,0x01,0x17,0x00 };
uint32_t i;
SSD1306 . . . . X X X . X X . . . . . . .
SSD1351 . . . . X X X X X . . . . . . . .
MCP121 . . . . . . . . . . . . . . X . .
+ PN532 [3] . . . . . . . . . . . . . . X X .
TIMERS SSP ADC UART
====================== === ======= ====
can safely be used by other peripherals, but may need to be
reconfigured when you wakeup from deep-sleep.
[2] INTERFACE can be configured to use either USBCDC or UART
+ [3] 3.2 only used when with the I2C bus (for IRQ)
**************************************************************************/