1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

tests/pkg_ucglib: updated tests

This commit is contained in:
Bas Stottelaar 2020-01-12 18:24:33 +01:00
parent 7d73e8acaf
commit 35920a205e
2 changed files with 16 additions and 29 deletions

View File

@ -9,9 +9,9 @@ TEST_OUTPUT ?= 1
TEST_SPI ?= 0
TEST_PIN_CS ?= GPIO_PIN\(0,0\)
TEST_PIN_CD ?= GPIO_PIN\(0,0\)
TEST_PIN_RESET ?= GPIO_PIN\(0,0\)
TEST_PIN_CS ?= GPIO_UNDEF
TEST_PIN_CD ?= GPIO_UNDEF
TEST_PIN_RESET ?= GPIO_UNDEF
ifeq ($(TEST_OUTPUT),3)
TEST_DISPLAY ?= ucg_dev_ssd1331_18x96x64_univision

View File

@ -55,32 +55,12 @@
#endif
#include "xtimer.h"
#include "ucg.h"
#include "ucg_riotos.h"
#include "logo.h"
#if TEST_OUTPUT == TEST_OUTPUT_SPI
/**
* @brief RIOT-OS pin mapping of Ucglib pin numbers to RIOT-OS GPIO pins.
* @note To minimize the overhead, you can implement an alternative for
* ucg_com_riotos_hw_spi.
*/
static gpio_t pins[] = {
[UCG_PIN_CS] = TEST_PIN_CS,
[UCG_PIN_CD] = TEST_PIN_CD,
[UCG_PIN_RST] = TEST_PIN_RESET
};
/**
* @brief Bit mapping to indicate which pins are set.
*/
static uint32_t pins_enabled = (
(1 << UCG_PIN_CS) +
(1 << UCG_PIN_CD) +
(1 << UCG_PIN_RST)
);
#endif
int main(void)
{
uint32_t screen = 0;
@ -90,7 +70,7 @@ int main(void)
/* initialize dummy output */
puts("Initializing dummy output.");
ucg_Init(&ucg, ucg_dev_dummy_cb, ucg_ext_none, NULL);
ucg_Init(&ucg, ucg_dev_dummy_riotos, ucg_ext_none, NULL);
#endif
#if TEST_OUTPUT == TEST_OUTPUT_SDL
@ -104,10 +84,17 @@ int main(void)
/* initialize to SPI */
puts("Initializing to SPI.");
ucg_SetPins(&ucg, pins, pins_enabled);
ucg_SetDevice(&ucg, SPI_DEV(TEST_SPI));
ucg_riotos_t user_data =
{
.device_index = TEST_SPI,
.pin_cs = TEST_PIN_CS,
.pin_cd = TEST_PIN_CD,
.pin_reset = TEST_PIN_RESET,
};
ucg_Init(&ucg, TEST_DISPLAY, TEST_DISPLAY_EXT, ucg_com_riotos_hw_spi);
ucg_SetUserPtr(&ucg, &user_data);
ucg_Init(&ucg, TEST_DISPLAY, TEST_DISPLAY_EXT, ucg_com_hw_spi_riotos);
#endif
/* initialize the display */