Esempio n. 1
0
static void wadsp_send_bit(int bit)
{
    if (reset) {
	XRES(0);
	reset = 0;
    }
    SDATA(bit);
    SCLK(1);
    SCLK(0);
}
Esempio n. 2
0
static unsigned readbyte(void)
{
	unsigned byte=0;
	unsigned i;
	for(i = 0; i < 8; ++i) {
		byte <<= 1;
		SCLK(0);
		gdelay(1);
		byte |= SDO;
		SCLK(1);
		gdelay(1);
	}
	return byte;
}
Esempio n. 3
0
static void writebyte(unsigned byte)
{
	unsigned short i;
	for (i = 0; i < 8; ++i)	{
		SCLK(0);
		gdelay(1);
		if (byte&0x0080)
			SDI(1);
		else
			SDI(0);
		SCLK(1);
		gdelay(1);
		byte <<= 1;
	}
}
Esempio n. 4
0
static void wadsp_close(void)
{
    XRES(1);
    Z();
    SCLK(0);
    tty_close();
}
Esempio n. 5
0
static void WriteData(unsigned cmd)
{
	unsigned fb=mDevID+RS(1)+RW(0);
	SCLK(1);
	SDI(1);
	CS(0);
	gdelay(1);
	writebyte(fb);
	writebyte(cmd);
	CS(1);	
}
Esempio n. 6
0
static void lcdc_hx8352_config_gpios(void)
{
	/* Setting the Default GPIO's */
	spi_sdi = platform_data->gpio_num[0];
	spi_sdo = platform_data->gpio_num[1];
	lcd_reset = platform_data->gpio_num[2];
	spi_cs  = platform_data->gpio_num[3];
	spi_clk = platform_data->gpio_num[4];

	platform_data->panel_config_gpio(GPIO_ENABLE);

	RESET(1);
	SCLK(1);
	CS(1);
}
Esempio n. 7
0
void spi_init()  
{  
	DRDY();
	SS();
	SCLK();
	MOSI();
	MOSO();
	SPI_CLK(0);
	SPI_MOSI(0);
    //set_gpio_direction(SS, OUTP);  
    //set_gpio_direction(SCLK, OUTP);  
    //set_gpio_direction(MOSI, OUTP);  
    //set_gpio_direction(MISO, INP);  
    //set_gpio_value(SCLK, 0);                    //CPOL=0 
    //set_gpio_value(MOSI, 0);
}  
Esempio n. 8
0
static int wadsp_open(const char *dev,int voltage,int power_on,
  const char *args[])
{
    prog_init(NULL,NULL,NULL,&wadsp_bit);
    if (power_on)
	return -1;
    if (voltage == 3)
	fprintf(stderr,
	  "warning: 3V operation is not reliable. Trying anyway ...\n");
    fd = tty_open_raw(dev,B19200);
    XRES(1);
    SCLK(0);
    Z();
    reset = 1;
    inverted = 0;
    sdata = -1;
    return voltage;
}
Esempio n. 9
0
static void wadsp_invert_phase(void)
{
    inverted = !inverted;
    if (inverted)
	SCLK(1);
}
Esempio n. 10
0
static void wadsp_send_z(void)
{
    Z();
    SCLK(!inverted);
    SCLK(inverted);
}
Esempio n. 11
0
static void send_colors(struct color *colors, int count)
{
	int i, k;

	/* Initialize SPI pins. */
	SCLK(0);
	MOSI(0);

	/* Start frame */
	for (i = 0; i < 32; i++) {
		SCLK(1);
		SMALL_DELAY();
		SCLK(0);
		SMALL_DELAY();
	}

	/* Color cell output */
	for (k = 0; k < count; k++) {
		/* Start bit */
		MOSI(1);
		SCLK(1);
		SMALL_DELAY();
		SCLK(0);
		SMALL_DELAY();

		/* Blue */
		for (i = 0; i < 5; i++) {
			MOSI(((colors[k].b & ((1 << 4) >> i)) != 0));
			SCLK(1);
			SMALL_DELAY();
			SCLK(0);
			SMALL_DELAY();
		}
		/* Red */
		for (i = 0; i < 5; i++) {
			MOSI(((colors[k].r & ((1 << 4) >> i)) != 0));
			SCLK(1);
			SMALL_DELAY();
			SCLK(0);
			SMALL_DELAY();
		}
		/* Green */
		for (i = 0; i < 5; i++) {
			MOSI(((colors[k].g & ((1 << 4) >> i)) != 0));
			SCLK(1);
			SMALL_DELAY();
			SCLK(0);
			SMALL_DELAY();
		}
	}

	/* End frame */
	MOSI(0);
	for (k = 0; k < count; k++) {
		SCLK(1);
		SMALL_DELAY();
		SCLK(0);
		SMALL_DELAY();
	}
}