Source code for the SX126xDVK1xAS Dev Kit. This example code has only been tested on the Nucleo L476RG

Dependencies:   mbed DmTftLibrary SX126xLib

Committer:
GregCr
Date:
Tue Sep 05 08:15:37 2017 +0000
Revision:
0:e5420f1a8a1a
Candidate Release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregCr 0:e5420f1a8a1a 1 /*
GregCr 0:e5420f1a8a1a 2 ______ _
GregCr 0:e5420f1a8a1a 3 / _____) _ | |
GregCr 0:e5420f1a8a1a 4 ( (____ _____ ____ _| |_ _____ ____| |__
GregCr 0:e5420f1a8a1a 5 \____ \| ___ | (_ _) ___ |/ ___) _ \
GregCr 0:e5420f1a8a1a 6 _____) ) ____| | | || |_| ____( (___| | | |
GregCr 0:e5420f1a8a1a 7 (______/|_____)_|_|_| \__)_____)\____)_| |_|
GregCr 0:e5420f1a8a1a 8 (C)2016 Semtech
GregCr 0:e5420f1a8a1a 9
GregCr 0:e5420f1a8a1a 10 Description: Display driver header
GregCr 0:e5420f1a8a1a 11
GregCr 0:e5420f1a8a1a 12 Maintainer: Gregory Cristian & Gilbert Menth
GregCr 0:e5420f1a8a1a 13 */
GregCr 0:e5420f1a8a1a 14
GregCr 0:e5420f1a8a1a 15 #ifndef TFT_DISPLAY_DRIVER_H
GregCr 0:e5420f1a8a1a 16 #define TFT_DISPLAY_DRIVER_H
GregCr 0:e5420f1a8a1a 17
GregCr 0:e5420f1a8a1a 18
GregCr 0:e5420f1a8a1a 19 #include "DmTftBase.h"
GregCr 0:e5420f1a8a1a 20
GregCr 0:e5420f1a8a1a 21
GregCr 0:e5420f1a8a1a 22 #define SCREEN_WIDTH 240
GregCr 0:e5420f1a8a1a 23 #define SCREEN_HEIGHT 320
GregCr 0:e5420f1a8a1a 24
GregCr 0:e5420f1a8a1a 25 #define TEXT_COLOR WHITE
GregCr 0:e5420f1a8a1a 26 #define BACK_COLOR BLACK
GregCr 0:e5420f1a8a1a 27 #define PAGE_COLOR CYAN
GregCr 0:e5420f1a8a1a 28 #define OBJECT_ERROR RED
GregCr 0:e5420f1a8a1a 29 #define BUTTON_BORDER BLUE
GregCr 0:e5420f1a8a1a 30 #define MENU_TEXT GREEN
GregCr 0:e5420f1a8a1a 31 #define TEXT_VALUE YELLOW
GregCr 0:e5420f1a8a1a 32 #define CIRCLE_FCOLOR GRAY1
GregCr 0:e5420f1a8a1a 33
GregCr 0:e5420f1a8a1a 34
GregCr 0:e5420f1a8a1a 35 typedef enum
GregCr 0:e5420f1a8a1a 36 {
GregCr 0:e5420f1a8a1a 37 GO_STATUS_NOERR,
GregCr 0:e5420f1a8a1a 38 GO_STATUS_BAD_COORD,
GregCr 0:e5420f1a8a1a 39 GO_STATUS_BAD_ARG,
GregCr 0:e5420f1a8a1a 40 GO_STATUS_BAD_CONTEXT,
GregCr 0:e5420f1a8a1a 41 }GraphObjectStatus_t;
GregCr 0:e5420f1a8a1a 42
GregCr 0:e5420f1a8a1a 43 typedef enum
GregCr 0:e5420f1a8a1a 44 {
GregCr 0:e5420f1a8a1a 45 GO_TEXT,
GregCr 0:e5420f1a8a1a 46 GO_RECTANGLE,
GregCr 0:e5420f1a8a1a 47 GO_CIRCLE,
GregCr 0:e5420f1a8a1a 48 GO_TRIANGLE,
GregCr 0:e5420f1a8a1a 49 GO_IMAGE,
GregCr 0:e5420f1a8a1a 50 GO_LINE,
GregCr 0:e5420f1a8a1a 51 }GraphObjectType_t;
GregCr 0:e5420f1a8a1a 52
GregCr 0:e5420f1a8a1a 53 typedef struct
GregCr 0:e5420f1a8a1a 54 {
GregCr 0:e5420f1a8a1a 55 uint8_t Id;
GregCr 0:e5420f1a8a1a 56 GraphObjectType_t Type;
GregCr 0:e5420f1a8a1a 57 uint16_t Xpos;
GregCr 0:e5420f1a8a1a 58 uint16_t Ypos;
GregCr 0:e5420f1a8a1a 59 uint16_t Height;
GregCr 0:e5420f1a8a1a 60 uint16_t Width;
GregCr 0:e5420f1a8a1a 61 uint16_t LineWidth;
GregCr 0:e5420f1a8a1a 62 uint16_t BackColor;
GregCr 0:e5420f1a8a1a 63 uint16_t FrontColor;
GregCr 0:e5420f1a8a1a 64 bool DoFill;
GregCr 0:e5420f1a8a1a 65 uint16_t FillColor;
GregCr 0:e5420f1a8a1a 66 uint8_t* Source;
GregCr 0:e5420f1a8a1a 67 bool TouchActive;
GregCr 0:e5420f1a8a1a 68 }GraphObject_t;
GregCr 0:e5420f1a8a1a 69
GregCr 0:e5420f1a8a1a 70
GregCr 0:e5420f1a8a1a 71 /*!
GregCr 0:e5420f1a8a1a 72 * \brief Initialses the hardware and variables associated with the display.
GregCr 0:e5420f1a8a1a 73 */
GregCr 0:e5420f1a8a1a 74 void DisplayDriverInit( void );
GregCr 0:e5420f1a8a1a 75
GregCr 0:e5420f1a8a1a 76 /*!
GregCr 0:e5420f1a8a1a 77 * \brief Calibrates the touch screen.
GregCr 0:e5420f1a8a1a 78 */
GregCr 0:e5420f1a8a1a 79 void DisplayDriverCalibrate( void );
GregCr 0:e5420f1a8a1a 80
GregCr 0:e5420f1a8a1a 81 /*!
GregCr 0:e5420f1a8a1a 82 * \brief Draws a graphical object.
GregCr 0:e5420f1a8a1a 83 *
GregCr 0:e5420f1a8a1a 84 * \param [in] *goObject Object to draw.
GregCr 0:e5420f1a8a1a 85 * \param [in] *source If object is a text : *source is the text to print
GregCr 0:e5420f1a8a1a 86 * If object is a image: *source is the image
GregCr 0:e5420f1a8a1a 87 * For the other type of goObject, *source is ignored
GregCr 0:e5420f1a8a1a 88 * \param [in] doFill Indicate if the goObject (only for GO_RECTANGLE,
GregCr 0:e5420f1a8a1a 89 * GO_CIRCLE & GO_TRIANGLE) should be filled or not.
GregCr 0:e5420f1a8a1a 90 * \param [in] activeTouch Indicate if the coordinates of the goObject can be
GregCr 0:e5420f1a8a1a 91 * used for touchscreen or not.
GregCr 0:e5420f1a8a1a 92 * \retval status GO_STATUS_NOERR if ok or,
GregCr 0:e5420f1a8a1a 93 * GO_STATUS_BAD_COORD if the object go out of screen
GregCr 0:e5420f1a8a1a 94 */
GregCr 0:e5420f1a8a1a 95 GraphObjectStatus_t GraphObjectDraw( GraphObject_t* goObject, uint8_t* source, \
GregCr 0:e5420f1a8a1a 96 bool doFill, bool activeTouch);
GregCr 0:e5420f1a8a1a 97
GregCr 0:e5420f1a8a1a 98 /*!
GregCr 0:e5420f1a8a1a 99 * \brief Clear a graphical object.
GregCr 0:e5420f1a8a1a 100 *
GregCr 0:e5420f1a8a1a 101 * \param [in] *goObject Object to clear.
GregCr 0:e5420f1a8a1a 102 * \param [in] doFill Indicate if the goObject (only for GO_RECTANGLE,
GregCr 0:e5420f1a8a1a 103 * GO_CIRCLE & GO_TRIANGLE) should be filled or not.
GregCr 0:e5420f1a8a1a 104 * \retval status GO_STATUS_NOERR if ok or,
GregCr 0:e5420f1a8a1a 105 * GO_STATUS_BAD_COORD if the object go out of screen
GregCr 0:e5420f1a8a1a 106 */
GregCr 0:e5420f1a8a1a 107 GraphObjectStatus_t GraphObjectClear( GraphObject_t* goObject, bool doFill );
GregCr 0:e5420f1a8a1a 108
GregCr 0:e5420f1a8a1a 109 /*!
GregCr 0:e5420f1a8a1a 110 * \brief Get the first object that have the touched coordinate (if activateTouch
GregCr 0:e5420f1a8a1a 111 * of the object is TRUE).
GregCr 0:e5420f1a8a1a 112 *
GregCr 0:e5420f1a8a1a 113 * \param [in] *objects Tab of grophical objects.
GregCr 0:e5420f1a8a1a 114 * \param [in] objectsCount Indicate the numbre of goObject in the tab.
GregCr 0:e5420f1a8a1a 115 * \param [out] touchedObject Put the ID of the first touched and activated
GregCr 0:e5420f1a8a1a 116 * object of the tab.
GregCr 0:e5420f1a8a1a 117 * \retval status GO_STATUS_NOERR if ok.
GregCr 0:e5420f1a8a1a 118 */
GregCr 0:e5420f1a8a1a 119 GraphObjectStatus_t GraphObjectTouched( GraphObject_t* objects, \
GregCr 0:e5420f1a8a1a 120 uint8_t objectsCount, \
GregCr 0:e5420f1a8a1a 121 uint8_t* touchedObject);
GregCr 0:e5420f1a8a1a 122
GregCr 0:e5420f1a8a1a 123 /*!
GregCr 0:e5420f1a8a1a 124 * \brief Draws a logo on the display.
GregCr 0:e5420f1a8a1a 125 *
GregCr 0:e5420f1a8a1a 126 * \param [in] *thisBmp The file to be printed onto the display.
GregCr 0:e5420f1a8a1a 127 * \param [in] xPos Position across the display in pixels for the top
GregCr 0:e5420f1a8a1a 128 * right corner of the logo starting at the left edge
GregCr 0:e5420f1a8a1a 129 * of display.
GregCr 0:e5420f1a8a1a 130 * \param [in] yPos Position across the display in pixels for the top
GregCr 0:e5420f1a8a1a 131 * right corner of the logo starting at the top of
GregCr 0:e5420f1a8a1a 132 * the display.
GregCr 0:e5420f1a8a1a 133 */
GregCr 0:e5420f1a8a1a 134 void DisplayDriverDrawLogo( uint8_t *thisBmp, uint8_t xPos, uint8_t yPos );
GregCr 0:e5420f1a8a1a 135
GregCr 0:e5420f1a8a1a 136 #endif //TFT_DISPLAY_DRIVER_H