
#ifndef _MCU_SPI_H_
#define _MCU_SPI_H_
 #include "stm32f10x.h"

#define EPD_W21_SPI_SPEED 0x02

//#define EPD_W21_VPP_0	P4 &= ~0x80
//#define EPD_W21_VPP_1	P4 |= 0x80

#define EPD_W21_CLK_0	GPIO_ResetBits(GPIOA, GPIO_Pin_1)
#define EPD_W21_CLK_1	GPIO_SetBits(GPIOA, GPIO_Pin_1)

#define EPD_W21_CS_0	GPIO_ResetBits(GPIOA, GPIO_Pin_2)
#define EPD_W21_CS_1	GPIO_SetBits(GPIOA, GPIO_Pin_2)

#define EPD_W21_MOSI_0	GPIO_ResetBits(GPIOA, GPIO_Pin_3)
#define EPD_W21_MOSI_1	GPIO_SetBits(GPIOA, GPIO_Pin_3)

#define EPD_W21_DC_0	GPIO_ResetBits(GPIOA, GPIO_Pin_4)
#define EPD_W21_DC_1	GPIO_SetBits(GPIOA, GPIO_Pin_4)

//#define EPD_W21_BS_1	P2 |= 0x01

#define isEPD_W21_BUSY GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_5) // for solomen solutions


void driver_delay_us(unsigned int xus);
void driver_delay_xms(unsigned long xms);

void SPI_Write(unsigned char value);
void EPD_W21_WriteDATA(unsigned char command);
void EPD_W21_WriteCMD(unsigned char command);
void EPD_W21_WriteCMD_p1(unsigned char command,unsigned char para);
void EPD_W21_WriteCMD_p2(unsigned char command,unsigned char para1,unsigned char para2);
void EPD_W21_Write(unsigned char *value, unsigned char datalen);

void EPD_W21_WriteDispRam(unsigned char XSize,unsigned int YSize,
							unsigned char *Dispbuff);

void EPD_W21_WriteDispRamMono(unsigned char XSize,unsigned int YSize,
							unsigned char dispdata);
#endif  //#ifndef _MCU_SPI_H_

/***********************************************************
						end file
***********************************************************/
