Prefix defines.h, messages.h and types.h headers by "nfc-"

Rename dev_info struct to nfc_device_t
Some code cleanup
Rename pn531.h/c to pn531_usb.h/c
Rename pn533.h/c to pn533_usb.h/c
This commit is contained in:
Romuald Conty 2009-11-09 11:23:33 +00:00
parent 9ce99b80d3
commit 854dc3aceb
31 changed files with 419 additions and 433 deletions

View file

@ -22,14 +22,13 @@
*/
/*
Based on uart-code written by Teunis van Beelen available:
Based on RS232 code written by Teunis van Beelen available:
http://www.teuniz.net/RS-232/index.html
*/
#include "uart.h"
#include "messages.h"
#include "nfc-messages.h"
// Test if we are dealing with unix operating systems
#ifndef _WIN32
@ -325,6 +324,13 @@ uint32_t uart_get_speed(const serial_port sp)
return 0;
}
bool uart_cts(const serial_port sp)
{
char status;
if (ioctl(((serial_port_unix*)sp)->fd,TIOCMGET,&status) < 0) return false;
return (status & TIOCM_CTS);
}
bool uart_receive(const serial_port sp, byte_t* pbtRx, size_t* pszRxLen)
{
ReadFile(((serial_port_windows*)sp)->hPort,pbtRx,*pszRxLen,(LPDWORD)pszRxLen,NULL);
@ -338,4 +344,4 @@ bool uart_send(const serial_port sp, const byte_t* pbtTx, const size_t szTxLen)
return (dwTxLen != 0);
}
#endif
#endif /* _WIN32 */

View file

@ -21,14 +21,15 @@
* @brief
*/
#ifndef _LIBNFC_RS232_H_
#define _LIBNFC_RS232_H_
#ifndef __NFC_BUS_UART_H__
#define __NFC_BUS_UART_H__
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "defines.h"
#include "types.h"
#include "nfc-defines.h"
#include "nfc-types.h"
// Handle platform specific includes
#ifndef _WIN32
@ -58,6 +59,6 @@ uint32_t uart_get_speed(const serial_port sp);
bool uart_receive(const serial_port sp, byte_t* pbtRx, size_t* pszRxLen);
bool uart_send(const serial_port sp, const byte_t* pbtTx, const size_t szTxLen);
#endif // _LIBNFC_RS232_H_
#endif // __NFC_BUS_UART_H__