Velocity Closed Loop Dynamic error correction

Dependencies:   mbed QEI PID DmTftLibraryEx

Committer:
lex9296
Date:
Fri Apr 08 05:27:20 2022 +0000
Revision:
32:1be3d79ff4db
Parent:
30:e45282a70a4d
Child:
33:f77aa3ecf87d
Actuator is Working, but I might need some Current Loop.

Who changed what in which revision?

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