Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 151 → Rev 154

/PIC Stuff/PIC_27J13/interrupts.h
11,9 → 11,8
// Initialize the interrupts
void Interrupt_Init(void);
 
// enable the interrupts (high and low priority)
// Enable the interrupts (high and low priority)
void Interrupt_Enable(void);
 
void Interrupt_Disable(void);
 
#endif
/PIC Stuff/PIC_27J13/led_HT16K33.c
40,13 → 40,13
result = I2C_Get_Status();
}
 
LED_blinkRate(HT16K33_BLINK_OFF);
LED_setBrightness(15); // Max brightness
LED_clear();
LED_writeDisplay();
LED_Blink_Rate(HT16K33_BLINK_OFF);
LED_Set_Brightness(15); // Max brightness
LED_Clear();
LED_Write_Display();
}
 
void LED_setBrightness(unsigned char c) {
void LED_Set_Brightness(unsigned char c) {
unsigned char result;
if (c > 15) c = 15;
59,7 → 59,7
}
}
 
void LED_blinkRate(unsigned char c) {
void LED_Blink_Rate(unsigned char c) {
unsigned char buffer;
 
if (c > 3) c = 0;
73,7 → 73,7
}
}
 
void LED_writeDisplay() {
void LED_Write_Display() {
unsigned char result;
led_data_p->display_buffer[0] = 0x00; // Start at address 0x00
85,7 → 85,7
}
}
 
