Exemplo n.º 1
0
/*!
 * Init board.
 */
void BoardInit(void)
{
    /* Initialise ports. */
    PortInit();
    /* Initialise system clock. */
    SystemClkInit();
    /* Initialise SPI1. */
    Spi1Init();
    /* Initialise Timer0. */
    Timer0Init();
    /* Initialise Timer3. */
    Timer3Init();
    /* Initialise interrupts. */
    InterruptInit();
    /* Initialise the LCD. */
    LcdInit();
    /* Clear LCD. */
    LcdClearDisplay();
    /* Initialise LEDs. */
    LEDInit();
  #ifdef RTC_ENABLED
    /* RTC init. */
    RTC_Init();
  #endif //RTC_ENABLED
  #ifdef UART0_ENABLED
    /* UART0 init. */
    Uart0Init();
  #endif //UART0_ENABLED
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
	char buffer[80];
	size_t len;
	LcdInit();
	LcdClean();
	LcdPrintf(1, ":)");
	LcdPrintf(1, ":)");
	while (PTEMP_FAILURE_RETRY(fgets(buffer, sizeof buffer, stdin)))
	{
		printf("%s", buffer);
		LcdPrintf(1, "%s", buffer);
	}
	sleep(7);
	LcdPrintf(1, "-----");
	printf("-----");
	
#if 0
	if (argc == 1)
		argv[1] = "ls /";
	run(argv[1]);
#endif
	LcdExit();
	return 0;
}
Exemplo n.º 3
0
/*************************************************************************
* STARTUP TASK - Prints out checksum and waits for c press. When C is pressed,
* starts LCD and Demo Task, then deletes itself
* Functions included: CalcChkSum, LcdDispStrg, DisplayCheckSum
* Creates: LCDDemoTask and DemoCntrlTask
*************************************************************************/
static void StartTask(void *p_arg) 
{    
    (void)p_arg;                          /* Avoid compiler warning     */
    OSTickInit();
   	TimeInit();
                          /* Initialize uC/OS-II              */
    KeyInit();
    //LcdInit();
     
     LcdInit(TRUE,TRUE,FALSE);
     
    DBUG_PORT |= PP7;
    
    //LcdClrDisp();	
    //LcdMoveCursor(1,5);
    
     
    (void)OSTaskCreate(UITask,         /* Create UITask   */
                (void *)0,
                (void *)&UITaskStk[UITASK_STK_SIZE],
                UITASK_PRIO);
    (void)OSTaskCreate(TimeDispTask,         /* Create TimeDispTask  */
                (void *)0,
                (void *)&TimeDispTaskStk[TIMEDISPTASK_STK_SIZE],
                TIMEDISPTASK_PRIO);
     //LcdDispChar(1,1,CLOCK_LAYER,'2');
    DBUG_PORT &= ~PP7;
    (void)OSTaskDel(STARTTASK_PRIO);
    FOREVER()
    {
      //do nothing
    }
}
Exemplo n.º 4
0
/*************************************************************************
* STARTUP TASK - Prints out checksum and waits for c press. When C is pressed,
* starts LCD and Demo Task, then deletes itself
* Functions included: CalcChkSum, LcdDispStrg, DisplayCheckSum
* Creates: LCDDemoTask and DemoCntrlTask
*************************************************************************/
static void StartTask(void *p_arg) 
{    
    (void)p_arg;                          /* Avoid compiler warning     */
    OSTickInit();
   	    
    DBUG_PORT |= PP7;
           
    KeyInit();     
    TimeInit();                          
    LcdInit(TRUE,TRUE,FALSE);
    SetTheTime();//for reset purposes
    (void)OSTaskCreate(UITask,         /* Create UITask   */
                (void *)0,
                (void *)&UITaskStk[UITASK_STK_SIZE],
                UITASK_PRIO);
    (void)OSTaskCreate(TimeDispTask,         /* Create TimeDispTask  */
                (void *)0,
                (void *)&TimeDispTaskStk[TIMEDISPTASK_STK_SIZE],
                TIMEDISPTASK_PRIO);
    (void)OSTaskCreate(TransmitTask,         /* Create UITask   */
                (void *)0,
                (void *)&TransmitTaskStk[TRANSMITTASK_STK_SIZE],
                TRANSMIT_PRIO);
    (void)OSTaskCreate(ReceiveTask,         /* Create UITask   */
                (void *)0,
                (void *)&ReceiveTaskStk[RECEIVETASK_STK_SIZE],
               RECEIVE_PRIO);
         
    DBUG_PORT &= ~PP7;
    (void)OSTaskDel(STARTTASK_PRIO);
    
    FOREVER()
    {
    }
}
Exemplo n.º 5
0
void setup() {
  Serial.begin(9600);
  Serial.println("$CLS#Setup()");
  pinMode(RED, OUTPUT);
  pinMode(GREEN, OUTPUT);
  pinMode(BLUE, OUTPUT);
  LcdInit();

  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    PulseLed(RED, 2, 10, 10);
    PulseLed(BLUE, 2, 10, 10);
    PulseLed(GREEN, 2, 10, 10);

    Serial.print(".");
    LcdPrint(".");
  }
  Udp.begin(localPort);
  setSyncInterval(300);
  setSyncProvider(getNtpTime);

  // Turn on the backlight.
  LcdClear();
  LcdnoBacklight();
  delay(2000);
  LcdBacklight();
}
Exemplo n.º 6
0
/** 
 * @brief Sets up the hardware.
 * 
 * - Starts the clock at 48MHz with the PLL
 * - Starts the MAM (Memory accelerator module) for faster reads and writes
 * - Initialize the LED outputs
 * - Initialize the PWM outputs
 * - Initialize the ADC inputs
 * - Initialize the LCD outputs
 * - Start the ROS and Debug serial ports
 */
