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: Display/TFT.cpp
- Revision:
- 3:48f3282c2be8
- Parent:
- 2:713844a55c4e
- Child:
- 4:12ba0ecc2c1f
--- a/Display/TFT.cpp Fri Feb 13 23:17:55 2015 +0000 +++ b/Display/TFT.cpp Sat Feb 14 17:42:21 2015 +0000 @@ -1,3 +1,15 @@ +/* mbed library for 240*320 pixel display TFT based on ILI9341 LCD Controller + * Copyright (c) 2013 Peter Drescher - DC2PD + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + #include "TFT.h" //#include "mbed_debug.h" @@ -87,25 +99,25 @@ switch (orientation) { case 0:// default, portrait view 0° if(mipistd) wr_data8(0x0A); // this is in real a vertical flip enabled, seems most displays are vertical flipped - else wr_data8(0x48); //48 for 9341 + else wr_data8(0x48); //for some other ILIxxxx set_width(LCDSIZE_X); set_height(LCDSIZE_Y); break; case 1:// landscape view +90° if(mipistd) wr_data8(0x28); - else wr_data8(0x29);//28 for 9341 + else wr_data8(0x29);//for some other ILIxxxx set_width(LCDSIZE_Y); set_height(LCDSIZE_X); break; case 2:// portrait view +180° if(mipistd) wr_data8(0x09); - else wr_data8(0x99);//88 for 9341 + else wr_data8(0x99);//for some other ILIxxxx set_width(LCDSIZE_X); set_height(LCDSIZE_Y); break; case 3:// landscape view -90° if(mipistd) wr_data8(0x2B); - else wr_data8(0xF8);//E8 for 9341 + else wr_data8(0xF8);//for some other ILIxxxx set_width(LCDSIZE_Y); set_height(LCDSIZE_X); break; @@ -116,6 +128,7 @@ { //ili9486 does not like truncated 2A/2B cmds, at least in par mode //setting only start column/page would speedup, but needs a windowmax() before, maybe implement later + //fixme for PAR_16: // cmd 2A/2B expects 8bit parameters wr_cmd8(0x2A); wr_data16(x); //start column wr_data16(x+w-1);//end column