示例#1
0
void SetThree300K(uint8_t mode) {
	_AN(THREE300K)=0; 
	_TRIS(THREE300K)=0; 
	if (mode==LOW) _LAT(THREE300K)=0;
	if (mode==HIGH) _LAT(THREE300K)=1;
	if (mode==IN) {_AN(THREE300K)=1; _TRIS(THREE300K)=1;}
}
示例#2
0
void SetTwo300K(uint8_t mode) {
	_AN(TWO300K)=0;	
	_TRIS(TWO300K)=0;	
	if (mode==LOW) _LAT(TWO300K)=0;
	if (mode==HIGH) _LAT(TWO300K)=1;
	if (mode==IN) {_AN(TWO300K)=1; _TRIS(TWO300K)=1;}
}
示例#3
0
void SetOne300K(uint8_t mode) {
	_AN(ONE300K)=0;	
	_TRIS(ONE300K)=0;	
	if (mode==LOW)  _LAT(ONE300K)=0;
	if (mode==HIGH) _LAT(ONE300K)=1;
	if (mode==IN) {_AN(ONE300K)=1; _TRIS(ONE300K)=1;}
}
示例#4
0
文件: board.c 项目: ralfhartmann/GLOR
/*
******************************************************************************
* GLOBAL FUNCTIONS
******************************************************************************
*/
s8 boardInitialize()
{
    /* Set up I/O ports to all digital I/O. */
    AD1PCFG = 0xFFFF;

    _TRIS(AS3911_PIN_TM)   = 0;
    _TRIS(AS3911_PIN_SEN)  = 0;
    _TRIS(LED1_PIN) = 0;
    _TRIS(LED2_PIN) = 0;
    _TRIS(LED3_PIN) = 0;
    _TRIS(LED4_PIN) = 0;
#if DOOR_BOARD
    _TRIS(BEEP_PIN) = 0;
    _LATB3          = 0;
#endif

    return ERR_NONE;
}
示例#5
0
void InitializeSystem() {

#ifdef BOARD_UBW32
    // Disable ADC port (allows PORTB to be used for digital I/O)
    AD1PCFG = 0xFFFF;

    TRISE = 0x0000;
    TRISB = 0x0000;
    TRISC = 0x0000;
    TRISD = 0x0000;
    LATE = 0x0000;
    LATB = 0x0000;
    LATC = 0x0000;
    LATD = 0x0000;
#endif
#ifdef BOARD_HEXLIGHT
    ANSELA = 0x0000;
    ANSELB = 0x0000;
#endif
    LATA = 0x0000;
    LATB = 0x0000;

    // Ensure LED drivers are driven low as soon as possible
//    _TRIS(PIO_OC1) = 0;
//    _TRIS(PIO_OC2) = 0;
//    _TRIS(PIO_OC3) = 0;
//    _TRIS(PIO_OC4) = 0;
//    _LAT(PIO_OC1) = OUTPUT;
//    _LAT(PIO_OC2) = OUTPUT;
//    _LAT(PIO_OC3) = OUTPUT;
//    _LAT(PIO_OC4) = OUTPUT;

    // Force disconnect of USB bootloader
    U1CON = 0x00000000;
    U1PWRC = 0x00000000;

    // LEDs
//    _TRIS(PIO_LED1) = OUTPUT;
//    _TRIS(PIO_LED2) = OUTPUT;
#ifdef BOARD_UBW32
    _TRIS(PIO_LED3) = OUTPUT;
    _TRIS(PIO_LED_USB) = OUTPUT;
    _TRIS(PIO_BTN_PGM) = 1;
    _TRIS(PIO_BTN_USR) = 1;
#elif BOARD_HEXLIGHT
    _TRIS(PIO_BTN1) = INPUT;
    _TRIS(PIO_BTN2) = INPUT;
#endif

//    _TRIS(PIO_USBP) = INPUT;
//    _TRIS(PIO_USBN) = INPUT;

//    _LAT(PIO_LED1) = LOW;
//    _LAT(PIO_LED2) = LOW;
#ifdef BOARD_UBW32
    _LAT(PIO_LED3) = HIGH;
    _LAT(PIO_LED_USB) = LOW;
#endif

    mJTAGPortEnable(0);

    // Initializethe PIC32 core
    //OSCConfig(OSC_POSC_PLL, OSC_PLL_MULT_20, OSC_PLL_POST_2, OSC_FRC_POST_2);
    sys_clock = F_SYSCLK;
    mOSCSetPBDIV(OSC_PB_DIV_1);
    pb_clock = SYSTEMConfig(sys_clock, SYS_CFG_ALL);


    INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR);
    INTEnableInterrupts();

    // Initialize core time base
    SystickInit();
}