static void prvSetupHardware( void )
{
	#ifdef RUN_FROM_RAM
		/* Remap the interrupt vectors to RAM if we are are running from RAM. */
		SCB_MEMMAP = 2;
	#endif
	
	/* Disable the PLL. */
	PLLCON = 0;
	PLLFEED = mainPLL_FEED_BYTE1;
	PLLFEED = mainPLL_FEED_BYTE2;
	
	/* Configure clock source. */
	SCS |= mainOSC_ENABLE;
	while( !( SCS & mainOSC_STAT ) );
	CLKSRCSEL = mainOSC_SELECT; 
	
	/* Setup the PLL to multiply the XTAL input by 4. */
	PLLCFG = ( mainPLL_MUL | mainPLL_DIV );
	PLLFEED = mainPLL_FEED_BYTE1;
	PLLFEED = mainPLL_FEED_BYTE2;

	/* Turn on and wait for the PLL to lock... */
	PLLCON = mainPLL_ENABLE;
	PLLFEED = mainPLL_FEED_BYTE1;
	PLLFEED = mainPLL_FEED_BYTE2;
	CCLKCFG = mainCPU_CLK_DIV;	
	while( !( PLLSTAT & mainPLL_LOCK ) );
	
	/* Connecting the clock. */
	PLLCON = mainPLL_CONNECT;
	PLLFEED = mainPLL_FEED_BYTE1;
	PLLFEED = mainPLL_FEED_BYTE2;
	while( !( PLLSTAT & mainPLL_CONNECTED ) ); 
	
	/* 
	This code is commented out as the MAM does not work on the original revision
	LPC2368 chips.  If using Rev B chips then you can increase the speed though
	the use of the MAM.
	
	Setup and turn on the MAM.  Three cycle access is used due to the fast
	PLL used.  It is possible faster overall performance could be obtained by
	tuning the MAM and PLL settings.
	*/
	MAMCR = 0;
	MAMTIM = mainMAM_TIM_3;
	MAMCR = mainMAM_MODE_FULL;
	
	/* Setup the led's on the MCB2300 board */
	vParTestInitialise();
	PWMInit();
	ADCInit();
	LcdInit();
	IOInit();
	rosPortHandle = xSerialPortInit( serCOM1, ser57600, serNO_PARITY, serBITS_8,
	                                  serSTOP_1, 1000 );
	//debugPortHandle = xSerialPortInit( serCOM2, ser57600, serNO_PARITY, serBITS_8,
	//                                  serSTOP_1, 250 );
}
Exemplo n.º 7
0
int main(void)
{
  RCC->CFGR |= (RCC_CFGR_HPRE_1|RCC_CFGR_HPRE_3); /* div 8 */
  LcdInit();
  LcdClear();
  LcdChr ( Y_POSITION*1+X_POSITION*1+13, "Hello world" );
  LcdChr ( Y_POSITION*2+X_POSITION*1+13+INVERSE+X_OFFSET*3, "Hello world" );
  LcdChr ( Y_POSITION*4+X_POSITION*0+2+BIG_UP, "15" );  
  LcdChr ( Y_POSITION*5+X_POSITION*0+2+BIG_DOWN, "15" );  
  return 0;
}
Exemplo n.º 8
0
/* Configure the pins on the ATmega328p */
void InitDevice() {
    /* Disable all possible devices on the board */
    power_all_disable();

    /* LCD setup */
    /* All PORTB pins are data pins for the LCD screen */
    DDRB = (uint8_t)(-1);

    /* PDO, PD1, and PD3 are all used as control pins for the LCD screen.
     * PD0 is used as the R/S pin, which determines whether the LCD is getting a
     * command or a character
     * PD1 is the Enable pin, which signals the LCD to read the data pins
     * PD3 is the R/W Pin which is used to activate the Busy flag on the LCD and
     * is used for timing
     */
    DDRD |= (_BV(PD0) | _BV(PD1) | _BV(PD3));

    LcdInit();

    /* Display title screen */
    LcdWriteString(TITLE, LCD_LINE_ONE);
    LcdWriteString(NAME, LCD_LINE_TWO);
    _delay_ms(STARTUP_DELAY);

    LcdWriteString(BOOTUP, LCD_LINE_TWO);

    /* Calibration circuit */
    /* PD4 is used to determine if the calibration circuit is active or not */
    DDRD &= ~_BV(PD4); /* Configure PD4 as an input */
    PORTD |= _BV(PD4); /* Pullup PD4 */

    /* Configure the ADC */
    //Currently not implemented
    //power_adc_enable();

    /* Magnetometer set up */
    /* INT0 is attached to the DataReady pin on the magnometer, and will be used
     * to signal that data is ready to be read (obviously).  INT0 is set to go
     * off on a rising edge.
     */
    EIMSK |= _BV(INT0);
    EICRA |= _BV(ISC01) | _BV(ISC00);

    /* Configure TWI */
    power_twi_enable();
    TWCR = _BV(TWEN); /* Enable TWI */ //May not be needed here, but definitely elsewhere
    //Check to see if the magnetometer needs initialization from the ATmega
    //will need init
    //Display "Waiting on data" on line 2
}
Exemplo n.º 9
0
void DispInit(void)
{	
	LcdInit();
	LCD_OFF();
	GUI_Init();	
  GUI_SetBkColor(GUI_BLACK);
  GUI_Clear();
	GUI_SetDrawMode(GUI_DRAWMODE_NORMAL);
	GUI_DrawBitmap(&bm_yanghe_logo,0,0);
	LCD_ON();
	Delay_Ms(2000);
	GUI_SetFont(&GUI_NOW_FONT);
	Display_Welcome();
}
Exemplo n.º 10
0
void main(void) {
    
    OCDlyInit();
    ENABLE_INT();         /* Enable interrupts to use OCDelay()   */
    KeyInit();
    LcdInit();
    LcdClrDisp();	
    LcdMoveCursor(1,1);
    
    FOREVER(){
        WaitForSlice();
        KeyTask();
        DispKeyTask();
    }
}
Exemplo n.º 11
0
void SysInit(void)
{
    WDTCTL = WDTPW | WDTHOLD;	  // Stop watchdog timer
	Board_init();                 // Basic GPIO initialization
	SetVCore(3);                  // Set Vcore to accomodate for max. allowed system speed
	LFXT_Start(XT1DRIVE_0);       // Use 32.768kHz XTAL as reference, ACLK: SELA = 000, DIVA = 000
	Init_FLL_Settle(25000, 762);  // Set system clock to max (25MHz)

    LcdInit();
    LcdClear();
    //display_rect();
    AD9954Init();

    P4SEL = 0x00;
    P4DIR = 0x00;
    P4REN = 0xff;
}
Exemplo n.º 12
0
int main(void)
{
  /* Watchdog timer disabled */
  WDTCTL = WDTPW + WDTHOLD;
  
  BspInit();
  DioInit();
  TimerInit(10);                         // 0.1ms tick, 1 timed task, 0 loop task
  WRITE_SR(GIE);       // Enable global interrupts
  __eint();
  LcdInit();

  BspReset();         // if ever we get here, we have nothing better to do but reset the micro
  while(1)
  {
  }
}
Exemplo n.º 13
0
int main(void)
{
	/* Clock Config */
	RCC_Configuration();
	/* Configure the GPIO ports */
	//GPIO_Configuration_Main();
	/* Interrupt Config */
	NVIC_Configuration();
	///////////////// SDCARD Initialisation ////
//	SDCard_Configuration();
//	res = f_open(&fsrc, "a.txt", FA_OPEN_ALWAYS | FA_WRITE |FA_READ);
//	if(res==FR_OK)
//		printf("File opened successfully.\n\r");
//	else 
//	{
//		printf("File open error.\n\r");
//		return 1;
//	}
//	printf("****************File Start***************\n\r");
//	while(f_read(&fsrc, fileBuff, buffsize,&br)==FR_OK)
//	{
//		printf("\n\r%s\n\r",fileBuff);
//		if(br!=buffsize)
//			break;
//	}
//	printf("****************File End*****************\n\r");
//	if(f_close(&fsrc)==FR_OK)
//		printf("\n\rFile closed.\n\r");
	LcdInit();
	while(1)
	{	
		LcdWriteDC(COMMAND , 0x0c );	/*标准显示模式*/
		//	LcdDrawBitmap(0, 0, (uint8_t *)logo, 80, 6);  //画一个接近全屏的位图
		LcdPutString(0, 0, "Nokia 5110 LCD");  //在位图的左上方覆盖英文字符
		LcdPutString(0, 1, "--0123456789--");  //在位图的左上方覆盖英文字符
		LcdPutString(0, 2, "--9876543210--");  //在位图的左上方覆盖英文字符
		LcdPutString(0, 3, "--0123456789--");  //在位图的左上方覆盖英文字符
		LcdPutString(0, 4, "--9876543210--");
		LcdPutString(0, 5, "--0123456789--");
		Delaynus(1000000);
		
		LcdWriteDC(COMMAND , 0x0d);   /*反显*/
		Delaynus(1000000);
	}
}
Exemplo n.º 14
0
/**************************************************************************************************
  Title:
    LCD test

  Version:
    0.11

  Filename:
    lcdtest-0.11.c

  Author(s):
    mkobit
    ahong

  Purpose of Program:
    Test basic initialization and displaying of data with the LCD on the PCB

  How to build:
    delay.c
    lcd_16x2.c - delay.c

  Update History:


**************************************************/
int main(void)
{
    int pbFreq;

    pbFreq = SYSTEMConfigPerformance(SYSTEM_FREQUENCY);
    DelayInit(SYSTEM_FREQUENCY);
    DelayMs(1000);  // simple delay to get ready for program
    LcdInit(lcd_pairs[0].bitnum, lcd_pairs[0].port_id,
            lcd_pairs[1].bitnum, lcd_pairs[1].port_id,
            lcd_pairs[2].bitnum, lcd_pairs[2].port_id,
            lcd_pairs[3].bitnum, lcd_pairs[3].port_id,
            lcd_pairs[4].bitnum, lcd_pairs[4].port_id,
            lcd_pairs[5].bitnum, lcd_pairs[5].port_id,
            lcd_pairs[6].bitnum, lcd_pairs[6].port_id,
            lcd_pairs[7].bitnum, lcd_pairs[7].port_id,
            lcd_pairs[8].bitnum, lcd_pairs[8].port_id,
            lcd_pairs[9].bitnum, lcd_pairs[9].port_id,
            lcd_pairs[10].bitnum, lcd_pairs[10].port_id,
            LCD_DOTS_5x8);   // Using a wide selection of pins in lab with these ports connected
    // this test will just test writing to the LCD
    LcdInstrSetDisplayMode(LCD_DISPLAY_ON, LCD_CURSOR_OFF, LCD_CURSOR_BLINK_OFF);

    while(1) {
        LcdInstrReturnHome();
        LcdDisplayData("Hello\nThere!");

        DelayMs(5000);
        LcdInstrClearDisplay();
        DelayS(5);
        LcdDisplayData("Just cleared it.\nYou see that?");
        DelayS(5);
        LcdInstrClearDisplay();
        LcdDisplayData("Cleared it again but now to test a long string to check lines");
        DelayS(5);
        LcdInstrClearDisplay();
        LcdDisplayData("Return H");
        LcdInstrSetDDRAMAddress(14);
        LcdDisplayData("END!");
        DelayS(5);
    }

    return 0;
}
Exemplo n.º 15
0
int main()
{

        LcdInit();	//initialize  LCD
        LcdContrast(0x7F);	 //display image
        _delay_ms(1000);
        LcdClear();
       
        LcdContrast(0x3F);	//adjust contrast
        _delay_ms(1000);
        LcdClear();
        
        LcdImage(waitImage);	//wait image
        LcdUpdate();
        _delay_ms(4000);
		
		ADCSRA |= (1<<ADEN)|(1<<ADPS0)|(1<<ADPS1)|(1<<ADPS2);   //enable ADC and select clk/128
		ADMUX |= (1<<REFS0)|(1<<ADLAR);							//Vref, ADC0 as input
		DDRC = 0x00;
		
		uint16_t temp, temp1, temp2, temp3;

        while (1)
        {
				ADCSRA |= (1<<ADSC);	//begin conversion
				while(!(ADCSRA &(1<<ADSC))==0);		//wait for end of conversion
				temp=(ADCH<<8)|ADCL;
				//calculation for temperature
                temp1 = temp%10;
                temp2 = temp%100/10;
                temp3 = temp%1000/100;
                char digit[4];
                sprintf(digit, "%d%d.%d ", temp1, temp2, temp3); //display temperature
                LcdClear();
                LcdGotoXYFont(1,1);
                LcdFStr(FONT_1X,(unsigned char*)digit);
                LcdGotoXYFont(1,2);
                LcdFStr(FONT_1X,(unsigned char*)PSTR ("Fahrenheit"));
                LcdUpdate();
                _delay_ms(1000);
        }
        return 0;
}
Exemplo n.º 16
0
/*******************************************************************************
* 函 数 名: main
* 函数功能: 主函数
* 输    入: 无
* 输    出: 无
*******************************************************************************/
void main()
{
	DULA = 1;
	P0 = 0xff;
	DULA = 0;
	WELA = 1;
	P0 = 0xff;
	WELA = 0;
	
	LcdInit();
	CLeanFullScreen(0xff,0xff);//清屏
	
	while (1)
	{
		ShowString(20,100,"欢迎使用航太电子单片机",BLUE,WHITE);
		ShowString(20,150,"Welcome To 51MCU World!",RED,WHITE);
//		ShowString(20,100,"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ",BLACK,WHITE);//显示所有字符
//		ShowString(20,200,"kdfgdsklbgd航太电子skdncs航太电子",BLACK,WHITE);
		while(1);
	}
}
Exemplo n.º 17
0
/*******************************************************************************
* 函 数 名: main
* 函数功能: 主函数
* 输    入: 无
* 输    出: 无
*******************************************************************************/
void main()
{
	//彩屏实验时最好关闭数码管的锁存器,避免数码管乱闪
	DULA = 1;
	P0 = 0xff;
	DULA = 0;
	WELA = 1;
	P0 = 0xff;
	WELA = 0;
	
	LcdInit();
	
	CLeanFullScreen(0xff,0xff);//清屏
	
	ShowString(0,0,"LCD init OK",RED,WHITE);
	
	if(!SdInit())
	{
		ShowString(0,20,"SD Init Fail",RED,WHITE);
		while(1);
	}
	
	if(!SdReadBlock(DATA,TXTADD,512))
	{
		ShowString(0,20,"SD Read Fail",RED,WHITE);
		while(1);
	}
	
	ShowString(0,20,DATA,RED,WHITE);//显示TXT文本内容
	Delayms(1000);
	while (1)
	{
		ShowFullSDPic(PIC1ADD);
		Delayms(2000);
		ShowFullSDPic(PIC2ADD);
		Delayms(2000);
		

	}
}
Exemplo n.º 18
0
void Init_SmartNavi()
{

	HardwareSetup();
	R_TMR_CreateOneShot(PDL_TMR_UNIT0,PDL_TMR_OUTPUT_OFF,1,tick_flag,4);
    R_INTC_CreateExtInterrupt(PDL_INTC_IRQ5,PDL_INTC_LOW ,Pen_flag,1); 		
		
	
	//	sendtoRTC();
	    Init_ADS7843();
		#ifdef GpsOn
	    getPos();
		#endif
		tone(1);
    	font_index();
    	font_index1();
    	LcdInit();
		LcdClear();
	    Gsm_State();		//initialize variable
		Init_Sim900();

}
Exemplo n.º 19
0
int main(void)
{
	delay_init();
	Set_System();

	LcdInit();
	VBatInit();
	USB_Config();

	DacInit();
	AdcInit();

	MCPInit();
	QuadEncInit();

	LcdHello();

	ClearCorrector();
	while (1)
	{
		AdcQuant();
	}
}
Exemplo n.º 20
0
int main(void)
{

/*~~~~~~~~~~~~~~~~*/

/*
 */

    DDRB = 0xFF;
    PORTB = 0xFF;
    DDRA = 0xFF;
    PORTA =0xFF;

    InitSpi();
    LcdInit();
    _delay_ms(1000);


    while(1)
    ;

    return 0;

}
Exemplo n.º 21
0
// Display initilization
// Indicate whether the system in "STAND-BY" state or not.
VOID DispInit(BOOL IsStandBy)
{
	//DBG((">>DispInit(%bd)\n", IsStandBy));
	TimeOutSet(&DispTmr, 0);
#ifdef FUNC_NUMBER_KEY_EN
	TimeOutSet(&NumKeyErrDispTimer, 0);
#endif
	gDispPrevRep = gPlayCtrl.RepeatMode;
	gDispPrevEQ = gPlayCtrl.Eq;
	gDispPrevPlayState = gPlayCtrl.State;
#ifdef FUNC_PT231X_EN
       gDispPrevVol = VolMain; 
       gDispPrevTreb = VolTreb;
	gDispPrevBass = VolBass;
#else
	gDispPrevVol = gSys.Volume;
#endif
	gBlink.BlinkFlag = 0;
	gDispState = DISP_STATE_DEV;
	memset(&gDispBuff, 0, sizeof(gDispBuff));	

#ifdef FUNC_SINGLE_LED_EN
	SLedInit();
	SLedLightOp(LED_POWER, LIGHTON);	
#endif

#ifdef FUNC_SEG_LED_EN
#if (defined(FUNC_7PIN_SEG_LED_EN) || defined(FUNC_6PIN_SEG_LED_EN))
	LedPinGpioInit();
//	SetA2IcsReg(A2_ICS_FOR_GPIO, A2_ICS_CLOSE); 
#else
	ClrGpioRegBit(LED_SEG_PORT_PU, MASK_LED_SEG);	// Pull-Up.
	ClrGpioRegBit(LED_SEG_PORT_PD, MASK_LED_SEG);	// Pull-Up.
	ClrGpioRegBit(LED_SEG_PORT_IE, MASK_LED_SEG);	// Input Disable.
	ClrGpioRegBit(LED_SEG_PORT_OE, MASK_LED_SEG);	// Output Disable.
	//ClrGpioRegBit(LED_SEG_PORT_OUT, MASK_LED_SEG);
	SetGpioRegBit(LED_COM_PORT_PU, MASK_LED_COM);	// Pull-Up.
	SetGpioRegBit(LED_COM_PORT_PD, MASK_LED_COM);	// Pull-Up.
	ClrGpioRegBit(LED_COM_PORT_IE, MASK_LED_COM);	// Input Disable.
	SetGpioRegBit(LED_COM_PORT_OE, MASK_LED_COM);	// Output Enable.
#endif
#endif

#ifdef FUNC_SEG_LCD_EN
	//SetGpioRegBit(GPIO_TYPE_REG, MSK_ADC_A1_SWITCH);		//ADC Vol  preq
//	LcdInit(MASK_LCD_SEG, MASK_LCD_COM, LCD_BIAS_2);
//	LcdInit(MASK_LCD_SEG, MASK_LCD_COM, LCD_BIAS_3);
	LcdInit(MASK_LCD_SEG, MASK_LCD_COM, LCD_BIAS_4);
	DBG(("LcdInit(LCD初始化%x,%x,)\n", MASK_LCD_SEG, MASK_LCD_COM));
#endif

#ifdef FUNC_SEG_LED_EN
	gLedDispRefreshFlag = TRUE;
#endif

#if (defined(FUNC_SEG_LED_EN) || defined(FUNC_SEG_LCD_EN))
	if(IsStandBy == TRUE)
	{
		//DBG(("CLS\n"));
		ClearScreen();
	}
	else
	{
		if((gDisplayMode == DISP_DEV_NONE) && (gDisplayMode == DISP_DEV_SLED))
		{
			gDispState = DISP_STATE_IDLE;
		}
		else
		{
			//DBG(("DispLoad()\n"));
			DispPowerOn();
			TimeOutSet(&DispTmr, NORMAL_INTERVAL);
			DispDev();
		}
	}
#ifdef FUNC_SEG_LCD_EN
	if(gDisplayMode == DISP_DEV_LCD58)
	{
		TimeOutSet(&gAmplitudeTmr, 0);
		LcdFlushDispData();
	}	
#endif



#endif	
#if defined(FUNC_SINGLE_LED_EN )
	gDisplayMode = DISP_DEV_SLED;
#elif defined(FUNC_SEG_LCD_EN)
	gDisplayMode = DISP_DEV_LCD58;
#else
	//gDisplayMode = DISP_DEV_LED1888;
	//gDisplayMode = DISP_DEV_LED8888;
	gDisplayMode = DISP_DEV_LED57;
#endif
}
Exemplo n.º 22
0
int main(void)

