Esempio n. 1
0
void screen8() {
	startTime = millis();
	tft.fillScreen(ST7735_BLACK);
	testfillcircles(10, ST7735_BLUE);
	testdrawcircles(10, ST7735_WHITE);
	debugf("screen8: testfillcircles %d ms", millis() - startTime);
	DemoScreenTimer.initializeMs(1000, screen9).start(FALSE);
}
Esempio n. 2
0
void setup(void) {
    Serial.begin(BAUD);
    Serial.print("Hello! professorbunsen, I presume? ");

    // Use this initializer if you're using a 1.8" TFT
    //tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab

    // Use this initializer (uncomment) if you're using a 1.44" TFT
    tft.initR(INITR_144GREENTAB);   // initialize a ST7735S chip, black tab

    Serial.println("Initialized");

    uint16_t time = millis();
    tft.fillScreen(ST7735_BLACK);
    time = millis() - time;

    Serial.println(time, DEC);
    delay(500);

    // large block of text
    tft.fillScreen(ST7735_BLACK);
    testdrawtext("Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem ungeheueren Ungeziefer verwandelt. Er lag auf seinem panzerartig harten Rücken und sah, wenn er den Kopf ein wenig hob, seinen gewölbten, braunen, von bogenförmigen Versteifungen geteilten Bauch, auf dessen Höhe sich die Bettdecke, zum gänzlichen Niedergleiten bereit, kaum noch erhalten konnte. Seine vielen, im Vergleich zu seinem sonstigen Umfang kläglich dünnen Beine flimmerten ihm hilflos vor den Augen. Was ist mit mir geschehen? dachte er. Es war kein Traum.", ST7735_WHITE);
    delay(1000);

    // tft print function!
    tftPrintTest();
    delay(4000);

    // a single pixel
    tft.drawPixel(tft.width()/2, tft.height()/2, ST7735_GREEN);
    delay(500);

    // line draw test
    testlines(ST7735_YELLOW);
    delay(500);

    // optimized lines
    testfastlines(ST7735_RED, ST7735_BLUE);
    delay(500);

    testdrawrects(ST7735_GREEN);
    delay(500);

    testfillrects(ST7735_YELLOW, ST7735_MAGENTA);
    delay(500);

    tft.fillScreen(ST7735_BLACK);
    testfillcircles(10, ST7735_BLUE);
    testdrawcircles(10, ST7735_WHITE);
    delay(500);

    testroundrects();
    delay(500);

    testtriangles();
    delay(500);

    mediabuttons();
    delay(500);

    Serial.println("done");
    delay(1000);
}
Esempio n. 3
0
/**
* @brief  Main program.
* @param  None
* @retval None
*/
int main(void)
{
    uint8_t currentLED=0,idx;
    uint16_t xx,yy;
    uint16_t testWord; 
    uint8_t shifter=0;

  /* Initialize LEDs on STM32F4-Discovery --------------------*/

    __IO uint32_t i = 0;  
    uint8_t buf[255];
    uint8_t len;
    STM_EVAL_LEDInit(LED4);
    STM_EVAL_LEDInit(LED3);
    // You can use these for LEDs if you use the upper 8 bits of the 16b FSMC bus to talk to the ILI9238.
    // STM_EVAL_LEDInit(LED5); //GPIOD 14 -> FSMC D0. Do not use for LED, we need them to talk to the ILI9238
    // STM_EVAL_LEDInit(LED6); //GPIOD 14 -> FSMC D1.

   

    // flash the LEDs in a circle to test delayMillis(uint32_t timedelay)

     STM_EVAL_LEDToggle(currentLED);

    for (idx=0;idx<8;idx++)
    {
        STM_EVAL_LEDToggle(currentLED);
        currentLED=(currentLED+1)%2;
        STM_EVAL_LEDToggle(currentLED);
        delayMillis(250);
    }
    // 
    // USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb);

    // init the printf
    init_printf(0,tft_putc);
    // init_tft_printf(NULL,tft_putc);

    // Get the 32F4 ready to talk to the TFTLCD using FSMC
    initGPIO();
    initFSMC();
    uDelay(1000); // probably don't need this
    reset();
    initDisplay();

    // ** Do the adafruit Demo **
    // fillScreen(BLACK);
    //     setCursor(0, 0);
    //     setTextColor(CYAN);
    //     setTextSize(1);
    //     setRotation(1); 
    //     tft_printf("Please connect to virtual COM port...");
    delayMillis(2000);
    testlines(CYAN);
    delayMillis(2500);
    testfastlines(RED, BLUE);
    delayMillis(2500);
    testdrawrects(GREEN);
    delayMillis(2500);
    testfillrects(YELLOW, MAGENTA);
    delayMillis(2500);
    fillScreen(BLACK);
    testfillcircles(10, MAGENTA);
    testdrawcircles(10, WHITE);
    delayMillis(2500); 
    testtriangles();
    delayMillis(2500); 
    testfilltriangles();
    delayMillis(2500); 
    testRoundRect();
    delayMillis(2500); 
    testFillRoundRect();
    delayMillis(2500); 
    fillScreen(GREEN);
    delayMillis(2500); 
    
    
    // fsmcData        =  0x60020000; // sets a16
    // fsmcRegister    =  0x60000000; // clears a16
    // printf("fsmcData:\t0x%08X\r\n",fsmcData);
    // printf("fsmcRegister:\t0x%08X\r\n",fsmcRegister);

    // fillScreen(BLACK);
    // setCursor(0, 20);
    // setTextColor(color);
    // setTextSize(1);
    // write("Hello World!");
    // setTextSize(2);
    // write(1234.56);
    // setTextSize(3);
    // 
    // println(0xDEADBEEF, HEX);


    // printf("0xFF00>>8 0x%04X\r\n",0xff00>>8);
    // VCP_send_str(&buf[0]);
    // printf("SysTick_Config(SystemCoreClock/1000)\t %d\r\n",SysTick_Config(SystemCoreClock/1000));
    // millisecondCounter=0;
    // for (idx=0;idx<100;idx++)
    // {
    //     printf("millisecondCounter:\t%d",millisecondCounter);
    // }
    // void delayMillis(uint32_t millis) 
    //     {
    //         uint32_t target;
    // 
    //         target=millisecondCounter+millis;
    //         while(millisecondCounter<target);
    //     }

   
    // From stm32f4_discovery.h:
    // typedef enum 
    // {
    // LED4 = 0,
    // LED3 = 1,
    // LED5 = 2,
    // LED6 = 3
    // } Led_TypeDef;
    while(1)
    {
        for (idx=0;idx<8;idx++)
        {
            setRotation(idx%4); 
            testtext(RED);
            delayMillis(1500); 
        }

    }

}