/*
 * api_GPIO.c
 *
 *  Created on: Aug 1, 2014
 *      Author: QTC
 */

#define  GLOBALS_BSP_GPIO
#include "../app_Headers/g_includes.h"


/*-------------------------------------------------------------------------
* Function Name  : bsp_GPIO_Init
* Description    : 
* Input          : None
* Output         : None
* Return         : None
* onther         : 
--------------------------------------------------------------------------*/
void bsp_GPIO_Init(void)
{
    PUCR   = 0x40;  //上拉驱动使能 禁止下拉
    
    DDR1AD = 0x00;   
    PER1AD = 0x06;   
        
    DDRA   = 0xff;
                        
    DDRB   = 0xff;    
             
    DDRU   = 0xff;    
    PERU   = 0x00;
    PPSU   = 0x00;
         
    DDRR   = 0x70;        
    PERR   = 0x00;  
    PPSR   = 0x00;   
      
    DDRV   = 0xf0;   
    PERV   = 0x03;
    PPSV   = 0x00;                   

    DDRH   = 0xff;
    PERH   = 0x00;
    PPSH   = 0x00;
    
    DDRS   = 0x00;
    PERS   = 0x00;
    PPSS   = 0x00;  //选择上拉 还是下拉
    RDRS   = 0x00;  //驱动能力选择          
    PTSRR  = 0x10;  //控制IIC OR SPI  
    
    WOMS   = 0x00;
    PIES   = 0x00;
    PIFS   = 0x00;
    SPICR1 = 0x00;
    SPICR2 = 0x01;
    
    PTPRR  = 0x06;
    //DDRP   = 0xf2; 
    DDRP   = 0xfE;
    PERP   = 0x00;    
    PPSP   = 0x00; 
    
    DDRT   = 0xff;    
    PERT   = 0x00;
    PPST   = 0x00; 
         
    PT1AD  = 0x00;
    PORTA  = 0x00;
    PORTB  = 0x00;
    PTT    = 0x00;
    PTH    = 0x00;
    PTU    = 0x00;
    PTP    = 0x00;
    PTR    = 0x00;  
    PTS    = 0x00; 
    PTV    = 0x00;
    ATDDIEN = 0x06; 
}



