Пример #1
0
void UserInit(void){
	StartCritical();

	//println_W(startmessage);// All printfDEBUG functions do not need to be removed from code if debug is disabled
//#if defined(DEBUG)
//	ConfigureUART(115200);
//	if(GetChannelMode(16)!=IS_UART_TX)
//		setMode(16,IS_UART_TX);
//#endif
	setPrintLevelInfoPrint();
	println_I(/*PSTR*/("\e[1;1H\e[2J ***Starting User initialization***"));
	InitFlagPins();
	InitBankLEDs();
	SetPowerState0(0,0);
	SetPowerState1(0,0);


	//_delay_ms(1);

#if defined(WPIRBE)
	SPISlaveInit();
#endif


	//_delay_ms(100);
	println_I(/*PSTR*/("Starting Pin Functions"));
	InitPinFunction();
	println_I(/*PSTR*/("Starting Pin Modes"));
	InitPinModes();
	int i=0;
	//println_I(/*PSTR*/("Starting hardware modes"));
	for(i=0;i<GetNumberOfIOChannels();i++){
		initPinState(i);
		configAdvancedAsyncNotEqual(i,10);
		setAsyncLocal(i,true) ;
	}
	//println_I(/*PSTR*/("DONE pin initialization"));

	//println_I(/*PSTR*/("Adding IO Initialization"));
	addNamespaceToList((NAMESPACE_LIST *)get_bcsIoNamespace());
	//println_I(/*PSTR*/("Adding IO.SETMODE Initialization"));
	addNamespaceToList((NAMESPACE_LIST *)get_bcsIoSetmodeNamespace());
	//println_I(/*PSTR*/("Adding Internal Initialization"));
	addNamespaceToList((NAMESPACE_LIST *)get_internalNamespace());
	setNoAsyncMode(true);
	setIgnoreAddressing(true);
	//SetPinTris(0,OUTPUT);
	//SetDIO(0,OFF);

#if defined(USE_AS_LIBRARY)
	InitializeUserCode();
#endif
	EndCritical();
	println_I(/*PSTR*/("Starting Core"));
//	setMode(22,IS_DO);
//	setMode(23,IS_DI);
//	println_I(/*PSTR*/("Pin done"));
}
void InitPins(void){
	//println_I(/*PSTR*/("Starting Pin Functions"));
	InitPinFunction();
	//println_I(/*PSTR*/("Starting Pin Modes"));
	InitPinModes();
	int i=0;
	//println_I(/*PSTR*/("Starting hardware modes"));
	for(i=0;i<GetNumberOfIOChannels();i++){
		initPinState(i);
		configAdvancedAsyncNotEqual(i,10);
		setAsyncLocal(i,TRUE);
	}
	//println_I(/*PSTR*/("DONE pin initialization"));
}