{
	uint16_t CalcCRC16(uint8_t data_array[], int data_lenght);
	 
	 int i;
	 /////////////////////OSCYLATOR 32MHZ///////////////////////////////////////////
	init_osc32();
	 ////KONFIGURACJA ADC////////////////////////////////////////////////////////////////
	 konfiguracja_adc();
	 /////////UART////////////////////////////////////////////////////////////////////////
	 PORTC_OUTSET = PIN7_bm; //Let's make PC7 as TX
	 PORTC_DIRSET = PIN7_bm; //TX pin as output
	  
	 PORTC_OUTCLR = PIN6_bm;
	 PORTC_DIRCLR = PIN6_bm; //PC6 as RX
	 setUpSerial();
	///////////////////////////////////////////////////////////////////////////////
	PORTF_DIR=PIN0_bm;
	//PORTF_OUTSET=PIN0_bm;  //zapalenie diody 
	PORTC.DIRSET	=	PIN0_bm;		// pin C0  jako wyjœcie
	PORTC.DIRSET	=	PIN1_bm;		// pin C0  jako wyjœcie
	////////////////////////Flip//////////////////////////////////////////////// 
	PORTE.DIRCLR	=	PIN5_bm;				// pin E5 jako wejœcie
	PORTE.PIN5CTRL	=	PORT_OPC_PULLUP_gc;		// podci¹gniêcie do zasilania
	////////////////////////////Klawisze gora do³ prawo lewo//////////////////////////////////////////
	PORTF.DIRCLR	=	PIN1_bm|PIN2_bm|PIN5_bm|PIN6_bm;
	PORTF.PIN1CTRL	=	PORT_OPC_PULLUP_gc|PORT_ISC_FALLING_gc;	
	PORTF.PIN2CTRL	=	PORT_OPC_PULLUP_gc;	
	PORTF.PIN5CTRL	=	PORT_OPC_PULLUP_gc;	
	PORTF.PIN6CTRL	=	PORT_OPC_PULLUP_gc;
	///////////////////////////////////Przerwanie INT0/////////////////////////////////////////////////////
	init_int0();
	//////////////////////////TIMER0//////////////////////////////////////////////////////
	timer();
	//////////////////////W£¥CZENIE PRZERWAÑ//////////////////////////////////////////
	sei();								// globalne w³¹czenie przerwañ
	////////////////////////////////////////////////////////////////////////////////////////
	LcdInit();									// inicjalizacja sterownika LCD
	LcdGoto(0,0);
	Lcd("*Inzynierka_DiagBoX*");					// wyœwietlenie napisu
	LcdGoto(20,0);
	Lcd("Przedstawia:");
	LcdGoto(25,1);
	Lcd("Marek Wudarczyk");
   _delay_ms(1000);
    LcdClear();
	
           while (1){   
			   LcdClear();
			   LcdGoto(0,0);
	           LcdDec(ADC);
			   LcdGoto(5,0);
			   Lcd("CNT = ");
			   LcdDec(TCC0.CNT);
			   LcdGoto(0,1);
			   LcdDec(TCC0.PER);
			   LcdGoto(20,1);
			   Lcd("czas:");
			   LcdDec(c);
			   
			  i=usart_getc();
				if(i==2){
					while(1){
							uint8_t i,j=0;			
							i=usart_getc();
							uint16_t ADC = ADC_GetResults();
							uint8_t buff[] = {mlody_bajt(ADC),stary_bajt(ADC)};
							buff[2] = mlody_bajt(CalcCRC16(buff,2));
							buff[3] = stary_bajt(CalcCRC16(buff,2));
								while(j<4){
									sendChar(buff[j]);
									j++;
								}
								
								 LcdClear();
								Lcd("CRC:");
								LcdDec(buff[2]);
							    _delay_ms(10);
								 if(i == 2){
									break;
			 }
					}
						i=0;
				}
			if(i==1){
					PORTF_OUTTGL=PIN0_bm;  
					i=0;
			}
			if(!(PORTE.IN & PIN5_bm)) /* je¿eli przycisk FLIP jest wciœniêty*/ {
				while(1){  
						uint32_t licz;
						licz++;
						if((licz>15100)&&(PORTE.IN & PIN5_bm)){
							licz=0;
						
							c+=10;
							break;
						}
			
				}	 
			 }

		_delay_ms(100);

       
	}
			}
