Esempio n. 1
0
/************************************************************************
* Function: void GfxTconWriteCommand(BYTE index, WORD value)                                           
*                                                                       
* Overview: This writes a word to SPI by calling the write byte 
*           routine.
*                                                                       
* Input: index - The index (or address) of the register to be written.
*        value - The value that will be written to the register.
*                                                                       
* Output: none                                 
*                                                                       
************************************************************************/
void GfxTconWriteCommand(WORD index, WORD value)
/* */
{
    GfxTconSetIO(BB_CS, 0);

    // Index
    GfxTconWriteByte(0x70);
    GfxTconWriteByte(((WORD_VAL) index).v[1]);
    GfxTconWriteByte(((WORD_VAL) index).v[0]);

    GfxTconSetIO(BB_CS, 1);
    Delay10us(1);
    GfxTconSetIO(BB_CS, 0);

    // Data
    GfxTconWriteByte(0x72);
    GfxTconWriteByte(((WORD_VAL) value).v[1]);
    GfxTconWriteByte(((WORD_VAL) value).v[0]);
    GfxTconSetIO(BB_CS, 1);
    Delay10us(1);
}
Esempio n. 2
0
/************************************************************************
* Function: void GfxTconWriteByte(BYTE value)                                           
*                                                                       
* Overview: This writes a bytes to SPI.
*                                                                       
* Input: value - the byte data to be written.
*                                                                       
* Output: none                                 
*                                                                       
************************************************************************/
void GfxTconWriteByte(BYTE value)
{
    BYTE    mask;

    mask = 0x80;
    while(mask)
    {
        GfxTconSetIO(BB_SCL, 0);
        Delay10us(1);
        if(mask & value)
        {
            GfxTconSetIO(BB_SDO, 1);
        }
        else
        {
            GfxTconSetIO(BB_SDO, 0);
        }

        GfxTconSetIO(BB_SCL, 1);
        mask >>= 1;
    }
}