diff --git a/bsp/src/M4StickV2/bsp.c b/bsp/src/M4StickV2/bsp.c --- a/bsp/src/M4StickV2/bsp.c +++ b/bsp/src/M4StickV2/bsp.c @@ -81,19 +81,21 @@ void bsp_uart_init() { //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t)); streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice)); + //uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,230400,PA9,PA10,-1,-1); uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1); uartmkstreamdev(uart,fd1); __opnfiles__[1] = fd1; } else { + // uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,230400,PA9,PA10,-1,-1); uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1); } } void bsp_spi_init() { - spiopenandconfig(spi1,spi8bits | spimaster |spiclkinhlow | spiclkfirstedge | spimsbfirst,1000000,DAC_DIN,ADC_DOUT1,ADC_SCLK,-1); + spiopenandconfig(spi1,spi8bits | spimaster |spiclkinhlow | spiclkfirstedge | spimsbfirst,4000000,DAC_DIN,ADC_DOUT1,ADC_SCLK,-1); } diff --git a/bsp/src/STM32F4Discovery-EXT/STM32F4Discovery-EXT.pro b/bsp/src/STM32F4Discovery-EXT/STM32F4Discovery-EXT.pro new file mode 100644 --- /dev/null +++ b/bsp/src/STM32F4Discovery-EXT/STM32F4Discovery-EXT.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib + +TARGET=bsp +OBJECTS_DIR = obj + +BSP=STM32F4Discovery-EXT + +UCMODEL=stm32f4 + +SOURCES += bsp.c + +HEADERS += bsp.h + + +BSPFILE = bsp.pri + + + diff --git a/bsp/src/STM32F4Discovery-EXT/bsp.c b/bsp/src/STM32F4Discovery-EXT/bsp.c new file mode 100644 --- /dev/null +++ b/bsp/src/STM32F4Discovery-EXT/bsp.c @@ -0,0 +1,311 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the libuc, microcontroler library +-- Copyright (C) 2011, Alexis Jeandet +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +------------------------------------------------------------------------------- +-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@gmail.com +-------------------------------------------------------------------------------*/ +#include "bsp.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint32_t OSC0 =8000000; +uint32_t INTOSC =16000000; +uint32_t RTCOSC =32768; +uint32_t currentCpuFreq=0; +extern streamdevice* __opnfiles__[__MAX_OPENED_FILES__]; + +float VREF0 =(float)3.3; + +LCD_IF_t lcdIF0={ + .init = &bsp_FSMC_init, + .writereg = &bsp_lcd0_write_reg, + .readreg = &bsp_lcd0_read_reg, + .writeGRAM = &bsp_lcd0_writeGRAM, + .readGRAM = &bsp_lcd0_readGRAM +}; + +LCD_t lcd0={ + .interface = &lcdIF0, + .init = &ssd2119init, + .paint = &ssd2119paint, + .paintText = &ssd2119paintText, + .paintFilRect = &ssd2119paintFilRect, + .refreshenable = &ssd2119refreshenable, + .width= 320, + .height = 240 +}; + + +volatile int16_t* lcd0_CMD=(volatile int16_t*) 0x60000000; +volatile int16_t* lcd0_DATA=(volatile int16_t*)(0x60FFFFF0); + +int bsp_init() +{ + int i=0; + for(i=0;i<32;i++) + { + __opnfiles__[i] = NULL; + } + bsp_GPIO_init(); + bsp_uart_init(); + bsp_FSMC_init(); + printf("\r================================================================\n\r"); + printf("================================================================\n\r"); + printf(BSP); + printf(" initialised\n\r"); + printf("================================================================\n\r"); + return 1; +} + +void bsp_GPIO_init() +{ + gpio_t gpio1 = gpioopen(PD12);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009 + // gpio_t gpio2 = gpioopen(PD13);//gpioopen(LED2); + gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2); + // gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2); + gpiosetspeed(&gpio1,gpiohighspeed); + //gpiosetspeed(&gpio2,gpiohighspeed); + gpiosetspeed(&gpio3,gpiohighspeed); + //gpiosetspeed(&gpio4,gpiohighspeed); + gpiosetdir(&gpio1,gpiooutdir); + gpiosetdir(&gpio3,gpiooutdir); + // gpiosetdir(&gpio2,gpiooutdir); + //gpiosetdir(&gpio4,gpiooutdir); +} + +void bsp_uart_init() +{ + if(__opnfiles__[1]==NULL) + { + //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t)); + streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice)); + uart_t uart = uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,9600,PC6,PC7,-1,-1); + uartmkstreamdev(uart,fd1); + __opnfiles__[1] = fd1; //stdo + __opnfiles__[0] = fd1; //stdi + } + else + { + uartopenandconfig(uart6,uartparitynone | uart8bits | uartonestop,9600,PC6,PC7,-1,-1); + } +} + + +/* +D0 PD14 D1 PD15 D2 PD0 D3 PD1 D4 PE7 +D5 PE8 D6 PE9 D7 PE10 D8 PE11 D9 PE12 +D10 PE13 D11 PE14 D12 PE15 D13 PD8 D14 PD9 +D15 PD10 +A0 PF0 = RS FSMC_NE3 PG10 CS FSMC_NWE PD5 W/S +FSMC_NOE PD4 RD +*/ +/*-- GPIOs Configuration -----------------------------------------------------*/ +/* + +-------------------+--------------------+------------------+------------------+ + + SRAM pins assignment + + +-------------------+--------------------+------------------+------------------+ + | PD0 <-> FSMC_D2 | PE0 <-> FSMC_NBL0 | PF0 <-> FSMC_A0 | PG0 <-> FSMC_A10 | + | PD1 <-> FSMC_D3 | PE1 <-> FSMC_NBL1 | PF1 <-> FSMC_A1 | PG1 <-> FSMC_A11 | + | PD4 <-> FSMC_NOE | PE3 <-> FSMC_A19 | PF2 <-> FSMC_A2 | PG2 <-> FSMC_A12 | + | PD5 <-> FSMC_NWE | PE4 <-> FSMC_A20 | PF3 <-> FSMC_A3 | PG3 <-> FSMC_A13 | + | PD8 <-> FSMC_D13 | PE7 <-> FSMC_D4 | PF4 <-> FSMC_A4 | PG4 <-> FSMC_A14 | + | PD9 <-> FSMC_D14 | PE8 <-> FSMC_D5 | PF5 <-> FSMC_A5 | PG5 <-> FSMC_A15 | + | PD10 <-> FSMC_D15 | PE9 <-> FSMC_D6 | PF12 <-> FSMC_A6 | PG9 <-> FSMC_NE2 | + | PD11 <-> FSMC_A16 | PE10 <-> FSMC_D7 | PF13 <-> FSMC_A7 |------------------+ + | PD12 <-> FSMC_A17 | PE11 <-> FSMC_D8 | PF14 <-> FSMC_A8 | + | PD13 <-> FSMC_A18 | PE12 <-> FSMC_D9 | PF15 <-> FSMC_A9 | + | PD14 <-> FSMC_D0 | PE13 <-> FSMC_D10 |------------------+ + | PD15 <-> FSMC_D1 | PE14 <-> FSMC_D11 | + | | PE15 <-> FSMC_D12 | + +-------------------+--------------------+ +*/ +int bsp_FSMC_init() +{ +#define GPIOGETPORT(gpio) ((GPIO_TypeDef*)(((((uint32_t)gpio) & (uint32_t)0x0000FF00)*(uint32_t)4) + (uint32_t)GPIOA)) +#define GPIOPORTNUM(gpio) (((uint32_t)(gpio) & (uint32_t)0x0000FF00)>>(uint32_t)8) + + gpio_t gpio1 = gpioopen(LCD_RESET); + gpiosetspeed(&gpio1,gpiohighspeed); + gpiosetdir(&gpio1,gpiooutdir); + gpioclr(LCD_RESET); + gpio1 = gpioopen(LCD_CS); + gpiosetspeed(&gpio1,gpiohighspeed); + gpiosetdir(&gpio1,gpiooutdir); + gpioset(LCD_CS); + gpio_t LCD_DBxList[]={ + PD0 ,PD1 ,PD4 ,PD5 ,PD8 ,PD9 ,PD10,PD14,PD15, + PE3 ,PE7 ,PE8 ,PE9 ,PE10,PE11,PE12,PE13,PE14, + PE15 }; + + for(int i=0;i<19;i++) + { + gpio_t LCD_DBx = gpioopen(LCD_DBxList[i]); + LCD_DBx |= gpiohighspeed | gpioaf | gpiopushpulltype | gpionopulltype; + gpiosetconfig(&LCD_DBx); + GPIO_PinAFConfig(GPIOGETPORT(LCD_DBx), (uint8_t)(LCD_DBx & 0xF), GPIO_AF_FSMC); + } + + FSMC_NORSRAMInitTypeDef FSMC_NORSRAMInitStructure; + FSMC_NORSRAMTimingInitTypeDef p; + + /* Enable FSMC clock */ + RCC_AHB3PeriphClockCmd(RCC_AHB3Periph_FSMC, ENABLE); + + /*-- FSMC Configuration ------------------------------------------------------*/ + /*----------------------- SRAM Bank 3 ----------------------------------------*/ + /* FSMC_Bank1_NORSRAM3 configuration */ + p.FSMC_AddressSetupTime = 1; + p.FSMC_AddressHoldTime = 0; + p.FSMC_DataSetupTime = getCpuFreq()/14545450 ;// 11; + p.FSMC_BusTurnAroundDuration = 0; + p.FSMC_CLKDivision = 0; + p.FSMC_DataLatency = 0; + p.FSMC_AccessMode = FSMC_AccessMode_A; + /* Color LCD configuration ------------------------------------ + LCD configured as follow: + - Data/Address MUX = Disable + - Memory Type = SRAM + - Data Width = 16bit + - Write Operation = Enable + - Extended Mode = Enable + - Asynchronous Wait = Disable */ + + FSMC_NORSRAMInitStructure.FSMC_Bank = FSMC_Bank1_NORSRAM3; + FSMC_NORSRAMInitStructure.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; + FSMC_NORSRAMInitStructure.FSMC_MemoryType = FSMC_MemoryType_SRAM; + FSMC_NORSRAMInitStructure.FSMC_MemoryDataWidth = FSMC_MemoryDataWidth_16b; + FSMC_NORSRAMInitStructure.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_AsynchronousWait = FSMC_AsynchronousWait_Disable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; + FSMC_NORSRAMInitStructure.FSMC_WrapMode = FSMC_WrapMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; + FSMC_NORSRAMInitStructure.FSMC_WriteOperation = FSMC_WriteOperation_Enable; + FSMC_NORSRAMInitStructure.FSMC_WaitSignal = FSMC_WaitSignal_Disable; + FSMC_NORSRAMInitStructure.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; + FSMC_NORSRAMInitStructure.FSMC_WriteBurst = FSMC_WriteBurst_Disable; + FSMC_NORSRAMInitStructure.FSMC_ReadWriteTimingStruct = &p; + FSMC_NORSRAMInitStructure.FSMC_WriteTimingStruct = &p; + + FSMC_NORSRAMInit(&FSMC_NORSRAMInitStructure); + + /* Enable FSMC NOR/SRAM Bank1 */ + FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE); + gpioset(LCD_RESET); + gpioclr(LCD_CS); + lcd0.init(&lcd0); + return 1; +} + +void bsp_spi_init() +{ + +} + + +void bsp_iic_init() +{ + +} + +void bsp_SD_init() +{ + +} + + +void vs10XXclearXCS(){} +void vs10XXsetXCS(){} +int vs10XXDREQ() +{ + return 1; +} + + +void bsppowersdcard(char onoff) //always ON +{ + +} + +char bspsdcardpresent() +{ + return 0; +} + +char bspsdcardwriteprotected() +{ + return 0; +} + +void bspsdcardselect(char YESNO) +{ + +} + + + +void bsp_lcd0_write_reg(uint32_t reg,uint32_t data) +{ + gpioclr(LCD_CS); + *lcd0_CMD=(uint16_t)reg; + *lcd0_DATA=(uint16_t)data; + gpioset(LCD_CS); +} + +uint32_t bsp_lcd0_read_reg(uint32_t reg) +{ + gpioclr(LCD_CS); + *lcd0_CMD=(uint16_t)reg; + uint32_t data=(uint16_t)*lcd0_DATA; + gpioset(LCD_CS); + return data; +} + +void bsp_lcd0_writeGRAM(void* buffer,uint32_t count) +{ + gpioclr(LCD_CS); + *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM; + uint16_t* castedBuff=(uint16_t*)buffer; + for(int i=0;i<(int)count;i++) + { + *lcd0_DATA=castedBuff[i]; + } + gpioset(LCD_CS); +} + +void bsp_lcd0_readGRAM(void* buffer,uint32_t count) +{ + gpioclr(LCD_CS); + *lcd0_CMD=(uint16_t)ILI9328_REGISTER_WRITEDATATOGRAM; + uint16_t* castedBuff=(uint16_t*)buffer; + castedBuff[0]=*lcd0_DATA; + for(int i=0;i<(int)count;i++) + { + castedBuff[i]=*lcd0_DATA; + } + gpioset(LCD_CS); +} + + diff --git a/bsp/src/STM32F4Discovery-EXT/bsp.h b/bsp/src/STM32F4Discovery-EXT/bsp.h new file mode 100644 --- /dev/null +++ b/bsp/src/STM32F4Discovery-EXT/bsp.h @@ -0,0 +1,108 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the libuc, microcontroler library +-- Copyright (C) 2011, Alexis Jeandet +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +------------------------------------------------------------------------------- +-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@gmail.com +-------------------------------------------------------------------------------*/ +#ifndef BSP_H +#define BSP_H +#include +#include +#include +#include +#include +/* +#ifndef PD12 + #define PD12 +#endif +#ifndef PD13 + #define PD13 +#endif +*/ +#define __MAX_OPENED_FILES__ 32 +#define __FS_ROOT_SIZE__ 32 + +#define LED1 PD12 +#define LED2 PD13 +#define LCD_RESET PD3 +#define LCD_CS PD7 +#define LCD_BACKL PD13 + +#define GREENLEDON (GPIOD->BSRRL = 1<<12) +#define ORANGELEDON (GPIOD->BSRRL = 1<<13) +#define REDLEDON (GPIOD->BSRRL = 1<<14) +#define BLUELEDON (GPIOD->BSRRL = 1<<15) + +#define GREENLEDOFF (GPIOD->BSRRH = 1<<12) +#define ORANGELEDOFF (GPIOD->BSRRH = 1<<13) +#define REDLEDOFF (GPIOD->BSRRH = 1<<14) +#define BLUELEDOFF (GPIOD->BSRRH = 1<<15) + +extern float VREF0; + +extern uint32_t OSC0; +extern uint32_t currentCpuFreq; + + + +extern int bsp_init(); + +extern void bsp_GPIO_init(); +extern void bsp_uart_init(); +extern void bsp_iic_init(); +extern void bsp_spi_init(); +extern void bsp_SD_init(); +extern int bsp_FSMC_init(); + +/* VS1053 */ +extern void clearXCS(); +extern void setXCS(); +extern int vs10XXDREQ(); + +/* SD CARD */ +void bsppowersdcard(char onoff); +char bspsdcardpresent(); +void bspsdcardselect(char YESNO); +char bspsdcardwriteprotected(); + + +void bsp_lcd0_write_reg(uint32_t reg,uint32_t data); +uint32_t bsp_lcd0_read_reg(uint32_t reg); +void bsp_lcd0_writeGRAM(void *buffer, uint32_t count); +void bsp_lcd0_readGRAM(void *buffer, uint32_t count); + +#endif + + + + + + + + + + + + + + + + + + + diff --git a/bsp/src/STM32F4Discovery-EXT/bsp.pri b/bsp/src/STM32F4Discovery-EXT/bsp.pri new file mode 100644 --- /dev/null +++ b/bsp/src/STM32F4Discovery-EXT/bsp.pri @@ -0,0 +1,3 @@ +CPU=stm32f4xxxG +DEFINES+=BSP=\\\"STM32F4Discovery-EXT\\\" +UCMODEL=stm32f4 diff --git a/bsp/src/bsp.pro b/bsp/src/bsp.pro --- a/bsp/src/bsp.pro +++ b/bsp/src/bsp.pro @@ -5,7 +5,8 @@ SUBDIRS += STM32F4Discovery \ M4StickV2 \ SOLAR_LFR_PSU \ BEAGLESYNTH \ - STM32F4Eval + STM32F4Eval \ + STM32F4Discovery-EXT diff --git a/examples/M4StickV2/M4StickV2.pro b/examples/M4StickV2/M4StickV2.pro --- a/examples/M4StickV2/M4StickV2.pro +++ b/examples/M4StickV2/M4StickV2.pro @@ -5,6 +5,9 @@ UCMODEL=stm32f4 BSP=M4StickV2 + +DEFINES += CPUFREQ=80000000 + SOURCES += \ main.c diff --git a/examples/M4StickV2/main.c b/examples/M4StickV2/main.c --- a/examples/M4StickV2/main.c +++ b/examples/M4StickV2/main.c @@ -9,7 +9,8 @@ void ads1278readOut(spi_t spidev,int32_t* data) { gpioset(ADC_FSYNC); - delay_100us(1); + //delay_100us(1); + for(volatile int i=0;i<50;i++); gpioclr(ADC_FSYNC); for(int i=0;i<8;i++) { @@ -23,20 +24,92 @@ void ads1278readOut(spi_t spidev,int32_t void pushData(int32_t* data) { - printf("%d;%d;%d\n\r",(int)data[0],(int)data[1],(int)data[2]); +// printf("%f\t%f\t%f\n",(6.0/(8*1000*1000)) *data[0],(6.0/(8*1000*1000))*data[1],(6.0/(8*1000*1000))*data[2]); + printf("%f\n",(6.0/(16*1000*1000)) *data[0]); + +} + +void pushData2(int32_t* data) +{ + char buffer[29]; + buffer[0] = 0xa5; + buffer[1] = 0x0f; + buffer[2] = 0x00; + buffer[27] = 0xf0; + buffer[28] = 0x5a; + for(int i=0;i<8;i++) + { + buffer[(i*3)+3] = (char)data[i]>>16; + buffer[(i*3)+4] = (char)data[i]>>8; + buffer[(i*3)+5] = (char)data[i]; + } + uartputnc(uart1,buffer,29); } +void sample() +{ + int32_t data[8]; + data[0]=0x712345; + char buffer[2+1+3+2]; + buffer[0] = 0xa5; + buffer[1] = 0x0f; + buffer[2] = 0x00; + buffer[2+1+3] = 0xf0; + buffer[2+1+4] = 0x5a; + while(1) + { + //uartputnc(uart1,buffer,3); + uartputc(uart1,0xa5); + uartputc(uart1,0x0f); + uartputc(uart1,0x01); + uartputc(uart1,25); + for(int i=0;i<8;i++) + { + //ads1278readOut(spi1,data); + uartputc(uart1,(char)0x1);//(data[0])>>16); + uartputc(uart1,(char)0x2);//(data[0]>>8)); + uartputc(uart1,(char)0x3);//(data[0]>>0)); + } + uartputc(uart1,0xf0); + uartputc(uart1,0x5a); + } +} int main() { int32_t data[8]; + char test=0; + for(int i=0;i<500;i++) + { + ads1278readOut(spi1,data); + delay_100us(10); + } + sample(); + //while(1) + //{ + // uartputc(uart1,test++); + //} - while(1) - { - ads1278readOut(spi1,data); - gpioclr(LED2); - delay_100us(1000); - pushData(data); - gpioset(LED2); - } +// while(1) +// { +// ads1278readOut(spi1,data); +// gpioclr(LED2); +// //delay_100us(100); +//// for(volatile int i=0;i<100;i++); +// pushData(data); +// gpioset(LED2); +// //delay_100us(100); +// } } + + + + + + + + + + + + diff --git a/examples/N25Q128_test/main.c b/examples/N25Q128_test/main.c --- a/examples/N25Q128_test/main.c +++ b/examples/N25Q128_test/main.c @@ -36,7 +36,7 @@ void resetHold(int rhstate) int main() { - spiopenandconfig(spi2,spiclkfirstedge|spimaster|spimsbfirst|spi8bits,10000,PB15,PB14,PB13,(uint32_t)NULL); + spiopenandconfig(spi2,spiclkfirstedge|spimaster|spimsbfirst|spi8bits,10000,PB15,PB14,PB13,-1); //spiopenandconfig(spi2,spiclkfirstedge|spimaster|spimsbfirst|spi8bits,10000,PB15,PB14,PB13,PB12); gpio_t PC1pin= gpioopen(PC1); gpiosetdir(&PC1pin,gpiooutdir); diff --git a/examples/examples.pro b/examples/examples.pro --- a/examples/examples.pro +++ b/examples/examples.pro @@ -10,7 +10,8 @@ SUBDIRS += QtTest/test.pro \ lcdTerminal \ BeagleSynthHelloSupMon \ TEST_CMSIS_FFT \ - N25Q128_test + N25Q128_test \ + ssd2119Tests diff --git a/examples/ssd2119Tests/main.c b/examples/ssd2119Tests/main.c new file mode 100644 --- /dev/null +++ b/examples/ssd2119Tests/main.c @@ -0,0 +1,23 @@ +#include +#include +#include +#include +#include + +extern LCD_t lcd0; +extern void ssd2119paintFilCirc_old(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); + +int main(void) +{ + printf("Hello World!\n\r"); + printf("SSD2119 Device Code = 0x%x\n\r",lcd0.interface->readreg(SSD2119_REGISTER_DEVICE_CODE_READ)); + printf("SSD2119 Entry mode = 0x%x\n\r",lcd0.interface->readreg(SSD2119_REGISTER_ENTRY_MODE)); + printf("SSD2119 Display Control = 0x%x\n\r",lcd0.interface->readreg(SSD2119_REGISTER_DISPLAY_CTRL)); + gpioset(LED2); + lcd0.paintFilRect(&lcd0,0,0,lcd0.width,lcd0.height,0xFFFF,0,0xFFFF); + lcd0.paintFilRect(&lcd0,10,10,100,100,0xFFFF,5,0); + lcd0.paintText(&lcd0,"Malik Ta gueule!",50,150,&ComicSansMS_24,0); + ssd2119paintFilCirc_old(&lcd0,160,120,50,0xF0F0,3,0x0F0F); + return 0; +} + diff --git a/examples/ssd2119Tests/ssd2119Tests.pro b/examples/ssd2119Tests/ssd2119Tests.pro new file mode 100644 --- /dev/null +++ b/examples/ssd2119Tests/ssd2119Tests.pro @@ -0,0 +1,11 @@ +TEMPLATE = app +CONFIG += cpu + + +UCMODEL=stm32f4 +DEFINES += CPUFREQ=120000000 + +BSP = STM32F4Discovery-EXT + +SOURCES += \ + main.c diff --git a/lib/src/common/GRAPHIC/CONTROLERS/CONTROLERS.pro b/lib/src/common/GRAPHIC/CONTROLERS/CONTROLERS.pro --- a/lib/src/common/GRAPHIC/CONTROLERS/CONTROLERS.pro +++ b/lib/src/common/GRAPHIC/CONTROLERS/CONTROLERS.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs -SUBDIRS += ILI9328 +SUBDIRS += ILI9328 \ + SSD2119 @@ -7,3 +8,4 @@ SUBDIRS += ILI9328 + diff --git a/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/SSD2119.pro b/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/SSD2119.pro new file mode 100644 --- /dev/null +++ b/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/SSD2119.pro @@ -0,0 +1,4 @@ +TEMPLATE = subdirs +CONFIG += ordered + +SUBDIRS += ./ssd2119_STM32F4.pro diff --git a/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/ssd2119.c b/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/ssd2119.c new file mode 100644 --- /dev/null +++ b/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/ssd2119.c @@ -0,0 +1,416 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the libuc, microcontroler library +-- Copyright (C) 2013, Alexis Jeandet +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +------------------------------------------------------------------------------- +-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@gmail.com +-------------------------------------------------------------------------------*/ +#include +#include +#include +#include +#include + +#ifdef __OPTIMIZED_MATH +#include +#endif + +#define _delay_(del) for(volatile int _d_e_l_=0;_d_e_l_<(del);_d_e_l_++); + +#define ilipaintLine(LCD,X,Y,W,buffer,buffsize) \ + for(int l=0;l<1;l++)\ +{\ + ssd2119setFrame(LCD,X,Y,W,1);\ + int rem=(W)%buffsize;\ + if(rem)LCD->interface->writeGRAM(buffer,rem);\ + for(int i=rem;i<(W);i+=buffsize)\ +{\ + LCD->interface->writeGRAM(buffer,buffsize);\ + }\ + } + +#define ilipaintHLineWithCont(LCD,X,Y,W,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \ + for(int l=0;l<1;l++)\ +{\ + ssd2119setFrame(LCD,X,Y,W,1);\ + int rem=(ContSz)%buffContsize;\ + if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ + for(int i=rem;i<(ContSz);i+=buffContsize)\ +{\ + LCD->interface->writeGRAM(bufferCont,buffContsize);\ + }\ + if((2*ContSz)interface->writeGRAM(bufferInt,rem);\ + for(int i=rem;i<(W-(2*ContSz));i+=buffIntsize)\ +{\ + LCD->interface->writeGRAM(bufferInt,buffIntsize);\ + }\ + }\ + rem=(ContSz)%buffContsize;\ + if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ + for(int i=rem;i<(ContSz);i+=buffContsize)\ +{\ + LCD->interface->writeGRAM(bufferCont,buffContsize);\ + }\ + }\ + + +#define ilipaintVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \ + for(int l=0;l<1;l++)\ +{\ + ssd2119setFrame(LCD,X,Y,1,H);\ + int rem=(ContSz)%buffContsize;\ + if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ + for(int i=rem;i<(ContSz);i+=buffContsize)\ +{\ + LCD->interface->writeGRAM(bufferCont,buffContsize);\ + }\ + if((2*ContSz)interface->writeGRAM(bufferInt,rem);\ + for(int i=rem;i<(H-(2*ContSz));i+=buffIntsize)\ +{\ + LCD->interface->writeGRAM(bufferInt,buffIntsize);\ + }\ + }\ + rem=(ContSz)%buffContsize;\ + if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ + for(int i=rem;i<(ContSz);i+=buffContsize)\ +{\ + LCD->interface->writeGRAM(bufferCont,buffContsize);\ + }\ + }\ + + +#define ilipaintHalfTopVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \ + for(int l=0;l<1;l++)\ +{\ + ssd2119setFrame(LCD,X,Y,1,H);\ + int rem=(ContSz)%buffContsize;\ + if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ + for(int i=rem;i<(ContSz);i+=buffContsize)\ +{\ + LCD->interface->writeGRAM(bufferCont,buffContsize);\ + }\ + if(ContSzinterface->writeGRAM(bufferInt,rem);\ + for(int i=rem;i<(H-ContSz);i+=buffIntsize)\ +{\ + LCD->interface->writeGRAM(bufferInt,buffIntsize);\ + }\ + }\ + }\ + + +#define ilipaintHalfBottomVLineWithCont(LCD,X,Y,H,ContSz,bufferInt,buffIntsize,bufferCont,buffContsize) \ + for(int l=0;l<1;l++)\ +{\ + ssd2119setFrame(LCD,X,Y,1,H);\ + int rem;\ + if(ContSzinterface->writeGRAM(bufferInt,rem);\ + for(int i=rem;i<(H-ContSz);i+=buffIntsize)\ +{\ + LCD->interface->writeGRAM(bufferInt,buffIntsize);\ + }\ + }\ + rem=(ContSz)%buffContsize;\ + if(rem)LCD->interface->writeGRAM(bufferCont,rem);\ + for(int i=rem;i<(ContSz);i+=buffContsize)\ +{\ + LCD->interface->writeGRAM(bufferCont,buffContsize);\ + }\ + }\ + + +void ssd2119setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress) +{ + LCD->interface->writereg(SSD2119_REGISTER_X_RAM_ADDR,Haddress); + LCD->interface->writereg(SSD2119_REGISTER_Y_RAM_ADDR,Vaddress); +} + +void ssd2119refreshenable(struct LCD_t* LCD,int enable) +{ + if(enable) + { + //LCD->interface->writereg(ssd2119_REGISTER_ENTRYMODE,0x1018); + } + else + { + //LCD->interface->writereg(ssd2119_REGISTER_ENTRYMODE,0x1008); + + } +} + +void ssd2119setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H) +{ + LCD->interface->writereg(SSD2119_REGISTER_X_RAM_ADDR,(uint32_t)X); + LCD->interface->writereg(SSD2119_REGISTER_Y_RAM_ADDR,(uint32_t)Y); + LCD->interface->writereg(SSD2119_REGISTER_H_RAM_START,(uint32_t)X); + LCD->interface->writereg(SSD2119_REGISTER_H_RAM_END,(uint32_t)(W+X-1)); + LCD->interface->writereg(SSD2119_REGISTER_V_RAM_POS,(((uint32_t)(Y+H-1))<<8) + (uint32_t)Y); +} + +void ssd2119paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height) +{ + if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writeGRAM!=NULL) && (LCD->width>(Xpos+Width)) && (LCD->height>(Ypos+Height))) + { + ssd2119setFrame(LCD,Xpos,Ypos,Width,Height); + LCD->interface->writeGRAM(buffer,Width*Height); + } +} + +void ssd2119paintFilCirc(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor) +{ + //Based on the mid point circle algorithm from Wikipedia + //http://en.wikipedia.org/wiki/Midpoint_circle_algorithm + uint16_t innerbuffer[16]; + uint16_t outterbuffer[16]; + for(int i=0;i<16;i++)innerbuffer[i]=fillColor; + for(int i=0;i<16;i++)outterbuffer[i]=contColor; + if(contSz= y) + { + ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos+y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16); + ilipaintHLineWithCont(LCD,(Xpos-x),(Ypos-y),(2*x),(x-x_int),innerbuffer,16,outterbuffer,16); + ilipaintHalfTopVLineWithCont(LCD,(Xpos+y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16); + ilipaintHalfTopVLineWithCont(LCD,(Xpos-y),(Ypos-x),(x),(x-x_int),innerbuffer,16,outterbuffer,16); + ilipaintHalfBottomVLineWithCont(LCD,(Xpos-y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16); + ilipaintHalfBottomVLineWithCont(LCD,(Xpos+y),(Ypos),(x),(x-x_int),innerbuffer,16,outterbuffer,16); + error += y; + ++y; + error += y; + error_int += y_int; + ++y_int; + error_int += y_int; + if(error >= 0) + { + error -= x; + --x; + error -= x; + } + if(error_int >= 0) + { + error_int -= x_int; + --x_int; + error_int -= x_int; + } + } + + + + } + +} + +void ssd2119paintFilCirc_old(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor) +{ + if(contSzinterface->writeGRAM(outterbuffer,rem); + for(int i=rem;i<(contSz2);i+=16) + { + LCD->interface->writeGRAM(outterbuffer,16); + } + + W=2*Val1; + if(W>(2*contSz2)) + { + W-=2*contSz2; + rem=(W)%16; + if(rem)LCD->interface->writeGRAM(innerbuffer,rem); + for(int i=rem;i<(W);i+=16) + { + LCD->interface->writeGRAM(innerbuffer,16); + } + } + + rem=(contSz2)%16; + if(rem)LCD->interface->writeGRAM(outterbuffer,rem); + for(int i=rem;i<(contSz2);i+=16) + { + LCD->interface->writeGRAM(outterbuffer,16); + } + } + } +} + + + + +void ssd2119paintFilRect(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h,uint32_t contColor,uint16_t contSz,uint32_t fillColor) +{ + ssd2119setFrame(LCD,Xpos,Ypos,w,h); + uint16_t tmp[32]; + for(int i=0;i<32;i++)tmp[i]=fillColor; + for(int i=0;i<(h*w);i+=32) + { + LCD->interface->writeGRAM(tmp,32); + } + int rem=(w*h)%32; + if(rem)LCD->interface->writeGRAM(tmp,rem); + if(contSz) + { + ssd2119setFrame(LCD,Xpos,Ypos,w,contSz); + for(int i=0;i<32;i++)tmp[i]=contColor; + rem=(w*contSz)%32; + if(rem)LCD->interface->writeGRAM(tmp,rem); + for(int i=rem;i<(w*contSz);i+=32) + { + LCD->interface->writeGRAM(tmp,32); + } + + ssd2119setFrame(LCD,Xpos,Ypos+h-contSz,w,contSz); + rem=(w*contSz)%32; + if(rem)LCD->interface->writeGRAM(tmp,rem); + for(int i=rem;i<(w*contSz);i+=32) + { + LCD->interface->writeGRAM(tmp,32); + } + + ssd2119setFrame(LCD,Xpos,Ypos,contSz,h); + rem=(h*contSz)%32; + if(rem)LCD->interface->writeGRAM(tmp,rem); + for(int i=rem;i<(h*contSz);i+=32) + { + LCD->interface->writeGRAM(tmp,32); + } + + ssd2119setFrame(LCD,Xpos+w-contSz,Ypos,contSz,h); + rem=(h*contSz)%32; + if(rem)LCD->interface->writeGRAM(tmp,rem); + for(int i=rem;i<(h*contSz);i+=32) + { + LCD->interface->writeGRAM(tmp,32); + } + } +} + +void ssd2119paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color) +{ + int w=font->Width,h=font->Height,bpl=font->bytesPerLine,pix=0,tableoffset=0; + uint16_t tmp[w]; + uint16_t linenum=0,charnum=0; + uint8_t line=0; + while(*buffer!='\0') + { + ssd2119setFrame(LCD,Xpos+(charnum*w),Ypos-h,w,1); + LCD->interface->readGRAM(tmp,w); + for(int i=0;i<(h*w);i++) + { + if( ((i%w)==0) ) //read current line to apply text pixmap + { + if(linenum++>0) + { + ssd2119setFrame(LCD,Xpos+(charnum*(w-10)),Ypos + linenum -h,w,1); // TODO remove -10 and generate good fonts! + LCD->interface->writeGRAM(tmp,w); + ssd2119setFrame(LCD,Xpos+(charnum*(w-10)),Ypos + linenum + 1-h,w,1); + LCD->interface->readGRAM(tmp,w); + pix=0; + } + } + if((pix%8) == 0) + { + line=font->table[(((*buffer)-32)*h*bpl)+tableoffset++]; + } + if((line & (uint8_t)0x01)==(uint8_t)1)tmp[pix]=(uint16_t)color; + pix++; + line>>=1; + } + linenum=0; + tableoffset=0; + charnum++; + buffer++; + } +} + + +int ssd2119init(struct LCD_t* LCD) +{ + if((LCD!=NULL) && (LCD->interface!=NULL) && (LCD->interface->writereg!=NULL)) + { + LCD->interface->writereg(0x28,0x0006); // VCOM OTP - Page 55-56 of SSD2119 datasheet + LCD->interface->writereg(0x00,0x0001); // start Oscillator - Page 36 of SSD2119 datasheet + LCD->interface->writereg(0x10,0x0000); // Sleep mode - Page 49 of SSD2119 datasheet + LCD->interface->writereg(0x01,0x72ef); // Driver Output Control - Page 36-39 of SSD2119 datasheet + LCD->interface->writereg(0x02,0x0600); // LCD Driving Waveform Control - Page 40-42 of SSD2119 datasheet + LCD->interface->writereg(0x03,0x6a38); // Power Control 1 - Page 43-44 of SSD2119 datasheet + LCD->interface->writereg(0x11,0x6870); // Entry Mode - Page 50-52 of SSD2119 datasheet + + // RAM WRITE DATA MASK + LCD->interface->writereg(0x0f,0x0000); // Gate Scan Position - Page 49 of SSD2119 datasheet + // RAM WRITE DATA MASK + LCD->interface->writereg(0x0b,0x5308); // Frame Cycle Control - Page 45 of SSD2119 datasheet + LCD->interface->writereg(0x0c,0x0003); // Power Control 2 - Page 47 of SSD2119 datasheet + LCD->interface->writereg(0x0d,0x000a); // Power Control 3 - Page 48 of SSD2119 datasheet + LCD->interface->writereg(0x0e,0x2e00); // Power Control 4 - Page 48 of SSD2119 datasheet + LCD->interface->writereg(0x1e,0x00be); // Power Control 5 - Page 53 of SSD2119 datasheet + LCD->interface->writereg(0x25,0x8000); // Frame Frequency Control - Page 53 of SSD2119 datasheet + LCD->interface->writereg(0x26,0x7800); // Analog setting - Page 54 of SSD2119 datasheet + LCD->interface->writereg(0x4e,0x0000); // Ram Address Set - Page 58 of SSD2119 datasheet + LCD->interface->writereg(0x4f,0x0000); // Ram Address Set - Page 58 of SSD2119 datasheet + LCD->interface->writereg(0x12,0x08d9); // Sleep mode - Page 49 of SSD2119 datasheet + + // -----------------Adjust the Gamma Curve----// + LCD->interface->writereg(0x30,0x0000); //0007 + LCD->interface->writereg(0x31,0x0104); //0203 + LCD->interface->writereg(0x32,0x0100); //0001 + LCD->interface->writereg(0x33,0x0305); //0007 + LCD->interface->writereg(0x34,0x0505); //0007 + LCD->interface->writereg(0x35,0x0305); //0407 + LCD->interface->writereg(0x36,0x0707); //0407 + LCD->interface->writereg(0x37,0x0300); //0607 + LCD->interface->writereg(0x3a,0x1200); //0106 + LCD->interface->writereg(0x3b,0x0800); + LCD->interface->writereg(0x07,0x0033); // Display Control - Page 45 of SSD2119 datasheet + } + return 0; +} + + + + diff --git a/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/ssd2119_STM32F4.pro b/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/ssd2119_STM32F4.pro new file mode 100644 --- /dev/null +++ b/lib/src/common/GRAPHIC/CONTROLERS/SSD2119/ssd2119_STM32F4.pro @@ -0,0 +1,22 @@ +TEMPLATE = lib +OBJECTS_DIR = obj +TARGET = ssd2119 + +SOURCES += \ + ssd2119.c + +DEFINES -= __OPTIMIZED_MATH + +INCLUDEPATH += ../../../../includes \ + ../../../CPU/STM32F4xx_StdPeriph_Driver/inc \ + ../../../CPU/CMSIS/Include \ + ../../../../includes/GRAPHIC/CONTROLERS \ + ../../../../includes/GRAPHIC/GUI/FONTS \ + ../../../../includes/GRAPHIC/GUI/Widgets + + +UCMODEL=stm32f4 + +target.path = $$[QT_INSTALL_LIBS]/$$UCMODEL +INSTALLS += target + diff --git a/lib/src/includes/GRAPHIC/CONTROLERS/ssd2119.h b/lib/src/includes/GRAPHIC/CONTROLERS/ssd2119.h new file mode 100644 --- /dev/null +++ b/lib/src/includes/GRAPHIC/CONTROLERS/ssd2119.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the libuc, microcontroler library +-- Copyright (C) 2013, Alexis Jeandet +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +------------------------------------------------------------------------------- +-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@gmail.com +-------------------------------------------------------------------------------*/ +#ifndef SSD2119_H +#define SSD2119_H + +#include +#include +#include +#include + +extern int ssd2119init(struct LCD_t* LCD); +extern void ssd2119setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H); +extern void ssd2119setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress); +extern void ssd2119paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height); +extern void ssd2119paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT *font,uint32_t color); +extern void ssd2119paintFilRect(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h,uint32_t contColor,uint16_t contSz,uint32_t fillColor); +extern void ssd2119paintFilCirc(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); +extern void ssd2119paintFilCircMidPoint(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); +extern void ssd2119refreshenable(struct LCD_t* LCD,int enable); + +/* SSD2119 registers */ + + #define SSD2119_REGISTER_DEVICE_CODE_READ ((uint32_t)0x00) + #define SSD2119_REGISTER_OSC_START ((uint32_t)0x00) + #define SSD2119_REGISTER_OUTPUT_CTRL ((uint32_t)0x01) + #define SSD2119_REGISTER_LCD_DRIVE_AC_CTRL ((uint32_t)0x02) + #define SSD2119_REGISTER_PWR_CTRL_1 ((uint32_t)0x03) + #define SSD2119_REGISTER_DISPLAY_CTRL ((uint32_t)0x07) + #define SSD2119_REGISTER_FRAME_CYCLE_CTRL ((uint32_t)0x0B) + #define SSD2119_REGISTER_PWR_CTRL_2 ((uint32_t)0x0C) + #define SSD2119_REGISTER_PWR_CTRL_3 ((uint32_t)0x0D) + #define SSD2119_REGISTER_PWR_CTRL_4 ((uint32_t)0x0E) + #define SSD2119_REGISTER_GATE_SCAN_START ((uint32_t)0x0F) + #define SSD2119_REGISTER_SLEEP_MODE_1 ((uint32_t)0x10) + #define SSD2119_REGISTER_ENTRY_MODE ((uint32_t)0x11) + #define SSD2119_REGISTER_SLEEP_MODE_2 ((uint32_t)0x12) + #define SSD2119_REGISTER_GEN_IF_CTRL ((uint32_t)0x15) + #define SSD2119_REGISTER_H_PORCH ((uint32_t)0x16) + #define SSD2119_REGISTER_V_PORCH ((uint32_t)0x17) + #define SSD2119_REGISTER_PWR_CTRL_5 ((uint32_t)0x1E) + #define SSD2119_REGISTER_UNIFORMITY ((uint32_t)0x20) + #define SSD2119_REGISTER_RAM_DATA ((uint32_t)0x22) + #define SSD2119_REGISTER_FRAME_FREQ ((uint32_t)0x25) + #define SSD2119_REGISTER_ANALOG_SET ((uint32_t)0x26) + #define SSD2119_REGISTER_VCOM_OTP_1 ((uint32_t)0x28) + #define SSD2119_REGISTER_VCOM_OTP_2 ((uint32_t)0x29) + #define SSD2119_REGISTER_GAMMA_CTRL_1 ((uint32_t)0x30) + #define SSD2119_REGISTER_GAMMA_CTRL_2 ((uint32_t)0x31) + #define SSD2119_REGISTER_GAMMA_CTRL_3 ((uint32_t)0x32) + #define SSD2119_REGISTER_GAMMA_CTRL_4 ((uint32_t)0x33) + #define SSD2119_REGISTER_GAMMA_CTRL_5 ((uint32_t)0x34) + #define SSD2119_REGISTER_GAMMA_CTRL_6 ((uint32_t)0x35) + #define SSD2119_REGISTER_GAMMA_CTRL_7 ((uint32_t)0x36) + #define SSD2119_REGISTER_GAMMA_CTRL_8 ((uint32_t)0x37) + #define SSD2119_REGISTER_GAMMA_CTRL_9 ((uint32_t)0x3A) + #define SSD2119_REGISTER_GAMMA_CTRL_10 ((uint32_t)0x3B) + #define SSD2119_REGISTER_V_SCROLL_1 ((uint32_t)0x41) + #define SSD2119_REGISTER_V_SCROLL_2 ((uint32_t)0x42) + #define SSD2119_REGISTER_V_RAM_POS ((uint32_t)0x44) + #define SSD2119_REGISTER_H_RAM_START ((uint32_t)0x45) + #define SSD2119_REGISTER_H_RAM_END ((uint32_t)0x46) + #define SSD2119_REGISTER_1_DRV_POS_1 ((uint32_t)0x48) + #define SSD2119_REGISTER_1_DRV_POS_2 ((uint32_t)0x49) + #define SSD2119_REGISTER_2_DRV_POS_1 ((uint32_t)0x4A) + #define SSD2119_REGISTER_2_DRV_POS_2 ((uint32_t)0x4B) + #define SSD2119_REGISTER_X_RAM_ADDR ((uint32_t)0x4E) + #define SSD2119_REGISTER_Y_RAM_ADDR ((uint32_t)0x4F) + +#endif + + + + + diff --git a/mkspecs/common/libuc2libs.conf b/mkspecs/common/libuc2libs.conf --- a/mkspecs/common/libuc2libs.conf +++ b/mkspecs/common/libuc2libs.conf @@ -7,7 +7,7 @@ INCLUDEPATH += $$[QT_INSTALL_HEADERS] \ $$[QT_INSTALL_HEADERS]/$$ARCH -LIBS += -L$$[QT_INSTALL_LIBS]/$$ARCH -lterminal -lCS43L22 -lina226 -lili9328 -lSTMPE811 -lfonts -lsdcard -lfat32 -lmbr -luart -li2c -lgpio -lspi -lcpu -lcore -lm +LIBS += -L$$[QT_INSTALL_LIBS]/$$ARCH -lterminal -lCS43L22 -lina226 -lili9328 -lssd2119 -lSTMPE811 -lfonts -lsdcard -lfat32 -lmbr -luart -li2c -lgpio -lspi -lcpu -lcore -lm diff --git a/mkspecs/stm32f4/qmake.conf b/mkspecs/stm32f4/qmake.conf --- a/mkspecs/stm32f4/qmake.conf +++ b/mkspecs/stm32f4/qmake.conf @@ -45,7 +45,9 @@ contains( TEMPLATE, app ) { stflash.target = stflash stflash.commands = cd $$DESTDIR && sudo st-flash write $(QMAKE_TARGET).bin 0x08000000 - QMAKE_EXTRA_TARGETS += stflash + dfu.target = dfu + dfu.commands = cd $$DESTDIR && sudo dfu-util d 0483:df11 -c 1 -i 0 -a 0 -s 0x08000000 -D $(QMAKE_TARGET).bin 0x08000000 + QMAKE_EXTRA_TARGETS += stflash dfu } contains( TEMPLATE, lib ) {