Exemplo n.º 23
0
int main(void) {
  MainInit();
  I2C1init();
  RtcInit();
  LcdInit();
  DataLogInit();
  StringInit();
  Mct485Init();
  FieldInit();
  Ads1115Init();
  Ads1244Init();
  USBInit();
  RtuInit();
  AdcInit();
  TC74Init();

  // enable multi-vector interrupts
  INTEnableSystemMultiVectoredInt();

  MainDelay(50);
  DataLogDateTime(DLOG_SFC_POWERUP);

  // init param after interrupts are enabled 
  ParamInit();
  // wait to init desiccant until after ParamInit
  DesiccantInit();

  string[0].mct[0].chan[4] = 0x7FFF;



	// 
	// Begin Main Loop
	//
  for (;;) {
    if (test == 1) {
      test = 0;
      FieldNewState((FIELD_STATE_m)t1);
    }
    
    USBUpdate(); // called as often as possible
    
    //sysTickEvent every ms
    if (sysTickEvent) {
      sysTickEvent = 0;
      sysTicks++;

      UsbTimeoutUpdate();

      LcdUpdate();
      
      // fill time before dropping LCD_E
      if (sysTicks >= 1000) {
        sysSec++;
        sysTicks = 0;
        
        mPORTDToggleBits(PD_LED_HEARTBEAT);
        
        // These Updates are 
        // called once a second
        //TODO if any of these are long, we could split them on separate milliseconds.
        DesiccantUpdate();
        AdcUpdate();
        TC74Update();
        
      }// end 1 Hz
      
      else if (sysTicks == 250) {
        mPORTDToggleBits(PD_LED_HEARTBEAT);
      }
      else if (sysTicks == 500) {
        mPORTDToggleBits(PD_LED_HEARTBEAT);
      }
      else if (sysTicks == 750) {
        mPORTDToggleBits(PD_LED_HEARTBEAT);
      }
      // Complete LcdUpdate() by dropping LCD_E)
      PORTClearBits(IOPORT_G, PG_LCD_E);

      // These Updates called once each millisecond
      RtcUpdate();
      I2C1update();
      StringUpdate();
      Mct485Update();
      FieldUpdate();
      RtuUpdate();
      DessicantFanPWMupdate();
      
    } // if (sysTickEvent)
  } // for (;;)
} // main()
Exemplo n.º 24
0
int ModeHandler(int mode, char *textIn, int argc, char **argv)
{
	LcdSpi *lcd;
	Spi *spiBus0;
	ScreenData *screenBg;
	int result = 0;
	Fonts font;
	iconv_t ic;
	size_t res;
	char text[MAX_ISO8859_LEN] = "";
	
	memset(&font, 0, sizeof(Fonts));
	spiBus0 = SpiCreate(0);
	if (spiBus0 == NULL) {
		printf("SPI-Error\n");
		exit(EXITCODE_ERROR);
	}
	lcd = LcdOpen(spiBus0);
	if (!lcd) {
		printf("LCD-Error\n");
		exit(EXITCODE_ERROR);
	}
	if (gConfig.mIsInit == 1) {
		LcdInit(lcd);
	} else if (gConfig.mIsInit == 2) {
		LcdUninit(lcd);
		exit(EXITCODE_OK);
	}
	if (gConfig.mIsBgLight) {
		LcdSetBgLight(lcd, gConfig.mBgLight & 1, gConfig.mBgLight & 2, gConfig.mBgLight & 4);
	}
	screenBg = ScreenInit(LCD_X, LCD_Y);
	if (!screenBg) {
		printf("Screen-Error\n");
		exit(EXITCODE_ERROR);
	}
	ScreenClear(screenBg);
	if (gConfig.mBgFilename) {
		if (ScreenLoadImage(screenBg, gConfig.mBgFilename, gConfig.mBgOffX, gConfig.mBgOffY) != 0) {
			ScreenClear(screenBg);
		}
	}
	
	if (textIn) {
		int testInLen = strlen(textIn);
		char **inPtr = &textIn;
		char *outPtr = &text[0];
		
		ic = iconv_open("ISO-8859-1", "UTF-8");
		if (ic != (iconv_t)(-1)) {
			size_t inBytesLeft = testInLen;
			size_t outBytesLeft = sizeof(text) - 1;
		   
			res = iconv(ic, inPtr, &inBytesLeft, &outPtr, &outBytesLeft);
			if ((int)res != -1 && outBytesLeft) {
				outPtr[0] = 0;
			} else {
				strncpy(text, textIn, sizeof(text) - 1);
				text[sizeof(text) - 1] = 0;
			}
			iconv_close(ic);
		}
	}
	
	//printf("Mode: %i\n", mode);
	switch (mode) {
	case OPT_YESNO:
		LoadFonts(&font);
		result = YesNo(lcd, &font, text, screenBg);
		break;
	case OPT_OK:
		LoadFonts(&font);
		result = Ok(lcd, &font, text, screenBg);
		break;
	case OPT_MENU:
		LoadFonts(&font);
		result = Menu(lcd, &font, screenBg, optind, argc, argv);
		break;
	case OPT_IPV4:
		LoadFonts(&font);
		result = Ipv4(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	case OPT_SUBNETMASK:
		LoadFonts(&font);
		result = Subnetmask(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	case OPT_INFO:
		LoadFonts(&font);
		result = Info(lcd, &font, text, screenBg);
		break;
	case OPT_BUTTONWAIT:
		result = ButtonWait();
		break;
	case OPT_INTINPUT:
		LoadFonts(&font);
		result = IntInput(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	case OPT_PROGRESS:
		LoadFonts(&font);
		result = Progress(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	case OPT_PERCENT:
		LoadFonts(&font);
		result = Percent(lcd, &font, text, screenBg, optind, argc, argv);
		break;
	default:
		break;
	}
	
	if (font.mSystem) {
		//FontDestroy(font.mSystem);
	}
	if (font.mInternal) {
		//FontDestroy(font.mInternal);
	}

	if (gConfig.mIsClear) {
		LcdCls(lcd);
	}
	ScreenDestroy(screenBg);
	LcdCleanup(lcd);
	SpiDestroy(spiBus0);
	
	return result;
}
Exemplo n.º 25
0
/********************************************************************
函数功能:主函数。
入口参数:无。
返    回:无。
备    注:无。
********************************************************************/
void main(void)
{
#ifdef DEBUG0
 int i;
#endif

 int InterruptSource;
 
 SystemClockInit(); //系统时钟初始化
 LedInit();         //LED对应的管脚初始化
 LcdInit();         //LCD初始化
 AdcInit();         //ADC初始化
 Timer1Init();      //定时器1初始化,用来产生10ms的定时扫描信号
 KeyInit();         //键盘初始化
 Uart0Init();       //串口0初始化

#ifdef DEBUG0
 for(i=0;i<16;i++)   //显示头信息
 {
  Prints(HeadTable[i]);
 }
#endif

 UsbChipInit();  //初始化USB部分
 
 while(1)
 {
  InterruptSource=(*AT91C_UDP_ISR)&(0x0F|(1<<8)|(1<<12)); //取出需要的中断
  if(InterruptSource) //如果监视的中断发生
  {
   if(InterruptSource&(1<<8))
   {
    *AT91C_UDP_ICR=1<<8; //清除中断
    UsbBusSuspend(); //总线挂起中断处理
   }
   if(InterruptSource&(1<<12))
   {
    *AT91C_UDP_ICR=1<<12; //清除中断
    UsbBusReset();   //总线复位中断处理
   }
   if(InterruptSource&(1<<0))
   {
    if(AT91C_UDP_CSR[0]&((1<<1)|(1<<2)|(1<<6)))  //如果是SETUP包、缓冲未空等
    {
     UsbEp0Out();     //端点0输出中断处理
    }
    if(AT91C_UDP_CSR[0]&(1<<0)) //如果是端点0输入完成
    {
     UsbEp0In();     //端点0输入中断处理
    }
   }
   if(InterruptSource&(1<<1))
   {
    UsbEp1In();      //端点1输入中断处理
   }
   if(InterruptSource&(1<<2))
   {
    UsbEp2Out();     //端点2输出中断处理
   }
   if(InterruptSource&(1<<3))
   {
    UsbEp3In();     //端点3输入中断处理
   }
  }
  if(KeyUp||KeyDown)  //如果用户操作了按键
  {
   DispKey(); //在LCD上显示按键情况
   if(ConfigValue!=0) //如果已经设置为非0的配置,则可以返回报告数据
   {
    if(!Ep1InIsBusy)  //如果端点1输入没有处于忙状态,则可以发送数据
    {
     KeyCanChange=0;  //禁止按键扫描
     if(KeyUp||KeyDown) //如果有按键事件发生
     {
      SendReport();  //则返回报告
     }
     KeyCanChange=1;  //允许按键扫描
    }
   }
   //清除KeyUp和KeyDown
   KeyUp=0;
   KeyDown=0;
   LcdRefresh();  //刷新LCD显示
  }
 }
}
Exemplo n.º 26
0
int main(void)
{
    ///////////////////////////////////////////
    uint8_t Key;
    int i;
    ////////////////////////////////////////////////

    brightness = 0x40;//亮度
    contrast   = 0x70;//对比度
    saturation = 0x40;//饱和度
    memset(outbuf,0,64);


    SystemInit();
    //GPIOInit();

    //chumo改版加入
    //Touch_Initializtion();

    Init_NVIC();				//中断向量表注册函数 	
    Init_LED();					//LED初始化
    Init_KEY();					//按键初始化
    Init_IIC();					//24LC02初始化
    Init_TOUCH();				// 触摸屏配置
    //Touch_Initializtion();


    //////////

    UART3_Init(115200);
    PrintStr("=========12345========\r\n");

    //ADC_Init_Ex();
    //Tim3_ETR_Init();
    //Tim4_Init();
    //CAN1_Init(250);

    //	USB_Init();

    //	RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);

    /* Configure FSMC Bank1 NOR/SRAM3 */
    //FSMC_SRAM_Init();
    DelayMs(300);
    //InitSSD1963();
    //LcdInitTest();
    LcdInit();

    LcdClear(GRAY0);
    DispButton(button2);
    DisplayButtonUp(2,  2,400,25);   	
    LcdPrintStr("版权所有(C)mmmmmmmmmmmmmmmmmmmm",4,4,BLUE,GRAY0);
    DisplayButtonUp(402,2,478,25);
    LcdPrintf(410,4,BLACK,GRAY0,"%02d:%02d:%02d",12,12,12);
    DisplayButtonDownColor(200, 410, 290, 470, RED);
    DisplayButtonDownColor(412, 410, 502, 470, GREEN);
    LcdPrintStr("删除",230,432,WHITE,RED);
    LcdPrintStr("确认",442,432,BLACK,GREEN);
    LcdFillRec(200,100,502,190,DGREEN);
    DisplayButtonUp(190,90,512,475);
    DelayMs(1000);
    LcdFillRec(190,90,512,475,RED);
    DelayMs(1000);
    LcdFillRec(190,90,512,475,GRAY0);
    DispButton(button2);
    DisplayButtonDownColor(200, 410, 290, 470, RED);
    DisplayButtonDownColor(412, 410, 502, 470, GREEN);
    LcdPrintStr("删除",230,432,WHITE,RED);
    LcdPrintStr("确认",442,432,BLACK,GREEN);
    LcdFillRec(200,100,502,190,DGREEN);
    DisplayButtonUp(190,90,512,475);
    //	Pen_Point.Key_Sta==Key_Up;


    //LcdPrint16bitBmp(gImage, 16, 16, 490, 368 );
    while(1)
    {
        //	if(Pen_Point.Key_Sta==Key_Down)
        //	{
        //		LcdPrintf( 16,16,BLUE,WHITE,"%d",ADS_Read_AD(CMD_RDX));
        //		LcdPrintf( 16,32,BLUE,WHITE,"%d",ADS_Read_AD(CMD_RDY));
        //	}
        //LcdPrintf( 16,32,BLUE,WHITE,"%d",Touch_GetPhyY());
        //LcdPrintf( 16,16,BLUE,WHITE,"%d",Touch_GetPhyX());

        //	DelayMs(200);
        //	LED1 = ~LED1;


        //LED1=~LED1;
        //DelayMs(50);
        ////////////////////////////////////////
        Key=KEY_Scan();
        if(Pen_Point.Key_Sta==Key_Down)//触摸屏被按下
        {
            Pen_Int_Set(0);				//关闭中断
            do
            {
                LcdPrintf( 16,16,BLUE,WHITE,"%d",ADS_Read_AD(CMD_RDX));
                LcdPrintf( 16,32,BLUE,WHITE,"%d",ADS_Read_AD(CMD_RDY));

                Convert_Pos();
                Pen_Point.Key_Sta=Key_Up;
                //GPIOC->ODR|=1<<5;//临时添加
                //	LcdPrintf(16,16,BLUE,BLACK,"%d\n",Pen_Point.X);
                //	LcdPrintf(16,32,BLUE,BLACK,"%d\n",Pen_Point.Y);
                if(Pen_Point.X0>216&&Pen_Point.Y0<48)LcdClear(RED);//清除
                else 
                {
                    Draw_Big_Point(Pen_Point.X0,Pen_Point.Y0);//画图	    
                    GPIOC->ODR|=1<<5;    //PC5 上拉	   
                }  

            }while(PEN==0);//如果PEN一直有效,则一直执行
            Pen_Int_Set(1);//开启中断
        }
        else DelayMs(1);
        if(Key==USER)//USER按下,则执行校准程序
        {
            LcdClear(BlackColor);//清屏
            Touch_Adjust();  //屏幕校准 
            Save_Adjdata();	 
            LcdClear(RED);
        } 
        i++;  
        if(i==1)
        {
            i=0;
            LED1=~LED1;
        }
    }
    ///////////////////////////////////

    /*
       if(_SEC_)
       {
       _SEC_ = 0;

       GPIO_WriteBit(GPIOC, GPIO_Pin_6, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_6)));

       LcdPrintf(300,460,BLACK,GRAY0,"%03d",i);
    //i += 10;
    SetSensors();

    for(u8 i=1; i<=16; i++)
    Printf("No.%d=%d,",i,GetSensorVoltage(i));
    PrintStr("\r\n");
    }
    UART1_SendByte(0x55);
    DelayMs(1);	
    }				  */
}
Exemplo n.º 27
0
Arquivo: init.c Projeto: AEUG/400plus
void my_task_Startup() {
	DebugManager(1, 0x1F, 0x180000, 0x40000, 0x1C0000);

	dmstart();
	dmProcInit();

#ifdef ENABLE_MASSIVE_DEBUG
	// the 2nd level is 32 flags for debug classes
	// the 3rd arg is log level, 0 == full debug, >0 == less debug
	dmSetStoreLevel(hDbgMgr, 0xFF, 0);
	dmSetPrintLevel(hDbgMgr, 0xFF, 0);
#endif

	initialize();
	
	sub_FFAFE5BC();
	SetAssert();
	EventProcedureServiceInit();
	ShutDownProcInit();
	Install3VMemory(0xF8000000);
	RomManagerInit();
	CreateParamPubInstance();
	PropertyServiceInit();
	ErrorNumberListInit();
	FatalErrorsProcInit();
	RegisterISRs_OCH();
	BlockUntilAfterTimeoutProcInit(50);

	sub_FFB07740(0x10, 8, 0x1BBC);
	ResourceNameServiceInit();

	MemorySuite(0);

	sysClockRateSet_100(3);

	sub_FFB2BD6C();

	InitializeSerialIO();

	RtcInit(0x386D4380);

	AdjDefectsInit();

	CameraAdjsInit();

	SetAssertProc(AssertPrepare, 0);

	my_InitializeIntercom(); // InitializeIntercom();

	AfeGainCmosParamInit();

	EngineInit();

	EDmacPriorityManager();

	EngineResourceInit();

	PowerMgrInit(0);

	ClockInit(1);

	RegisterISR_CAPREADY();

	FaceSensorInit();

	RemDrvInit();
	ActSweepInit();

	LcdInit();

	DisplayInit1();

	DisplayInit2();

	PowerSaveProcInit();

	sub_FFA03B0C();

	sub_FFA05114();

	InitializeImagePlayDriver();

	LensNameTblInit();

	LensPOTblInit();

	FlyingInit();

	CaptureInit();

	BathtubSaturateInit();

	Module_CaptureImagePass();

	ClearSomeCapMem();

	ColorAdjustmentsInit();

	Module_PreDarkPassInit();

	LoadSystemInfo();

	SharedBufferInit(0x10800000, 0x18000000, 0xEE0000, 0xEE0000);

	FileCacheInit();
	PackMemInit();

	ImagePropInit();
	DigPropInit();

	ShootMainInit();

	OlcInfoInit();

	RegisterISR_EMERGENCY_CARDDOOR();

	my_MainCtrlInit();

	CaptureSemaphoreInit();

	VShadingInit();

	Module_CaptureDarkPassInit();

	Module_DarkSubtractionPassInit();
	BathtubInit();

	Module_BathtubCorrectPassInit();

	Module_VObIntegPassInit();

	SetProjectionInit();
	Module_DefectsDetectPassInit();

	DefsInit();
	WbDetectionInit();
	ObInit();

	Module_WbDetectionPassInit();
	DefsProcInit();

	Module_ObAreaCopyPassInit();
	Module_AdditionVTwoLinePassInit();

	VShadingProcInit();
	Module_VShadingCorrectPassInit();

	sub_FFA24838();
	HuffmanInit();

	RawToJpegPass_L_Init();
	RawToJpegPass_M2_Init();

	RawToJpegPass_S_Init();
	YcToJpegLargeFastInit();

	YcToJpegM2FastInit();
	YcToJpegSFastInit();

	RawToLosslessInit();
	Module_YcToTwainInit();

	RawToYcPass_S_Init();
	RawToYPackPass_S_Init();

	DvlpInit();
	DecodeJpegPassInit();
	HistPassInit();
	RectangleColorPassInit();
	RectangleCopyPassInit();

	ResizeYuvPassInit();
	sub_FFA35354();
	LpfPassInit();

	EncodeJpegPassInit();
	AdjRgbGainInit();
	LuckyInit();

	SysInfoProcInit();

	TablesInit();

	ColorInit();

	CtrlManRecursiveLock();

	CtrlSrvInit(0x19);

	LangConInit();
	sub_FF926E40();

	CreateDispSwControlPubInstance();

	CreateMemoryManagerPubInstance();

	my_GUIInit(); //GUIInit();
	GUIApiCalls();

	InitializeImagePlayer();

	ColorBarProcsInit();
	LcdAdjustProcsInit();

	sub_FFB29348();
	CMOSParamInit();

	CameraSettingsInit();
	BootDiskProcsInit();

	DDDInit();
	TFTInit();

	RegisterResourceName(hResourceName, "USR ROOT DEVICE HANDLE", 0x7B);

	RegisterResource_env(0xC02200B8, "U2VBUS");
	RegisterResource_env(1, "USBC20 VBUS SUPPORT");

	RegisterResource_env(0x14, "DEVICESPEED");
	USBC20_Init();
	USBC20_USBIF_Init();

	USBC20_BUFCON_Init();
	USBC20_CLK_Init();
	USBC20_HDMAC_Init();

	DCPClassFunctionsInit();
	USBDriverInit();
	RapiSwitcherInit();

	DCPClassInit();
	RAPITransportUSBInit();
	PTPRespondInit();

	PTPFrameworkInit();
	StartupPtpResponder();

	RapiTransportManagerInit();
	DCPClassInit();

	EventProcServerInit();
	sub_FFA5D8A0();
	DCPInit();

	SesnMngrInit();
	MemMngrInit();
	InitializeRapiTransportManager();

	PrintInit();
	sub_FF95EC54();
	SomePrintInit();
	sub_FF9EB94C();

	InitializeUSBDriver();
	TransMemoryInit();
	InitializeComCtrl();

	FactoryModeInit();
	DP_Init(0, 0x1B, 0, 0);
	return_0();

	sub_FF98CF4C();
	EdLedProcsInit();
	CallBacksInit();

	RegistNotifyConnectDT();
	DPOF_Initialize();

	MpuMonInit();

	StartConsole();
}
Exemplo n.º 28
0
int main(void)

{
	NVIC_SetVectorTable(NVIC_VectTab_FLASH,0x3000);  

	set_msi();
	DBGMCU_Config(DBGMCU_SLEEP | DBGMCU_STANDBY | DBGMCU_STOP, DISABLE);
		
  set_bor();
	Power.sleep_now=DISABLE;
	
	DataUpdate.Need_erase_flash=ENABLE;
	
  Settings.Geiger_voltage=360; // Напряжение на датчике 360 вольт
  Settings.Pump_Energy=350;    // энергия накачки 350 мТл
	DataUpdate.current_flash_page=0;
	
	io_init(); // Инициализация потров МК

	eeprom_write_default_settings(); // Проверка, заполнен ли EEPROM
  eeprom_read_settings(); // Чтение настроек из EEPROM
  screen=1;
	Power.USB_active=DISABLE;
	Power.sleep_time=Settings.Sleep_time;
  Power.Display_active=ENABLE;
	
	ADCData.DAC_voltage_raw=0x610;
		
  dac_init();
	comp_init();
	comp_on();
	timer9_Config(); // Конфигурируем таймер накачки	
	timer10_Config();
	tim2_Config();
	sound_activate();
	delay_ms(100);
	sound_deactivate();
//--------------------------------------------------------------------
	RTC_Config();	   // Конфигурируем часы
//--------------------------------------------------------------------
// инициализация дисплея
//--------------------------------------------------------------------
	delay_ms(50); // подождать установки напряжения
  display_on(); 
  LcdInit(); 
  LcdClear(); 
//--------------------------------------------------------------------
  adc_init();
  delay_ms(100);
  adc_calibration();
	delay_ms(10);
//--------------------------------------------------------------------
  EXTI8_Config();
#ifdef version_401
  EXTI9_Config();
#endif
	EXTI3_Config();
  EXTI4_Config();
  EXTI6_Config();
		
	DataUpdate.Need_batt_voltage_update=ENABLE;
	
	if(!GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_6))hidden_menu=ENABLE; // Открытие сервисных пунктов меню
	
	delay_ms(500); // подождать установки напряжения
		
  while(1) 
/////////////////////////////////
  {
		if(DataUpdate.Need_fon_update==ENABLE)	geiger_calc_fon();
    if(key>0)																keys_proccessing();
		if(DataUpdate.Need_batt_voltage_update)	adc_check_event();

		////////////////////////////////////////////////////

		
		if((Power.sleep_time>0)&(!Power.Display_active))sleep_mode(DISABLE); // Если дисплей еще выключен, а счетчик сна уже отсчитывает, поднимаем напряжение и включаем дисплей
    
		if(Power.Display_active)
    {
			if(Power.sleep_time==0 && !Alarm.Alarm_active) sleep_mode(ENABLE);  // Счетчик сна досчитал до нуля, а дисплей еще активен, то выключаем его и понижаем напряжение
			if(Power.led_sleep_time>0)
			{
				GPIO_ResetBits(GPIOC,GPIO_Pin_13);// Включаем подсветку 
			} else {
				GPIO_SetBits(GPIOC,GPIO_Pin_13);// Выключаем подсветку  				
			}			
			if(DataUpdate.Need_display_update==ENABLE)
			{
				DataUpdate.Need_display_update=DISABLE;
				LcdClear_massive();
				if (screen==1)main_screen();
				if (screen==2)menu_screen();
				if (screen==3)stat_screen();
			}
///////////////////////////////////////////////////////////////////////////////
		}
#ifdef version_401
		if((!Power.USB_active) && (GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_9))){
			usb_activate(0x0); // Если питание USB начало подаваться включаем USB
		}
#endif

		if(!Power.USB_active)		// если USB не активен, можно уходить в сон
		{
			if(current_pulse_count<30)      // Если счетчик не зашкаливает, то можно уйти в сон
			{
				if(!Power.Pump_active && !Power.Sound_active)
				{
					PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);    // Переходим в сон
#ifdef debug
 					Wakeup.total_wakeup++;
					DataUpdate.Need_display_update=ENABLE;
#endif

				} else
				{
						PWR_EnterSleepMode(PWR_Regulator_ON, PWR_SLEEPEntry_WFI);
#ifdef debug
  					Wakeup.total_wakeup++;
						DataUpdate.Need_display_update=ENABLE;
#endif
				}
			}
		}else USB_work(); 		// если USB активен, попробовать передать данные
#ifdef debug
 					Wakeup.total_cycle++;
					DataUpdate.Need_display_update=ENABLE;
#endif

  }
/////////////////////////////////////////////////////////////////////////////// 
}
Exemplo n.º 29
0
int main()
{
  int i;
  LcdInit();
  printf("start of lcd_test\n");
/*

  printf("LcdClearDisplay\n");
  LcdClearDisplay();
  Wait(SEC_1);

  printf("LcdDrawChar(""E"", 1, LCD_LINE8 div CELL_HEIGHT)\n");
  LcdDrawChar("E", 1, LCD_LINE8 div CELL_HEIGHT);
  Wait(SEC_1);

  printf("LcdDrawCharXY(""V"", 20, LCD_LINE8)\n");
  LcdDrawCharXY("V", 20, LCD_LINE8);
  Wait(SEC_1);

  printf("LcdDrawCharXY(""3"", 20, LCD_LINE8)\n");
  LcdDrawCharXY("3", 30, LCD_LINE8);
  Wait(SEC_1);

  printf("LcdDrawString(""EV3 BricxCC"", 4, LCD_LINE4 div CELL_HEIGHT, false)\n");
  LcdDrawString("EV3 BricxCC", 4, LCD_LINE4 div CELL_HEIGHT, false);
  Wait(SEC_1);

  printf("LcdDrawString(""EV3 BricxCC"", 1, LCD_LINE5 div CELL_HEIGHT, true)\n");
  LcdDrawString("EV3 BricxCC", 1, LCD_LINE5 div CELL_HEIGHT, true);
  Wait(SEC_1);

  printf("LcdDrawInt(SEC_1, 0, LCD_LINE7 div CELL_HEIGHT)\n");
  LcdDrawInt(SEC_1, 0, LCD_LINE7 div CELL_HEIGHT);
  Wait(SEC_1);

  printf("LcdScrollLine()\n");
  LcdScrollLine();
  Wait(SEC_1);

  printf("LcdScrollLine()\n");
  LcdScrollLine();
  Wait(SEC_1);
*/
  printf("CircleOut(50, 40, 10);\n");
  printf("CircleOutEx(30, 24, 10, DRAW_OPT_FILL_SHAPE);\n");
  printf("LineOut(10, 10, 80, 60);\n");
  printf("RectOut(20, 20, 40, 40);\n");
  printf("RectOutEx(65, 25, 20, 30, DRAW_OPT_FILL_SHAPE);\n");
  printf("EllipseOut(70, 30, 15, 20);\n");

  CircleOut(50, 40, 10);
  CircleOutEx(30, 24, 10, DRAW_OPT_FILL_SHAPE);
  LineOut(10, 10, 80, 60);
  RectOut(20, 20, 40, 40);
  RectOutEx(65, 25, 20, 30, DRAW_OPT_FILL_SHAPE);
  EllipseOut(70, 30, 15, 20);

  Wait(SEC_1);

  printf("LcdBmpFile(1, 0, 64, \"/media/card/mindstorms.rgf\");\n");
  LcdBmpFile(1, 0, 64, "/media/card/mindstorms.rgf");
  Wait(SEC_1);

  for (i = 0; i < 35; i++)
  {
    printf("LcdIcon(1, 130, 64, ICONTYPE_NORMAL, 0);\n");
    LcdIcon(1, 0+((i % 7)*24), 0+((i / 7) * 12), ICONTYPE_NORMAL, i);
    Wait(250);
  }

  printf("LcdText(1, 0, 100, \"hello world\");\n");
  LcdText(1, 0, 100, "hello world");
  Wait(SEC_1);

  printf("LcdSelectFont(FONTTYPE_TINY);\n");
  LcdSelectFont(FONTTYPE_TINY);

  printf("LcdText(1, 100, 100, \"testing\");\n");
  LcdText(1, 100, 100, "testing");
  Wait(SEC_1);
  
  // these functions will replace any file extension included in
  // the filename with the "correct" extension based on the
  // specified image format
  printf("LcdWriteDisplayToFile(\"/media/card/display.xbm\", ifXBM);\n");
  LcdWriteDisplayToFile("/media/card/display.xbm", ifXBM);

  printf("LcdWriteFrameBufferToFile(\"/media/card/fbuffer.xbm\", ifXBM);\n");
  LcdWriteFrameBufferToFile("/media/card/fbuffer.xbm", ifXBM);

  printf("LcdWriteDisplayToFile(\"/media/card/display_p1.pbm\", ifP1);\n");
  LcdWriteDisplayToFile("/media/card/display_p1.pbm", ifP1);

  printf("LcdWriteFrameBufferToFile(\"/media/card/fbuffer_p1.pbm\", ifP1);\n");
  LcdWriteFrameBufferToFile("/media/card/fbuffer_p1.pbm", ifP1);

  printf("LcdWriteDisplayToFile(\"/media/card/display_p4.pbm\", ifP4);\n");
  LcdWriteDisplayToFile("/media/card/display_p4.pbm", ifP4);

  printf("LcdWriteFrameBufferToFile(\"/media/card/fbuffer_p4.pbm\", ifP4);\n");
  LcdWriteFrameBufferToFile("/media/card/fbuffer_p4.pbm", ifP4);

//  Wait(SEC_5);
  LcdExit();
  printf("end of lcd_test\n");
}
Exemplo n.º 30
0
void mainPcd8544()
{
  //STM_EVAL_LEDInit(LED3);
  //STM_EVAL_LEDToggle(LED3);
  //QuadEncInit();
  
  LcdInit();

  LcdClear();
  LcdGotoXYFont ( 2, 2 );
  LcdStr( FONT_1X, "1234" );
  LcdUpdate();
  
/*
  HwLcdInit();

  while (1)
  {
    HwLcdPinRst(1);
    HwLcdPinDC(1);
    HwLcdPinCE(1);
    HwLcdSend(0xEEEE);
    Delay(2);
    HwLcdPinRst(0);
    HwLcdPinDC(0);
    HwLcdPinCE(0);
    Delay(2);
  }
*/
  for(int i=0; 1; i++)
  {
    LcdClear();
    LcdGotoXYFont ( 1, 1 );
    printInt(i, FONT_1X);
    LcdUpdate();
    Delay(100);
  }

  while (1)
  {
    STM_EVAL_LEDToggle(LED3);
    LcdClear();

    if(QuadEncButton())
    {
      LcdGotoXYFont ( 1, 1 );
      LcdStr(FONT_1X, "PRESSED!");
    }
    
    LcdGotoXYFont ( 1, 3 );
    LcdStr(FONT_1X, "Q=");
    printInt(QuadEncValue(), FONT_2X);
    
    LcdUpdate();

    Delay(20);
  }
/*
  while (1)
  {

    //uint16_t temp_lo = PressureRead(0x20);
    //uint16_t temp_hi = PressureRead(0x0F);
    STM_EVAL_LEDToggle(LED3);
    LcdClear();
    LcdGotoXYFont ( 1, 3 );
    LcdStr(FONT_1X, "P=");
    printInt(PressureReadPressure(), FONT_1X);
    LcdGotoXYFont ( 1, 5 );
    LcdStr(FONT_1X, "T=");
    printIntFixed(PressureReadTemp(), FONT_1X, 3, 1);
    LcdUpdate();

    Delay(200);
  }
*/

}