void LED_clear() {
void LED_Clear() {
unsigned char c;
for (c = 0; c < 17; c++) {
led_data_p->display_buffer[c] = 0;
92,7 → 92,7
}
}
 
void LED_drawColon(unsigned char c) {
void LED_Draw_Colon(unsigned char c) {
if (c) {
led_data_p->display_buffer[5] = 0xFF;
} else {
100,38 → 100,38
}
}
 
void LED_writeDigitRaw(unsigned char loc, unsigned char bitmask) {
void LED_Write_Digit_Raw(unsigned char loc, unsigned char bitmask) {
if (loc > 4) return;
led_data_p->display_buffer[(loc<<1)+1] = bitmask;
}
 
void LED_writeDigitNum(unsigned char loc, unsigned char num, unsigned char dot) {
void LED_Write_Digit_Num(unsigned char loc, unsigned char num, unsigned char dot) {
if (loc > 4) return;
if (loc > 1) loc++;
LED_writeDigitRaw(loc, numbertable[num] | dot << 7);
LED_Write_Digit_Raw(loc, numbertable[num] | dot << 7);
}
 
void LED_writeDigitAlpha(unsigned char loc, unsigned char alpha, unsigned char dot) {
void LED_Write_Digit_Alpha(unsigned char loc, unsigned char alpha, unsigned char dot) {
if (loc > 4) return;
if (loc > 1) loc++;
LED_writeDigitRaw(loc, alphatable[alpha] | dot << 7);
LED_Write_Digit_Raw(loc, alphatable[alpha] | dot << 7);
}
 
void LED_writeNum(unsigned int i) {
LED_writeDigitNum(0, (i%10000)/1000, 0);
LED_writeDigitNum(1, (i%1000)/100, 0);
LED_writeDigitNum(2, (i%100)/10, 0);
LED_writeDigitNum(3, i%10, 0);
void LED_Write_Num(unsigned int i) {
LED_Write_Digit_Num(0, (i%10000)/1000, 0);
LED_Write_Digit_Num(1, (i%1000)/100, 0);
LED_Write_Digit_Num(2, (i%100)/10, 0);
LED_Write_Digit_Num(3, i%10, 0);
 
if (i < 10) {
LED_writeDigitRaw(0, 0);
LED_writeDigitRaw(1, 0);
LED_writeDigitRaw(3, 0);
LED_Write_Digit_Raw(0, 0);
LED_Write_Digit_Raw(1, 0);
LED_Write_Digit_Raw(3, 0);
} else if (i < 100) {
LED_writeDigitRaw(0, 0);
LED_writeDigitRaw(1, 0);
LED_Write_Digit_Raw(0, 0);
LED_Write_Digit_Raw(1, 0);
} else if (i < 1000) {
LED_writeDigitRaw(0, 0);
LED_Write_Digit_Raw(0, 0);
}
LED_writeDisplay();
LED_Write_Display();
}
/PIC Stuff/PIC_27J13/led_HT16K33.h
17,15 → 17,15
 
void LED_Init(void);
void LED_Start(void);
void LED_setBrightness(unsigned char c);
void LED_blinkRate(unsigned char c);
void LED_writeDisplay(void);
void LED_clear(void);
void LED_drawColon(unsigned char c);
void LED_writeDigitRaw(unsigned char loc, unsigned char bitmask);
void LED_writeDigitNum(unsigned char loc, unsigned char num, unsigned char dot);
void LED_writeDigitAlpha(unsigned char loc, unsigned char alpha, unsigned char dot);
void LED_writeNum(unsigned int i);
void LED_Set_Brightness(unsigned char c);
void LED_Blink_Rate(unsigned char c);
void LED_Write_Display(void);
void LED_Clear(void);
void LED_Draw_Colon(unsigned char c);
void LED_Write_Digit_Raw(unsigned char loc, unsigned char bitmask);
void LED_Write_Digit_Num(unsigned char loc, unsigned char num, unsigned char dot);
void LED_Write_Digit_Alpha(unsigned char loc, unsigned char alpha, unsigned char dot);
void LED_Write_Num(unsigned int i);
 
 
#endif /* LED_BACKPACK_H */
/PIC Stuff/PIC_27J13/lux_TSL2561.c
33,8 → 33,8
DBG_PRINT_LUX("\r\n");
 
// Set default integration time and gain
LUX_SetTiming(tsl2561_data_p->integration);
LUX_SetGain(tsl2561_data_p->gain);
LUX_Set_Timing(tsl2561_data_p->integration);
LUX_Set_Gain(tsl2561_data_p->gain);
 
// Start the chip in power-down mode
LUX_Disable();
41,30 → 41,30
}
 
void LUX_Enable() {
LUX_Write2Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWERON);
LUX_Write_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWERON);
}
 
void LUX_Disable() {
LUX_Write2Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWEROFF);
LUX_Write_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWEROFF);
}
 
void LUX_SetGain(tsl2561Gain_t gain) {
void LUX_Set_Gain(tsl2561Gain_t gain) {
LUX_Enable();
tsl2561_data_p->gain = gain;
LUX_Write2Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING,
LUX_Write_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING,
tsl2561_data_p->integration | tsl2561_data_p->gain);
LUX_Disable();
}
 
void LUX_SetTiming(tsl2561IntegrationTime_t integration) {
void LUX_Set_Timing(tsl2561IntegrationTime_t integration) {
LUX_Enable();
tsl2561_data_p->integration = integration;
LUX_Write2Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING,
LUX_Write_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING,
tsl2561_data_p->integration | tsl2561_data_p->gain);
LUX_Disable();
}
 
unsigned long LUX_CalculateLux(unsigned int ch0, unsigned int ch1) {
unsigned long LUX_Calculate_Lux(unsigned int ch0, unsigned int ch1) {
unsigned long chScale, channel0, channel1, ratio1, ratio, temp, lux;
unsigned int b, m;
 
149,7 → 149,7
return lux;
}
 
unsigned long LUX_GetFullLuminosity() {
unsigned long LUX_Get_Full_Luminosity() {
unsigned long x;
 
// Enable the device by setting the control bit to 0x03
176,9 → 176,9
break;
}
 
x = LUX_Read2Bytes(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN1_LOW);
x = LUX_Read_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN1_LOW);
x <<= 16;
x |= LUX_Read2Bytes(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN0_LOW);
x |= LUX_Read_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN0_LOW);
 
LUX_Disable();
 
185,8 → 185,8
return x;
}
 
