コード例 #1
0
/*****************************************************************************
Name:          	InitDisplay
Parameters:     none
Returns:        none
Description:    Intializes the LCD display. 
*****************************************************************************/
void LCD_display_init( void )
{
	// initial port directions
	LCD_Port_Drive();
		
	CS1_PIN		= SELECTED;			// Preset Values
	CS2_PIN		= SELECTED;
	EN_PIN 		= HIGH;
	RW_PIN		= WRITE;
	DI_PIN 		= HIGH;
	BACKLIGHT_PIN = LOW;
	
	CS1_PIN_DDR |= DRIVE;			// Data Direction Control lines.
	CS2_PIN_DDR |= DRIVE;
	EN_PIN_DDR	|= DRIVE;
	RW_PIN_DDR	|= DRIVE;
	DI_PIN_DDR	|= DRIVE;
	RESET_PIN_DDR |= DRIVE;
	prc2=1;							// unprotect as Port 9 is used	
	BACKLIGHT_PIN_DDR = OUTPUT;
	
	// RESET LCD
	EN_PIN 		= LOW;
	RESET_PIN	= ASSERT;
	DisplayDelay(4);	
	RESET_PIN	= UNASSERTED;
	DisplayDelay(4);	
	WaitForNotBusy(1);

	// INITIALIZE REGISTERS:
	GotoAddress( 0,0 );				// x=0; y=0;
	LCD_write(CTRL,SET_DISPLAY_START+0x00, BOTH );
	WaitForNotBusy(1);
	LCD_write(CTRL,DISPLAY_ON    ,BOTH);
	
	BACKLIGHT_PIN = LOW;	
//	BACKLIGHT_PIN = HIGH;	
}
コード例 #2
0
/*****************************************************************************
Name:          	SendAddresses()
Parameters:     First call Set_y_address() or Set_x_address()
Description:    Send the internal x,y position counters to the display
				Ensures code is in-sync with the driver.
*****************************************************************************/
void LCD_SendAddresses()   		// Send to display
{
	GotoAddress(x_address,y_address);
}
コード例 #3
0
ファイル: birthdate.c プロジェクト: jmjeong/happydays.palm
Int16 AnalizeOneRecord(UInt16 addrattr, Char* src,
                  HappyDays* hd, Boolean *ignore)
{
    Char *p, *q;
    UInt16 index;
    Int16 err;
    Int16 year, month, day;
    Int16 nth[20];
    Int16 count = 0;

	while (*src == ' ' || *src == '\t') src++;    // skip white space

    // ignore record with exclamation mark
    if (*src == '!') {
        if (gPrefsR.ignoreexclamation) return 0;
        else src++;
    }


    if ((q = StrChr(src, '['))) {
        // [ 이 있는 경우 duration으로 판단 
        p = q;

        q = StrChr(src, ']');
        if (q) *q = 0;
        else return 0;

        do {
            p++;
            nth[count++] = StrAToI(p);
            if (count >= 20) break;
        } while ((p = StrChr(p, ',')));
    }
    
    if (*src == '*') {
        
        // this is multiple event
        hd->flag.bits.multiple_event = true;
        if ((p = StrChr(src, ' '))) *p = 0;
        else goto ErrHandler;
    
        if ( *(src+1) != 0 ) {                       // if src have 'custom' tag
            hd->custom = src+1;
            UnderscoreToSpace(src+1);
        }
		else hd->custom = 0;

        src = p+1;
        while (*src == ' ' || *src == '\t') src++;     // skip white space

        if ((p = StrChr(src, ' '))) *p = 0;
        else goto ErrHandler;

        if (*src == '.') {
            hd->name1 = src+1;
            hd->name2 = 0;
        }
        else {
            hd->name2 = src;
        }
        
        UnderscoreToSpace(src);
        
        src = p+1;
        while (*src == ' ' || *src == '\t') src++;     // skip white space
    }
    
    if (!AnalysisHappyDays(src, &hd->flag,
                           &year, &month, &day)) goto ErrHandler;

    // convert into date format
    //
    if (hd->flag.bits.year) {
        if ((year < 1904) || (year > 2031) ) goto ErrHandler;
        else hd->date.year = year - 1904; 
    }
    else hd->date.year = 0;
        
    hd->date.month = month;
    hd->date.day = day;

    // maintain address book order(name order)
    //      list order is determined by sort
    err = HDNewRecord(MainDB, hd, &index);
    if (!err) {
        UInt16 attr;
        // set the category of the new record to the category
        // it belongs in
        DmRecordInfo(MainDB, index, &attr, NULL, NULL);
        attr &= ~dmRecAttrCategoryMask;
        attr |= addrattr;

        DmSetRecordInfo(MainDB, index, &attr, NULL);

        DmReleaseRecord(MainDB, index, true);
    }

    if (count > 0) {
        Int16 i;
        HappyDays hdr;

        for (i = 0; i < count; i++) {
            MemMove(&hdr, hd, sizeof(hdr));

            hdr.flag.bits.nthdays = 1;
            hdr.nth = nth[i];

            if (!hdr.flag.bits.year) goto ErrHandler;
            
            err = HDNewRecord(MainDB, &hdr, &index);
            if (!err) {
                UInt16 attr;
                // set the category of the new record to the category
                // it belongs in
                DmRecordInfo(MainDB, index, &attr, NULL, NULL);
                attr &= ~dmRecAttrCategoryMask;
                attr |= addrattr;

                DmSetRecordInfo(MainDB, index, &attr, NULL);

                DmReleaseRecord(MainDB, index, true);
            }
        }
    }
    
    return 0;

 ErrHandler:
    if (*ignore) return 0;
                
    switch (FrmCustomAlert(InvalidFormat,
                           ((!hd->name2) ?
                            ((!hd->name1) ? " " : hd->name1)
                            : hd->name2),
                               " ", " ")) {
    case 0:                 // EDIT
        if (!GotoAddress(hd->addrRecordNum)) return -1;
    case 2:                 // Ignore all
        *ignore = true;
    case 1:  
    	break;              // Ignore
    }
    return 0;
}