mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
ili9341: Add simple test application
This commit is contained in:
parent
ef4dcb8eec
commit
9c520fd793
15
tests/driver_ili9341/Makefile
Normal file
15
tests/driver_ili9341/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
BOARD ?= stm32f429i-disc1
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += ili9341
|
||||
USEMODULE += xtimer
|
||||
|
||||
CFLAGS += -DILI9341_LE_MODE
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
# The AVR architecture stores the image in the RAM, this usually doesn't fit.
|
||||
# This flag excludes the image from the test
|
||||
ifneq (,$(filter arch_avr8,$(FEATURES_USED)))
|
||||
CFLAGS += -DNO_RIOT_IMAGE
|
||||
endif
|
3
tests/driver_ili9341/Makefile.ci
Normal file
3
tests/driver_ili9341/Makefile.ci
Normal file
@ -0,0 +1,3 @@
|
||||
BOARD_INSUFFICIENT_MEMORY := \
|
||||
stm32f030f4-demo \
|
||||
#
|
79
tests/driver_ili9341/main.c
Normal file
79
tests/driver_ili9341/main.c
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Koen Zandberg <koen@bergzand.net>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup tests
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Test application for the ili9431 tft display
|
||||
*
|
||||
* @author Koen Zandberg <koen@bergzand.net>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "xtimer.h"
|
||||
#include "ili9341.h"
|
||||
#include "ili9341_params.h"
|
||||
|
||||
#include "riot_logo.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
ili9341_t dev;
|
||||
|
||||
puts("ili9341 TFT display test application");
|
||||
|
||||
/* initialize the sensor */
|
||||
printf("Initializing display...");
|
||||
|
||||
if (ili9341_init(&dev, &ili9341_params[0]) == 0) {
|
||||
puts("[OK]");
|
||||
}
|
||||
else {
|
||||
puts("[Failed]");
|
||||
return 1;
|
||||
}
|
||||
|
||||
puts("ili9341 TFT display filling map");
|
||||
ili9341_fill(&dev, 0, 319, 0, 239, 0x0000);
|
||||
puts("ili9341 TFT display map filled");
|
||||
|
||||
/* Fill square with blue */
|
||||
puts("Drawing blue rectangle");
|
||||
ili9341_fill(&dev, 10, 59, 10, 109, 0x001F);
|
||||
xtimer_sleep(1);
|
||||
|
||||
puts("Drawing green rectangle");
|
||||
ili9341_fill(&dev, 10, 59, 10, 109, 0x07E0);
|
||||
xtimer_sleep(1);
|
||||
|
||||
puts("Drawing red rectangle");
|
||||
ili9341_fill(&dev, 10, 59, 10, 109, 0xf800);
|
||||
xtimer_sleep(1);
|
||||
|
||||
ili9341_invert_on(&dev);
|
||||
puts("ili9341 TFT display inverted");
|
||||
xtimer_sleep(1);
|
||||
ili9341_invert_off(&dev);
|
||||
puts("ili9341 TFT display normal");
|
||||
|
||||
/* Make the same square black again */
|
||||
ili9341_fill(&dev, 10, 59, 10, 109, 0x0000);
|
||||
|
||||
#ifndef NO_RIOT_IMAGE
|
||||
/* Approximate middle of the display */
|
||||
ili9341_pixmap(&dev, 95, 222, 85, 153, (const uint16_t *)picture);
|
||||
#endif
|
||||
while (1) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
1058
tests/driver_ili9341/riot_logo.h
Normal file
1058
tests/driver_ili9341/riot_logo.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user