Added SPI burst mode to spi 8 bit.
Dependents: Bicycl_Computer_NUCLEO-F411RE Bicycl_Computer_NUCLEO-L476RG
Fork of UniGraphic by
Added SPI burst mode to this graphics driver. If whoever wants this rolled in to repository let me know. I replaced _spi.write(); with fastWrite(); and clearRX();
SPI8.cpp
// need to re-create SPI firmware to access SPI handle static SPI_HandleTypeDef SpiHandle; void SPI8::fastWrite(int data) { SpiHandle.Instance = SPI1; // Check if data is transmitted while ((SpiHandle.Instance->SR & SPI_SR_TXE) == 0); SpiHandle.Instance->DR = data; } void SPI8::clearRX( void ) { SpiHandle.Instance = SPI1; //Check if the RX buffer is busy //While busy, keep checking while (SpiHandle.Instance->SR & SPI_SR_BSY){ // Check RX buffer readable while ((SpiHandle.Instance->SR & SPI_SR_RXNE) == 0); int dummy = SpiHandle.Instance->DR; } }
Diff: Protocols/PAR16.h
- Revision:
- 20:14daa48ffd4c
- Parent:
- 11:b842b8e332cb
- Child:
- 25:daacdcf34e52
diff -r 1bdfb971b2c1 -r 14daa48ffd4c Protocols/PAR16.h --- a/Protocols/PAR16.h Mon Mar 02 10:52:26 2015 +0000 +++ b/Protocols/PAR16.h Mon Mar 23 14:08:04 2015 +0000 @@ -96,6 +96,35 @@ */ virtual unsigned int rd_extcreg_data32(unsigned char reg, unsigned char SPIreadenablecmd); + /** ILI932x specific, does a dummy read cycle, number of bits is protocol dependent + * for PAR protocols: a signle RD bit toggle + * for SPI8: 8clocks + * for SPI16: 16 clocks + */ + virtual void dummyread (); + + /** ILI932x specific, select register for a successive write or read + * + * @param reg register to be selected + * @param forread false = a write next (default), true = a read next + * @note forread only used by SPI protocols + */ + virtual void reg_select(unsigned char reg, bool forread =false); + + /** ILI932x specific, write register with data + * + * @param reg register to write + * @param data 16bit data + */ + virtual void reg_write(unsigned char reg, unsigned short data); + + /** ILI932x specific, read register + * + * @param reg register to be read + * @returns 16bit register value + */ + virtual unsigned short reg_read(unsigned char reg); + /** HW reset sequence (without display init commands) */ virtual void hw_reset();