Send the command sequence to power up the LCDs
| 199 | // |
| 200 | // Send the command sequence to power up the LCDs |
| 201 | static void LCDPowerUp(OBDISP *pOBD) |
| 202 | { |
| 203 | int iLen; |
| 204 | uint8_t *s, uc[32]; |
| 205 | obdSetDCMode(pOBD, MODE_COMMAND); |
| 206 | gpio_put(pOBD->iCSPin, LOW); |
| 207 | if (pOBD->type == LCD_UC1701 || pOBD->type == LCD_UC1609) |
| 208 | { |
| 209 | s = (uint8_t *)uc1701_initbuf; |
| 210 | iLen = sizeof(uc1701_initbuf); |
| 211 | } |
| 212 | else if (pOBD->type == LCD_HX1230) |
| 213 | { |
| 214 | s = (uint8_t *)hx1230_initbuf; |
| 215 | iLen = sizeof(hx1230_initbuf); |
| 216 | } |
| 217 | else // Nokia 5110 |
| 218 | { |
| 219 | s = (uint8_t *)nokia5110_initbuf; |
| 220 | iLen = sizeof(nokia5110_initbuf); |
| 221 | } |
| 222 | memcpy(uc, s, iLen); |
| 223 | |
| 224 | if (pOBD->iMOSIPin == 0xff) |
| 225 | spi_write_blocking(pOBD->spi->getController(), s, iLen); |
| 226 | else |
| 227 | SPI_BitBang(pOBD, s, iLen, pOBD->iMOSIPin, pOBD->iCLKPin); |
| 228 | |
| 229 | sleep_ms(100); |
| 230 | obdWriteCommand(pOBD, 0xa5); |
| 231 | sleep_ms(100); |
| 232 | obdWriteCommand(pOBD, 0xa4); |
| 233 | obdWriteCommand(pOBD, 0xaf); |
| 234 | gpio_put(pOBD->iCSPin, HIGH); |
| 235 | obdSetDCMode(pOBD, MODE_DATA); |
| 236 | } /* LCDPowerUp() */ |
| 237 | |
| 238 | // |
| 239 | // Initialize the display controller on an SPI bus |
no test coverage detected