void WriteRGB( struct SRGBLEDControl *pData, byte **ReportBuffer, byte *nBit ) { byte nOut = ReadPackData16( ReportBuffer, nBit, 3 ); if ( pData->Options & _BV(RGB_SINK) ) nOut = ~nOut; SetPortBit( pData->PortR, nOut & RGB_RED ); SetPortBit( pData->PortG, nOut & RGB_GREEN ); SetPortBit( pData->PortB, nOut & RGB_BLUE ); }
void SendData(unsigned int data) { for (int i=0;i<16;i++) { if ((data&0x8000)==0x00) ClearPortBit(PORTD, DATA); else SetPortBit(PORTD, DATA); asm("nop"); SetPortBit(PORTD, SCL);//»мпульс на SCL asm("nop"); ClearPortBit(PORTD, SCL); asm("nop"); data=(data<<1); } asm("nop"); SetPortBit(PORTD, REC);//»мпульс на Latch clock asm("nop"); ClearPortBit(PORTD, REC); }