unsigned int LUX_GetLuminosity(unsigned char channel) {
unsigned long x = LUX_GetFullLuminosity();
unsigned int LUX_Get_Luminosity(unsigned char channel) {
unsigned long x = LUX_Get_Full_Luminosity();
 
if (channel == 0) {
// Reads two byte value from channel 0 (visible + infrared)
203,7 → 203,7
return 0;
}
 
void LUX_Write2Bytes(unsigned char reg, unsigned char value) {
void LUX_Write_2_Bytes(unsigned char reg, unsigned char value) {
unsigned char buffer[2], result;
buffer[0] = reg;
buffer[1] = value;
213,7 → 213,7
} while (!result);
}
 
unsigned int LUX_Read2Bytes(unsigned char reg) {
unsigned int LUX_Read_2_Bytes(unsigned char reg) {
unsigned char result, length, buffer[2];
unsigned int ret;
 
/PIC Stuff/PIC_27J13/lux_TSL2561.h
121,14 → 121,14
void LUX_Begin(void);
void LUX_Enable(void);
void LUX_Disable(void);
void LUX_SetTiming(tsl2561IntegrationTime_t integration);
void LUX_SetGain(tsl2561Gain_t gain);
unsigned long LUX_CalculateLux(unsigned int ch0, unsigned int ch1);
unsigned long LUX_GetFullLuminosity(void);
unsigned int LUX_GetLuminosity(unsigned char channel);
void LUX_Set_Timing(tsl2561IntegrationTime_t integration);
void LUX_Set_Gain(tsl2561Gain_t gain);
unsigned long LUX_Calculate_Lux(unsigned int ch0, unsigned int ch1);
unsigned long LUX_Get_Full_Luminosity(void);
unsigned int LUX_Get_Luminosity(unsigned char channel);
 
void LUX_Write2Bytes(unsigned char reg, unsigned char value);
unsigned int LUX_Read2Bytes(unsigned char reg);
void LUX_Write_2_Bytes(unsigned char reg, unsigned char value);
unsigned int LUX_Read_2_Bytes(unsigned char reg);
 
#endif /* LUX_TSL2561_H */
 
/PIC Stuff/PIC_27J13/main.c
237,11 → 237,11
 
DBG_PRINT_MAIN("\r\nBegin Program\r\n");
 
version = NFC_getFirmwareVersion();
version = NFC_Get_Firmware_Version();
while (!version.IC) {
DBG_PRINT_MAIN("Waiting for NFC board..\r\n");
Delay10KTCYx(3);
version = NFC_getFirmwareVersion();
version = NFC_Get_Firmware_Version();
}
DBG_PRINT_MAIN("Found chip PN5%X\r\n", version.IC);
DBG_PRINT_MAIN("Firmware ver. %d.%d\r\n", version.Ver, version.Rev);
292,7 → 292,7
// }
 
// This query will not wait for a detection before responding
length = NFC_pollTargets(1, 1, cardData);
length = NFC_Poll_Targets(1, 1, cardData);
if (!length) {
memset(cardData_prev, 0, 24);
} else if (length == 1) {
379,23 → 379,23
DBG_PRINT_MAIN("\r\nBegin Program\r\n");
 
LED_Start();
LED_writeDigitNum(0, 1, 1);
LED_writeDigitNum(1, 2, 0);
LED_writeDigitNum(2, 3, 0);
LED_writeDigitNum(3, 4, 0);
LED_writeDisplay();
LED_Write_Digit_Num(0, 1, 1);
LED_Write_Digit_Num(1, 2, 0);
LED_Write_Digit_Num(2, 3, 0);
LED_Write_Digit_Num(3, 4, 0);
LED_Write_Display();
for (i = 0; i < 15; i++) {
LED_setBrightness(15 - i);
LED_Set_Brightness(15 - i);
Delay10KTCYx(100);
}
for (i = 0; i < 15; i++) {
LED_setBrightness(i);
LED_Set_Brightness(i);
Delay10KTCYx(100);
}
LED_blinkRate(HT16K33_BLINK_OFF);
LED_Blink_Rate(HT16K33_BLINK_OFF);
 
while (1) {
LED_writeNum(counter);
LED_Write_Num(counter);
counter++;
if (counter > 9999)
counter = 0;
840,8 → 840,8
case XBEE_RX_DATA_PACKET:
DBG_PRINT_MAIN("XBEE: parsing recieved data recieved frame\r\n");
rx_data_frame = (void *) buffer;
XBee_ConvertEndian64(&(rx_data_frame->source_64));
XBee_ConvertEndian16(&(rx_data_frame->source_16));
XBee_Convert_Endian_64(&(rx_data_frame->source_64));
XBee_Convert_Endian_16(&(rx_data_frame->source_16));
DBG_PRINT_MAIN("Source 64: %08lX %08lX Source 16: %04X Options: %02X\r\n", \\
rx_data_frame->source_64.UPPER_32.long_value, \\
rx_data_frame->source_64.LOWER_32.long_value, \\
856,7 → 856,7
case XBEE_RX_DATA_TX_STATUS:
DBG_PRINT_MAIN("XBEE: parsing recieved TX status frame\r\n");
rx_tx_status_frame = (void *) buffer;
XBee_ConvertEndian16(&(rx_tx_status_frame->destination_16));
XBee_Convert_Endian_16(&(rx_tx_status_frame->destination_16));
DBG_PRINT_MAIN("Frame ID: %u Destination 16: %04X\r\n", \\
rx_tx_status_frame->frame_id, rx_tx_status_frame->destination_16.INT_16.int_value);
DBG_PRINT_MAIN("Transmit Retry Count: %02X Delivery Status: %02X Discovery Status: %02X\r\n", \\
879,11 → 879,11
case XBEE_RX_NODE_IDENTIFICATION:
DBG_PRINT_MAIN("XBEE: parsing recieved node identification frame\r\n");
rx_node_ident_frame = (void *) buffer;
XBee_ConvertEndian64(&(rx_node_ident_frame->source_64));
XBee_ConvertEndian16(&(rx_node_ident_frame->source_16));
XBee_ConvertEndian64(&(rx_node_ident_frame->remote_64));
XBee_ConvertEndian16(&(rx_node_ident_frame->remote_16));
XBee_ConvertEndian16(&(rx_node_ident_frame->parent_16));
XBee_Convert_Endian_64(&(rx_node_ident_frame->source_64));
XBee_Convert_Endian_16(&(rx_node_ident_frame->source_16));
XBee_Convert_Endian_64(&(rx_node_ident_frame->remote_64));
XBee_Convert_Endian_16(&(rx_node_ident_frame->remote_16));
XBee_Convert_Endian_16(&(rx_node_ident_frame->parent_16));
DBG_PRINT_MAIN("Source 64: %08lX %08lX Source 16: %04X Options: %02X\r\n", \\
rx_node_ident_frame->source_64.UPPER_32.long_value, \\
rx_node_ident_frame->source_64.LOWER_32.long_value, \\
951,12 → 951,12
SSD1306_Set_Rotation(0);
SSD1306_Set_Cursor(0, 0);
 
version = NFC_getFirmwareVersion();
version = NFC_Get_Firmware_Version();
while (!version.IC) {
SSD1306_Write_String("Waiting for NFC board..\r");
SSD1306_Display();
Delay10KTCYx(3);
version = NFC_getFirmwareVersion();
version = NFC_Get_Firmware_Version();
}
SSD1306_Write_String("PN5%X Ver. %d.%d\r", version.IC, version.Ver, version.Rev);
SSD1306_Display();
965,7 → 965,7
while (1) {
 
// This query will not wait for a detection before responding
length = NFC_pollTargets(1, 1, cardData);
length = NFC_Poll_Targets(1, 1, cardData);
if (!length) {
memset(cardData_prev, 0, 24);
} else if (length == 1) {
1065,23 → 1065,23
LUX_Begin();
// You can change the gain on the fly, to adapt to brighter/dimmer light situations
LUX_SetGain(TSL2561_GAIN_0X); // set no gain (for bright situtations)
LUX_Set_Gain(TSL2561_GAIN_0X); // set no gain (for bright situtations)
// LUX_SetGain(TSL2561_GAIN_16X); // set 16x gain (for dim situations)
 
// Changing the integration time gives you a longer time over which to sense light
// longer timelines are slower, but are good in very low light situtations!
LUX_SetTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
LUX_Set_Timing(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
// LUX_SetTiming(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
// LUX_SetTiming(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)
 
while (1) {
lum = LUX_GetFullLuminosity();
lum = LUX_Get_Full_Luminosity();
ir = lum >> 16;
full = lum & 0xFFFF;
DBG_PRINT_LUX("IR: %d\r\n", ir);
DBG_PRINT_LUX("Visible: %d\r\n", full - ir);
DBG_PRINT_LUX("Full: %d\r\n", full);
DBG_PRINT_LUX("Lux: %ld\r\n\r\n", LUX_CalculateLux(full, ir));
DBG_PRINT_LUX("Lux: %ld\r\n\r\n", LUX_Calculate_Lux(full, ir));
 
Delay10KTCYx(255);
Delay10KTCYx(255);
1184,7 → 1184,6
LUX_Init(TSL2561_ADDR_FLOAT);
 
I2C_Configure_Master(I2C_400KHZ);
 
Interrupt_Enable(); // Enable high-priority interrupts and low-priority interrupts
Interrupt_Init(); // Initialize the interrupt priorities
1193,16 → 1192,16
// You can change the gain on the fly, to adapt to brighter/dimmer light situations
// LUX_SetGain(TSL2561_GAIN_0X); // set no gain (for bright situtations)
LUX_SetGain(TSL2561_GAIN_16X); // set 16x gain (for dim situations)
LUX_Set_Gain(TSL2561_GAIN_16X); // set 16x gain (for dim situations)
 
// Changing the integration time gives you a longer time over which to sense light
// longer timelines are slower, but are good in very low light situtations!
LUX_SetTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
// LUX_SetTiming(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
// LUX_SetTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
LUX_Set_Timing(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
// LUX_SetTiming(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)
 
while (1) {
lum = LUX_GetFullLuminosity();
lum = LUX_Get_Full_Luminosity();
ir = lum >> 16;
full = lum & 0xFFFF;
NHD_Set_Cursor(0, 0);
1209,7 → 1208,7
NHD_Write_String("I: %d ", ir);
NHD_Write_String("V: %d ", full - ir);
NHD_Set_Cursor(0, 1);
NHD_Write_String("Lux: %ld ", LUX_CalculateLux(full, ir));
NHD_Write_String("Lux: %ld ", LUX_Calculate_Lux(full, ir));
 
Delay10KTCYx(100);
}
/PIC Stuff/PIC_27J13/nbproject/private/private.xml
3,11 → 3,6
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
<file>file:/C:/Users/Kevin/Documents/Code/PIC_27J13/main.c</file>
<file>file:/C:/Users/Kevin/Documents/Code/PIC_27J13/temp_BMP085.c</file>
<file>file:/C:/Users/Kevin/Documents/Code/PIC_27J13/interrupts.c</file>
<file>file:/C:/Users/Kevin/Documents/Code/PIC_27J13/defines.h</file>
<file>file:/C:/Users/Kevin/Documents/Code/PIC_27J13/temp_BMP085.h</file>
<file>file:/C:/Users/Kevin/Documents/Code/PIC_27J13/uart.h</file>
<file>file:/C:/Users/Kevin/Documents/Code/PIC_27J13/interrupts.h</file>
</open-files>
</project-private>
/PIC Stuff/PIC_27J13/nfc_PN532.c
31,7 → 31,7
nfc_data_p->packetbuffer[2] = 0x14; // Timeout 50ms * 20 = 1s
nfc_data_p->packetbuffer[3] = 0x01; // Use IRQ pin
 
if (!NFC_sendCommandCheckAck(nfc_data_p->packetbuffer, 4))
if (!NFC_Send_Command_Check_Ack(nfc_data_p->packetbuffer, 4))
return 0;
 
NFC_I2C_Read_Data(nfc_data_p->packetbuffer, 8);
40,13 → 40,13
}
 
// Checks the firmware version of the PN5xx chip
NFC_FIRMWARE_VERSION NFC_getFirmwareVersion(void) {
NFC_FIRMWARE_VERSION NFC_Get_Firmware_Version(void) {
NFC_FIRMWARE_VERSION response = {0, 0, 0, 0};
 
// Create and send command
nfc_data_p->packetbuffer[0] = PN532_COMMAND_GETFIRMWAREVERSION;
 
if (!NFC_sendCommandCheckAck(nfc_data_p->packetbuffer, 1))
if (!NFC_Send_Command_Check_Ack(nfc_data_p->packetbuffer, 1))
return response;
 
// Read back data from the PN532
66,7 → 66,7
}
 
// Sends a command and waits a specified period for the ACK
unsigned char NFC_sendCommandCheckAck(unsigned char *cmd, unsigned char cmdlen) {
unsigned char NFC_Send_Command_Check_Ack(unsigned char *cmd, unsigned char cmdlen) {
unsigned int timer = 0;
 
// Write the command
91,13 → 91,13
}
 
// Passive polling, waits for an ISO14443A target to enter the field
unsigned char NFC_readPassiveTargetID(NFC_TargetDataMiFare *cardData) {
unsigned char NFC_Read_Passive_Target_ID(NFC_TargetDataMiFare *cardData) {
nfc_data_p->packetbuffer[0] = PN532_COMMAND_INLISTPASSIVETARGET;
nfc_data_p->packetbuffer[1] = 2; // Max 2 cards at once
nfc_data_p->packetbuffer[2] = PN532_MIFARE_ISO14443A; // Mifare only
 
if (!NFC_sendCommandCheckAck(nfc_data_p->packetbuffer, 3))
if (!NFC_Send_Command_Check_Ack(nfc_data_p->packetbuffer, 3))
return 0;
 
// Wait for IRQ line
149,7 → 149,7
}
 
// Active polling, returns number of cards in the field
unsigned char NFC_pollTargets(unsigned char number, unsigned char period, NFC_TargetDataMiFare *cardData) {
unsigned char NFC_Poll_Targets(unsigned char number, unsigned char period, NFC_TargetDataMiFare *cardData) {
nfc_data_p->packetbuffer[0] = PN532_COMMAND_INAUTOPOLL;
nfc_data_p->packetbuffer[1] = number; // Number of polling
156,7 → 156,7
nfc_data_p->packetbuffer[2] = period; // Polling period in units of 150ms
nfc_data_p->packetbuffer[3] = 0x10; // Check for Mifare cards only
 
if (!NFC_sendCommandCheckAck(nfc_data_p->packetbuffer, 4))
if (!NFC_Send_Command_Check_Ack(nfc_data_p->packetbuffer, 4))
return 0;
 
// Wait for IRQ line
250,7 → 250,7
}
 
// Send frame and check for ACK
if (!NFC_sendCommandCheckAck(nfc_data_p->packetbuffer, 10 + uidLen))
if (!NFC_Send_Command_Check_Ack(nfc_data_p->packetbuffer, 10 + uidLen))
return 0;
 
// Read response from PN532
270,7 → 270,7
nfc_data_p->packetbuffer[3] = blockNumber; /* Block Number (0..63 for 1K, 0..255 for 4K) */
 
// Send frame and check for ACK
if (!NFC_sendCommandCheckAck(nfc_data_p->packetbuffer, 4))
if (!NFC_Send_Command_Check_Ack(nfc_data_p->packetbuffer, 4))
return 0;
 
// Read reponse
304,7 → 304,7
}
 
// Send frame and check for ACK
if (!NFC_sendCommandCheckAck(nfc_data_p->packetbuffer, 20))
if (!NFC_Send_Command_Check_Ack(nfc_data_p->packetbuffer, 20))
return 0;
 
// Read response
/PIC Stuff/PIC_27J13/nfc_PN532.h
142,14 → 142,14
 
// Generic PN532 functions
unsigned char NFC_SAMConfig(void);
NFC_FIRMWARE_VERSION NFC_getFirmwareVersion(void);
unsigned char NFC_sendCommandCheckAck(unsigned char *cmd, unsigned char cmdlen);
NFC_FIRMWARE_VERSION NFC_Get_Firmware_Version(void);
unsigned char NFC_Send_Command_Check_Ack(unsigned char *cmd, unsigned char cmdlen);
//unsigned char NFC_writeGPIO(unsigned char pinstate);
//unsigned char NFC_readGPIO(void);
 
// ISO14443A functions
unsigned char NFC_readPassiveTargetID(NFC_TargetDataMiFare *uidData);
unsigned char NFC_pollTargets(unsigned char number, unsigned char period, NFC_TargetDataMiFare *uidData);
unsigned char NFC_Read_Passive_Target_ID(NFC_TargetDataMiFare *uidData);
unsigned char NFC_Poll_Targets(unsigned char number, unsigned char period, NFC_TargetDataMiFare *uidData);
 
// Mifare Classic functions
unsigned char NFC_mifareclassic_IsFirstBlock(unsigned long uiBlock);
/PIC Stuff/PIC_27J13/uart.h
21,9 → 21,7
} UART_DATA;
 
void UART1_Init(void);
//void uart_2_init(void);
void UART1_Recv_Interrupt_Handler(void);
//void uart_2_recv_interrupt_handler(void);
void UART1_Send_Interrupt_Handler(void);
void UART1_WriteS(const rom char *fmt, ...);
void UART1_WriteF(float f, unsigned char m);
/PIC Stuff/PIC_27J13/xbee.c
212,7 → 212,7
}
}
 
void XBee_ConvertEndian64(XBEE_ADDRESS_64 *src) {
void XBee_Convert_Endian_64(XBEE_ADDRESS_64 *src) {
char tmp[2];
tmp[0] = src->UPPER_32.char_value[3];
tmp[1] = src->UPPER_32.char_value[2];
229,7 → 229,7
src->LOWER_32.char_value[0] = tmp[0];
}
 
void XBee_ConvertEndian16(XBEE_ADDRESS_16 *src) {
void XBee_Convert_Endian_16(XBEE_ADDRESS_16 *src) {
char tmp;
tmp = src->INT_16.char_value[0];
src->INT_16.char_value[0] = src->INT_16.char_value[1];
/PIC Stuff/PIC_27J13/xbee.h
263,7 → 263,7
void XBee_Set_RTS(unsigned char);
unsigned char XBee_Read_CTS(void);
 
void XBee_ConvertEndian64(XBEE_ADDRESS_64 *src);
void XBee_ConvertEndian16(XBEE_ADDRESS_16 *src);
void XBee_Convert_Endian_64(XBEE_ADDRESS_64 *src);
void XBee_Convert_Endian_16(XBEE_ADDRESS_16 *src);
 
#endif