#include "Compiler.h"
#include "HardwareProfile.h"
#include "GenericTypeDefs.h"
#include "ff.h"
#include "uart1.h"

// Define the baud rate constants UART1
#define	UARTPARAM1			UARTPARAM_N81			//data=8bit parity=none stopbit=1bit

#define BAUDRATE1       	57600
#define	USE_RFCOMM_BAUDRATE	1						//0:baud rate as fixed 1:baud rate as RFCOMM parameter from Master
#define BRG_DIV1        	4
#define BRGH1           	1
// Define Hardware Flow Control UART1 (0:off 1:on)
#define	UART1_HW_FLOW		0
#define	UART1_TX_POLARITY	0						//送信信号極性 0:通常 1:反転
#define	UART1_RX_POLARITY	0						//受信信号極性 0:通常 1:反転

// Configure U1RX - put on pin 3 (RP23)
#define	u1rx_setup()
// Configure U1TX - put on pin 2 (RP22)
#define u1tx_setup()
// Configure U1CTS - put on pin 4 (RP24)
#define	u1cts_setup()
// Configure U1RTS - put on pin 5 (RC9)
// U1RTS has software control
#define	u1rts_setup()		(TRISDbits.TRISD1=0)
#define	u1rts_on()			(LATDbits.LATD1=0)	//ON:rx ready
#define	u1rts_off()			(LATDbits.LATD1=1)	//OFF:rx not ready


#define BOARD_SBDBT32       1

#if BOARD_SBDBT32
//
//for SBDBT32 board
//
// Configure LED1 - put on pin 14 (RB14)
#define	led1_setup()		(TRISBbits.TRISB14=0)
#define	led1_on()			(LATBbits.LATB14=0)	//ON
#define	led1_off()			(LATBbits.LATB14=1)	//OFF

// Configure LED2 - put on pin 15 (RB15)
#define	led2_setup()		(TRISBbits.TRISB15=0)
#define	led2_on()			(LATBbits.LATB15=0)	//ON
#define	led2_off()			(LATBbits.LATB15=1)	//OFF

#define SOCKWP	(0)					/* Write protected (yes:true, no:false, default:false) */
#define SOCKINS	!(PORTBbits.RB5)	/* Card inserted   (yes:true, no:false, default:true) */
#define	init_pullup()	{\
	CNPUEbits.CNPUE0=1;	/*MMC_DAT1 Pull-up*/	\
	CNPUEbits.CNPUE1=1;	/*MMC_DAT2 Pull-up*/	\
	CNPUEbits.CNPUE7=1;	/*MMC_CD Pull-up*/		\
	CNPUEbits.CNPUE9=1;	/*SDI2 Pull-up*/		\
}

/* Port Controls  (Platform dependent) */
#define CS_LOW()			LATGbits.LATG9 = 0	/* MMC CS = L */
#define CS_HIGH()			LATGbits.LATG9 = 1	/* MMC CS = H */


#endif
