Exemple #1
0
int main(void) {

    WordVal src_addr_init = {SRC_ADDR};
    WordVal src_pan_id_init = {SRC_PAN_ID};
    WordVal dst_addr_init = {DST_ADDR};

    SetupClock();
    SwitchClocks();
    SetupPorts();
    batSetup();

    swatchSetup();
    radioInit(src_addr_init, src_pan_id_init, RXPQ_MAX_SIZE, TXPQ_MAX_SIZE);
	radioSetChannel(MY_CHAN); //Set to my channel
    macSetDestAddr(dst_addr_init);

    dfmemSetup();
	unsigned char memsize;
	memsize = dfmemGetChipSize();
    xlSetup();
    gyroSetup();
    mcSetup();
    cmdSetup();
    //senSetup();
	adcSetup();
    pidSetup();
    steeringSetup();
	
    //radioReadTrxId(id);

    LED_RED = 1;
    LED_BLUE = 0;
	LED_YELLOW = 0;

	//while(1);

    if(phyGetState() == 0x16)  { LED_GREEN = 1; }

    //print("Ready");	

	//readDFMemBySample(5);

    while(1) {
     	cmdHandleRadioRxBuffer();

		//Simple idle ; reduces idle current to 70 mA
        // TODO (abuchan, apullin, fgb) : Idle() causes unexpected behavior
		//if(radioIsRxQueueEmpty()){
		//	Idle();
		//}

    }
}
Exemple #2
0
int main(void) {

    //wakeTime = 0;
    //dcCounter = 0;

    // Processor Initialization
    SetupClock();
    SwitchClocks();
    SetupPorts();
    sclockSetup();

    LED_1 = 0;
    LED_2 = 0;
    LED_3 = 0;

    cmdSetup();
    
    radioInit(RADIO_TXPQ_MAX_SIZE, RADIO_RXPQ_MAX_SIZE);
    radioSetChannel(RADIO_CHANNEL);
    radioSetSrcPanID(RADIO_PAN_ID);
    radioSetSrcAddr(RADIO_SRC_ADDR);

    dfmemSetup();
    uint64_t id = dfmemGetUnqiueID();
    telemSetup(); //Timer 5, HW priority 4

    mpuSetup();
    imuSetup();   //Timer 4, HW priority 3
    
    tiHSetup();
    adcSetup();

    //AMS Encoders
    //encSetup();

    //"Open Loop" vibration & jitter generator, AP 2014
    //olVibeSetup();

    legCtrlSetup();  //Timer 1, HW priority 5
    steeringSetup(); //Timer 5, HW priority 4

    //Tail control is a special case
    //tailCtrlSetup();

    //Camera is untested with current code base, AP 12/6/2012
    //ovcamSetup();

    LED_RED = 1; //Red is use an "alive" indicator
    LED_GREEN = 0;
    LED_YELLOW = 0;

    //Radio startup verification
    //if (phyGetState() == 0x16) {
    //    LED_GREEN = 1;
    //}

    //Sleeping and low power options
    //_VREGS = 1;
    //gyroSleep();

    /////FUNCTION TEST, NOT FOR PRODUCTION
    //olVibeStart();
    ////////////////////

    while (1) {
        cmdHandleRadioRxBuffer();
        radioProcess();
    }
}