/************************************************************************************************** z-stack代码,SPI总线写命令 **************************************************************************************************/ void HalLcd_HW_Control(uint8 cmd) { #ifdef CC2530DK_V1 //do nothiing #else //保存原来MISO引脚的设置 uint8 dir = P1DIR; uint8 sel = P1SEL; P1DIR |=BV(7); /* 0为GPIO,1为外设, 这里用到的是MISO引脚的GPIO功能, 因此相应引脚设为0? */ P1SEL &=~(BV(7)); #endif LCD_SPI_BEGIN(); LCD_DO_CONTROL(); LCD_SPI_TX(cmd); LCD_SPI_WAIT_RXRDY(); LCD_SPI_END(); #ifdef CC2530DK_V1 //do nothiing #else P1DIR =dir; P1SEL =sel; #endif }
/************************************************************************************************** * @fn HalLcd_HW_Control * * @brief Write 1 command to the LCD * * @param uint8 cmd - command to be written to the LCD * * @return None **************************************************************************************************/ void HalLcd_HW_Control(uint8 cmd) { LCD_SPI_BEGIN(); LCD_DO_CONTROL(); LCD_SPI_TX(cmd); LCD_SPI_WAIT_RXRDY(); LCD_SPI_END(); }
/*********************************************************************************** * @fn lcdControl * * @brief Send command to display * * @param uint8 command * * @return none */ static void lcdControl(uint8 command) { LCD_SPI_BEGIN(); LCD_DO_CONTROL(); LCD_SPI_TX(command); LCD_SPI_WAIT_RXRDY(); LCD_SPI_END(); }