sendRaw correction

This commit is contained in:
Adrien VAN DAMME 2017-02-05 18:11:25 +01:00
parent 7680a92c16
commit 975b60889f
3 changed files with 9 additions and 2 deletions

BIN
a.out

Binary file not shown.

View File

@ -4,9 +4,11 @@
* Created: 26-12-16 21:57:10
* Author: Adrien
*/
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <stdlib.h>
#include "ws2801.h"
/*
@ -21,13 +23,16 @@ Pour l'envois, il faut commencer par le bit 7 !
*/
main()
{}
{
return 0;
}
ws2801::ws2801(uint8_t pin_clk, uint8_t pin_data, uint8_t *port, uint8_t nbr_ci)
{
this->pin_clk = pin_clk;
this->pin_data = pin_data;
this->port = port;
this->nbr_ci = nbr_ci;
PORTB;
data = (uint8_t*)calloc(3*nbr_ci, 1);
ddr = port-1;
*ddr |= (1<<pin_clk)|(1<<pin_data);
@ -62,6 +67,8 @@ main()
for(j=0,m=0x80;j<8;j++)
{
*port &= ~(_BV(pin_clk));
if(!i&&!j)
_delay_us(500);
*port = (*port&(~(_BV(pin_data))))|((data[i]&m)?_BV(pin_data):0);
if(m==0x01)
m=0x80;

BIN
ws2801.o Normal file

Binary file not shown.