Skip to content

Commit

Permalink
Add Raspberry Pi example config
Browse files Browse the repository at this point in the history
  • Loading branch information
ImpulseAdventure committed Jan 12, 2019
1 parent ae5d676 commit da7cd36
Showing 1 changed file with 199 additions and 0 deletions.
199 changes: 199 additions & 0 deletions configs/rpi-sdl1-default-tslib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
#ifndef _GUISLICE_CONFIG_LINUX_H_
#define _GUISLICE_CONFIG_LINUX_H_

// =============================================================================
// GUIslice library (example user configuration #???) for:
// - CPU: Raspberry Pi
// - Display: PiTFT
// - Touch: tslib
// - Wiring: None
//
// DIRECTIONS:
// - To use this example configuration, include in "GUIslice_config.h"
//
// WIRING:
// - None
//
// =============================================================================
// - Calvin Hass
// - https://github.com/ImpulseAdventure/GUIslice
// =============================================================================
//
// The MIT License
//
// Copyright 2018 Calvin Hass
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// =============================================================================
// \file GUIslice_config_linux.h

// =============================================================================
// User Configuration
// - This file can be modified by the user to match the
// intended target configuration
// =============================================================================

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus


// =============================================================================
// USER DEFINED CONFIGURATION
// =============================================================================

// -----------------------------------------------------------------------------
// Device Mode Selection
// - The following defines the display and touch drivers
// and should not require modifications for this example config
// -----------------------------------------------------------------------------
#define DRV_DISP_SDL1 // LINUX SDL 1.2
#define DRV_TOUCH_TSLIB // LINUX: Use tslib touch driver

// -----------------------------------------------------------------------------
// Pinout
// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// Orientation
// -----------------------------------------------------------------------------

// Set Default rotation of the display
// - Values 0,1,2,3. Rotation is clockwise
// - Note that changing this value may require a change
// to GSLC_TOUCH_ROTATE as well to ensure the touch screen
// orientation matches the display.
// NOTE: The GSLC_ROTATE feature is not yet supported in SDL mode
// however, the following settings are provided for future use.
#define GSLC_ROTATE 1

// Set Default rotation of the touch overlay
// - Values 0,1,2,3. Rotation is clockwise
#define GSLC_TOUCH_ROTATE 1

// -----------------------------------------------------------------------------
// Touch Handling
// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// Diagnostics
// -----------------------------------------------------------------------------

// Error reporting
// - Set DEBUG_ERR to 1 to enable error reporting via the Serial connection
// - Enabling DEBUG_ERR increases FLASH memory consumption which may be
// limited on the baseline Arduino (ATmega328P) devices.
// - For baseline Arduino UNO, recommended to disable this after one has
// confirmed basic operation of the library is successful.
#define DEBUG_ERR 1 // 1 to enable, 0 to disable

// -----------------------------------------------------------------------------
// Optional Features
// -----------------------------------------------------------------------------

// Enable of optional features
// - For memory constrained devices such as Arduino, it is best to
// set the following features to 0 (to disable) unless they are
// required.
#define GSLC_FEATURE_COMPOUND 1 // Compound elements (eg. XSelNum)
#define GSLC_FEATURE_XGAUGE_RADIAL 1 // XGauge control with radial support
#define GSLC_FEATURE_XGAUGE_RAMP 1 // XGauge control with ramp support
#define GSLC_FEATURE_XTEXTBOX_EMBED 0 // XTextbox control with embedded color
#define GSLC_FEATURE_INPUT 1 // Keyboard / GPIO input control


// =============================================================================
// INTERNAL CONFIGURATION
// - The following settings should not require modification by users
// =============================================================================

// -----------------------------------------------------------------------------
// Touch Handling
// -----------------------------------------------------------------------------

// Define how touch orientation changes with display orientation
#define TOUCH_ROTATION_DATA 0x6350
#define TOUCH_ROTATION_SWAPXY(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 2 ) & 0x01 )
#define TOUCH_ROTATION_FLIPX(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 1 ) & 0x01 )
#define TOUCH_ROTATION_FLIPY(rotation) ((( TOUCH_ROTATION_DATA >> ((rotation&0x03)*4) ) >> 0 ) & 0x01 )

// - Set any of the following to 1 to perform touch display
// remapping functions, 0 to disable. Use DBG_TOUCH to determine which
// remapping modes should be enabled for your display
// - Please refer to "docs/GUIslice_config_guide.xlsx" for detailed examples
// - NOTE: Both settings, GLSC_TOUCH_ROTATE and SWAP / FLIP are applied,
// try to set _SWAP_XY and _FLIP_X/Y to 0 and only use GLSC_TOUCH_ROTATE
#define ADATOUCH_SWAP_XY 0
#define ADATOUCH_FLIP_X 0
#define ADATOUCH_FLIP_Y 0

// Define the maximum number of touch events that are handled
// per gslc_Update() call. Normally this can be set to 1 but certain
// displays may require a greater value (eg. 30) in order to increase
// responsiveness of the touch functionality.
#define GSLC_TOUCH_MAX_EVT 1

// -----------------------------------------------------------------------------
// Misc
// -----------------------------------------------------------------------------

// Enable support for graphics clipping (DrvSetClipRect)
// - Note that this will impact performance of drawing graphics primitives
//#define GSLC_CLIP_EN 1

// Enable for bitmap transparency and definition of color to use
#define GSLC_BMP_TRANS_EN 1 // 1 = enabled, 0 = disabled
#define GSLC_BMP_TRANS_RGB 0xFF,0x00,0xFF // RGB color (default:pink)

#define GSLC_USE_FLOAT 1 // 1=Use floating pt library, 0=Fixed-point lookup tables

// Define default device paths for framebuffer & touchscreen
#define GSLC_DEV_FB "/dev/fb1"
#define GSLC_DEV_TOUCH "/dev/input/touchscreen"
#define GSLC_DEV_VID_DRV "fbcon"

// Enable SDL startup workaround? (1 to enable, 0 to disable)
#define DRV_SDL_FIX_START 0

// Show SDL mouse (1 to show, 0 to hide)
#define DRV_SDL_MOUSE_SHOW 0

#define GSLC_USE_PROGMEM 0

#define GSLC_LOCAL_STR 1 // 1=Use local strings (in element array), 0=External
#define GSLC_LOCAL_STR_LEN 30 // Max string length of text elements

// -----------------------------------------------------------------------------
// Debug diagnostic modes
// -----------------------------------------------------------------------------
// - Uncomment any of the following to enable specific debug modes
//#define DBG_LOG // Enable debugging log output
//#define DBG_TOUCH // Enable debugging of touch-presses
//#define DBG_FRAME_RATE // Enable diagnostic frame rate reporting
//#define DBG_DRAW_IMM // Enable immediate rendering of drawing primitives
//#define DBG_DRIVER // Enable graphics driver debug reporting


// =============================================================================

#ifdef __cplusplus
}
#endif // __cplusplus
#endif // _GUISLICE_CONFIG_LINUX_H_

0 comments on commit da7cd36

Please sign in to comment.