Esempio n. 1
0
/**
 * send data in chain to hardware (only use this if hardware doesn't show data right after
 * data is received to avoid blanking. If the data is shown immediately, you have
 * to transmit it in _show() 
 */
NftResult _send(void *privdata, LedChain * c, LedCount count, LedCount offset)
{
        NFT_LOG(L_DEBUG, "Sending LDP8806 data");

        struct priv *p = privdata;
        uint8_t *buf = led_chain_get_buffer(c);

        /* seek to offset */
        int bytes_per_component =
                led_chain_get_buffer_size(c) / led_chain_get_ledcount(c);
        buf += offset * bytes_per_component;

        /* send buffer */
        return spiTxData(p->fd, buf, bytes_per_component * count);
}
Esempio n. 2
0
/**
 * send data in chain to hardware (only use this if hardware doesn't show data right away
 * to avoid blanking)
 */
NftResult _send(void *privdata, LedChain * c, LedCount count, LedCount offset)
{

        NFT_LOG(L_NOISY, "Sending %d LEDs (Offset: %d)", count, offset);


        Niftylino *n = privdata;

        if(!n || !n->usb_handle)
                NFT_LOG_NULL(NFT_FAILURE);


        char *buffer = led_chain_get_buffer(c);

        if(usb_bulk_write(n->usb_handle, 1, buffer,
                          led_chain_get_buffer_size(c), n->usb_timeout) < 0)
        {
                return NFT_FAILURE;
        }

        return NFT_SUCCESS;

}