1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/ucglib/contrib/ucg_riotos.h
Bas Stottelaar 7d73e8acaf pkg/ucglib: refactor the Ucglib package
- Passing RIOT-OS specific data as user_ptr
- Added necessary macros to Makefile.dep
- Added missing explicit dependency to xtimer module
- Added ucg_riotos.h with the RIOT-OS specific functionality
- Removed the now-obsolete patch of Ucglib
- Other minor fixes
2020-06-17 00:47:54 +02:00

66 lines
1.7 KiB
C

/*
* Copyright (C) 2020 Bas Stottelaar <basstottelaar@gmail.com>
*
* 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 pkg_ucglib
* @{
*
* @file
* @brief Ucglib driver for interacting with RIOT-OS peripherals
*
* @author Bas Stottelaar <basstottelaar@gmail.com>
*
* @}
*/
#ifndef UCG_RIOTOS_H
#define UCG_RIOTOS_H
#include "ucg.h"
#include "periph/gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Holds RIOT-OS specific peripheral data.
*
* This structure has to be set via the Ucglib function @p ucg_SetUserPtr,
* prior to the call to @p ucg_Init.
*
* The structure can be easily extended with further required definitions (e.g
* other pins) if necessary, without breaking the RIOT-OS adaptation of Ucglib.
*/
typedef struct {
void *user_ptr; /**< Pointer to optionally store any additional user-data */
unsigned int device_index; /**< Index of the SPI device */
gpio_t pin_cs; /**< Pin for SPI CS, GPIO_UNDEF if not used */
gpio_t pin_cd; /**< Pin for SPI CD, GPIO_UNDEF if not used */
gpio_t pin_reset; /**< Pin for RESET, GPIO_UNDEF if not used */
} ucg_riotos_t;
/**
* To be used as the u8x8_msg_cb as gpio_and_delay_cb in u8x8_Setup() for use with RIOT-OS
*/
int16_t ucg_com_hw_spi_riotos(ucg_t *ucg, int16_t msg, uint16_t arg, uint8_t *data);
/**
* To be used as the u8x8_msg_cb as gpio_and_delay_cb in u8x8_Setup() for use with RIOT-OS.
*/
ucg_int_t ucg_dev_dummy_riotos(ucg_t *ucg, ucg_int_t msg, void *data);
#ifdef __cplusplus
}
#endif
#endif /* UCG_RIOTOS_H */