Forked to initiate the Current Loop Gain

Dependencies:   mbed QEI DmTftLibraryEx

Committer:
GregCr
Date:
Thu May 11 15:42:05 2017 +0000
Revision:
8:c0a5f53fe196
Parent:
0:9c0917bfde97
Child:
17:a0bbfc228415
Corrected driver to match datasheet, corrected FW version registers, improved ranging performances at short distance

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregCr 0:9c0917bfde97 1 /*
GregCr 0:9c0917bfde97 2 ______ _
GregCr 0:9c0917bfde97 3 / _____) _ | |
GregCr 0:9c0917bfde97 4 ( (____ _____ ____ _| |_ _____ ____| |__
GregCr 0:9c0917bfde97 5 \____ \| ___ | (_ _) ___ |/ ___) _ \
GregCr 0:9c0917bfde97 6 _____) ) ____| | | || |_| ____( (___| | | |
GregCr 0:9c0917bfde97 7 (______/|_____)_|_|_| \__)_____)\____)_| |_|
GregCr 0:9c0917bfde97 8 (C)2016 Semtech
GregCr 0:9c0917bfde97 9
GregCr 0:9c0917bfde97 10 Description: Display demo menus and manage touch sensor, header
GregCr 0:9c0917bfde97 11
GregCr 0:9c0917bfde97 12 Maintainer: Gregory Cristian & Gilbert Menth
GregCr 0:9c0917bfde97 13 */
GregCr 0:9c0917bfde97 14
GregCr 0:9c0917bfde97 15 #ifndef MENU_H
GregCr 0:9c0917bfde97 16 #define MENU_H
GregCr 0:9c0917bfde97 17
GregCr 0:9c0917bfde97 18
GregCr 0:9c0917bfde97 19 #include "DisplayDriver.h"
GregCr 0:9c0917bfde97 20 #include "DmTouchCalibration.h"
GregCr 0:9c0917bfde97 21
GregCr 0:9c0917bfde97 22
GregCr 0:9c0917bfde97 23 /*!
GregCr 0:9c0917bfde97 24 * \brief TFT calibration structure.
GregCr 0:9c0917bfde97 25 */
GregCr 0:9c0917bfde97 26 typedef struct
GregCr 0:9c0917bfde97 27 {
GregCr 0:9c0917bfde97 28 bool ScreenCalibrated;
GregCr 0:9c0917bfde97 29 CalibrationMatrix Calibration;
GregCr 0:9c0917bfde97 30 }MenuSettings_t;
GregCr 0:9c0917bfde97 31
GregCr 0:9c0917bfde97 32 /*!
GregCr 0:9c0917bfde97 33 * \brief Available pages in menu.
GregCr 0:9c0917bfde97 34 */
GregCr 0:9c0917bfde97 35 enum MenuPages
GregCr 0:9c0917bfde97 36 {
GregCr 0:9c0917bfde97 37 START_PAGE = 0,
GregCr 0:9c0917bfde97 38 PAGE_PING_PONG,
GregCr 0:9c0917bfde97 39 PAGE_PER,
GregCr 0:9c0917bfde97 40 PAGE_RANGING_MASTER,
GregCr 0:9c0917bfde97 41 PAGE_RANGING_SLAVE,
GregCr 0:9c0917bfde97 42 PAGE_RANGING_PARAM,
GregCr 0:9c0917bfde97 43 PAGE_RADIO_PARAM,
GregCr 0:9c0917bfde97 44 PAGE_RADIO_PARAM_FREQ,
GregCr 0:9c0917bfde97 45 PAGE_UTILITIES,
GregCr 0:9c0917bfde97 46 PAGE_RADIO_TEST,
GregCr 0:9c0917bfde97 47 PAGE_SLEEP_MODE,
GregCr 0:9c0917bfde97 48 PAGE_STBY_RC_MODE,
GregCr 0:9c0917bfde97 49 PAGE_STBY_XOSC_MODE,
GregCr 0:9c0917bfde97 50 PAGE_TX_CW,
GregCr 0:9c0917bfde97 51 PAGE_CONT_MODULATION
GregCr 0:9c0917bfde97 52 };
GregCr 0:9c0917bfde97 53
GregCr 0:9c0917bfde97 54
GregCr 0:9c0917bfde97 55 /*!
GregCr 0:9c0917bfde97 56 * \brief Common var to manage TFT calibration.
GregCr 0:9c0917bfde97 57 */
GregCr 0:9c0917bfde97 58 extern MenuSettings_t MenuSettings;
GregCr 0:9c0917bfde97 59
GregCr 0:9c0917bfde97 60
GregCr 0:9c0917bfde97 61 /*!
GregCr 0:9c0917bfde97 62 * \brief Init menu settings.
GregCr 0:9c0917bfde97 63 */
GregCr 0:9c0917bfde97 64 void MenuInit( void );
GregCr 0:9c0917bfde97 65
GregCr 0:9c0917bfde97 66 /*!
GregCr 0:9c0917bfde97 67 * \brief Permanently display Handler for touch sensor.
GregCr 0:9c0917bfde97 68 *
GregCr 0:9c0917bfde97 69 * \param [in] refresh Flag indicates refresh display required (touch)
GregCr 0:9c0917bfde97 70 *
GregCr 0:9c0917bfde97 71 * \retval CurrentPage The updated current page
GregCr 0:9c0917bfde97 72 */
GregCr 0:9c0917bfde97 73 uint8_t MenuHandler( bool refresh );
GregCr 0:9c0917bfde97 74
GregCr 0:9c0917bfde97 75 /*!
GregCr 0:9c0917bfde97 76 * \brief Update or refresh the activated menu page.
GregCr 0:9c0917bfde97 77 *
GregCr 0:9c0917bfde97 78 * \param [in] page Page to display
GregCr 0:9c0917bfde97 79 */
GregCr 0:9c0917bfde97 80 void MenuSetPage( uint8_t page );
GregCr 0:9c0917bfde97 81
GregCr 0:9c0917bfde97 82 /*!
GregCr 0:9c0917bfde97 83 * \brief Writes 3 lines on display, with current radio parameters.
GregCr 0:9c0917bfde97 84 *
GregCr 0:9c0917bfde97 85 * \param [in] page Current page to choose what to display.
GregCr 0:9c0917bfde97 86 */
GregCr 0:9c0917bfde97 87 void DisplayCurrentRadioParams( uint8_t page );
GregCr 0:9c0917bfde97 88
GregCr 0:9c0917bfde97 89 /*!
GregCr 0:9c0917bfde97 90 * \brief Return text with current frame type.
GregCr 0:9c0917bfde97 91 *
GregCr 0:9c0917bfde97 92 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 93 */
GregCr 0:9c0917bfde97 94 char* GetMenuRadioFrameType( void );
GregCr 0:9c0917bfde97 95
GregCr 0:9c0917bfde97 96 /*!
GregCr 0:9c0917bfde97 97 * \brief Return text with current Radio Modulation Parameters1.
GregCr 0:9c0917bfde97 98 *
GregCr 0:9c0917bfde97 99 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 100 */
GregCr 0:9c0917bfde97 101 char* GetRadioModulationParameters1( void );
GregCr 0:9c0917bfde97 102
GregCr 0:9c0917bfde97 103 /*!
GregCr 0:9c0917bfde97 104 * \brief Return text with current Radio Modulatio nParameters2.
GregCr 0:9c0917bfde97 105 *
GregCr 0:9c0917bfde97 106 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 107 */
GregCr 0:9c0917bfde97 108 char* GetRadioModulationParameters2( void );
GregCr 0:9c0917bfde97 109
GregCr 0:9c0917bfde97 110 /*!
GregCr 0:9c0917bfde97 111 * \brief Return text with current Radio Modulation Parameters3.
GregCr 0:9c0917bfde97 112 *
GregCr 0:9c0917bfde97 113 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 114 */
GregCr 0:9c0917bfde97 115 char* GetRadioModulationParameters3( void );
GregCr 0:9c0917bfde97 116
GregCr 0:9c0917bfde97 117 /*!
GregCr 0:9c0917bfde97 118 * \brief Return text with current Radio Frequency.
GregCr 0:9c0917bfde97 119 *
GregCr 0:9c0917bfde97 120 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 121 */
GregCr 0:9c0917bfde97 122 char* GetRadioFrequency( void );
GregCr 0:9c0917bfde97 123
GregCr 0:9c0917bfde97 124 /*!
GregCr 0:9c0917bfde97 125 * \brief Return text with current Radio Frequency [GHz] format #.###.
GregCr 0:9c0917bfde97 126 *
GregCr 0:9c0917bfde97 127 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 128 */
GregCr 0:9c0917bfde97 129 char* GetRadioFrequencyGHz( void );
GregCr 0:9c0917bfde97 130
GregCr 0:9c0917bfde97 131 /*!
GregCr 0:9c0917bfde97 132 * \brief Return text with current Radio Freq Base.
GregCr 0:9c0917bfde97 133 *
GregCr 0:9c0917bfde97 134 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 135 */
GregCr 0:9c0917bfde97 136 char* GetRadioFreqBase( void );
GregCr 0:9c0917bfde97 137
GregCr 0:9c0917bfde97 138 /*!
GregCr 0:9c0917bfde97 139 * \brief Return text with Radio preset Frequency 1.
GregCr 0:9c0917bfde97 140 *
GregCr 0:9c0917bfde97 141 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 142 */
GregCr 0:9c0917bfde97 143 char* GetRadioFreqBasePS1( void );
GregCr 0:9c0917bfde97 144
GregCr 0:9c0917bfde97 145 /*!
GregCr 0:9c0917bfde97 146 * \brief Return text with Radio preset Frequency 2.
GregCr 0:9c0917bfde97 147 *
GregCr 0:9c0917bfde97 148 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 149 */
GregCr 0:9c0917bfde97 150 char* GetRadioFreqBasePS2( void );
GregCr 0:9c0917bfde97 151
GregCr 0:9c0917bfde97 152 /*!
GregCr 0:9c0917bfde97 153 * \brief Return text with Radio preset Frequency 3.
GregCr 0:9c0917bfde97 154 *
GregCr 0:9c0917bfde97 155 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 156 */
GregCr 0:9c0917bfde97 157 char* GetRadioFreqBasePS3( void );
GregCr 0:9c0917bfde97 158
GregCr 0:9c0917bfde97 159 /*!
GregCr 0:9c0917bfde97 160 * \brief Return text with current Radio Tx Power.
GregCr 0:9c0917bfde97 161 *
GregCr 0:9c0917bfde97 162 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 163 */
GregCr 0:9c0917bfde97 164 char* GetRadioTxPower( void );
GregCr 0:9c0917bfde97 165
GregCr 0:9c0917bfde97 166 /*!
GregCr 0:9c0917bfde97 167 * \brief Return text with current Radio Payload Length.
GregCr 0:9c0917bfde97 168 *
GregCr 0:9c0917bfde97 169 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 170 */
GregCr 0:9c0917bfde97 171 char* GetRadioPayloadLength( void );
GregCr 0:9c0917bfde97 172
GregCr 0:9c0917bfde97 173 /*!
GregCr 0:9c0917bfde97 174 * \brief Return text with Max Num Packet.
GregCr 0:9c0917bfde97 175 *
GregCr 0:9c0917bfde97 176 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 177 */
GregCr 0:9c0917bfde97 178 char* GetMenuDemoMaxNumPacket( void );
GregCr 0:9c0917bfde97 179
GregCr 0:9c0917bfde97 180 /*!
GregCr 0:9c0917bfde97 181 * \brief Return text with current Demo Num Sent Packet.
GregCr 0:9c0917bfde97 182 *
GregCr 0:9c0917bfde97 183 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 184 */
GregCr 0:9c0917bfde97 185 char* GetMenuDemoNumSentPacket( void );
GregCr 0:9c0917bfde97 186
GregCr 0:9c0917bfde97 187 /*!
GregCr 0:9c0917bfde97 188 * \brief Return text with current Rx frame Ok count.
GregCr 0:9c0917bfde97 189 *
GregCr 0:9c0917bfde97 190 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 191 */
GregCr 0:9c0917bfde97 192 char* GetMenuDemoRxOk( void );
GregCr 0:9c0917bfde97 193
GregCr 0:9c0917bfde97 194 /*!
GregCr 0:9c0917bfde97 195 * \brief Return text with current Rx frame Ko count.
GregCr 0:9c0917bfde97 196 *
GregCr 0:9c0917bfde97 197 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 198 */
GregCr 0:9c0917bfde97 199 char* GetMenuDemoRxKo( void );
GregCr 0:9c0917bfde97 200
GregCr 0:9c0917bfde97 201 /*!
GregCr 0:9c0917bfde97 202 * \brief Return text with current Rx frame Ok (on slave side) count.
GregCr 0:9c0917bfde97 203 *
GregCr 0:9c0917bfde97 204 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 205 */
GregCr 0:9c0917bfde97 206 char* GetMenuDemoRxOkSlave( void );
GregCr 0:9c0917bfde97 207
GregCr 0:9c0917bfde97 208 /*!
GregCr 0:9c0917bfde97 209 * \brief Return text with current Rx frame Ko (on slave side) count.
GregCr 0:9c0917bfde97 210 *
GregCr 0:9c0917bfde97 211 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 212 */
GregCr 0:9c0917bfde97 213 char* GetMenuDemoRxKoSlave( void );
GregCr 0:9c0917bfde97 214
GregCr 0:9c0917bfde97 215 /*!
GregCr 0:9c0917bfde97 216 * \brief Return text with current Result PerCent1, format ###.##.
GregCr 0:9c0917bfde97 217 *
GregCr 0:9c0917bfde97 218 * \param [in] value value to compute in [%]
GregCr 0:9c0917bfde97 219 * \param [in] reference reference value for % computation
GregCr 0:9c0917bfde97 220 *
GregCr 0:9c0917bfde97 221 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 222 */
GregCr 0:9c0917bfde97 223 char* GetMenuDemoResultPerCent1( uint32_t value, uint32_t reference );
GregCr 0:9c0917bfde97 224
GregCr 0:9c0917bfde97 225 /*!
GregCr 0:9c0917bfde97 226 * \brief Return text with current Result PerCent2, format ###.##.
GregCr 0:9c0917bfde97 227 *
GregCr 0:9c0917bfde97 228 * \param [in] value value to compute in [%]
GregCr 0:9c0917bfde97 229 * \param [in] reference reference value for % computation
GregCr 0:9c0917bfde97 230 *
GregCr 0:9c0917bfde97 231 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 232 */
GregCr 0:9c0917bfde97 233 char* GetMenuDemoResultPerCent2( uint32_t value, uint32_t reference );
GregCr 0:9c0917bfde97 234
GregCr 0:9c0917bfde97 235 /*!
GregCr 0:9c0917bfde97 236 * \brief Return text with current Rssi.
GregCr 0:9c0917bfde97 237 *
GregCr 0:9c0917bfde97 238 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 239 */
GregCr 0:9c0917bfde97 240 char* GetMenuDemoRssi( void );
GregCr 0:9c0917bfde97 241
GregCr 0:9c0917bfde97 242 /*!
GregCr 0:9c0917bfde97 243 * \brief Return text with current Snr.
GregCr 0:9c0917bfde97 244 *
GregCr 0:9c0917bfde97 245 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 246 */
GregCr 0:9c0917bfde97 247 char* GetMenuDemoSnr( void );
GregCr 0:9c0917bfde97 248
GregCr 0:9c0917bfde97 249 /*!
GregCr 0:9c0917bfde97 250 * \brief Return text with current Antenna Setting.
GregCr 0:9c0917bfde97 251 *
GregCr 0:9c0917bfde97 252 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 253 */
GregCr 0:9c0917bfde97 254 char* GetAntennaSetting( void );
GregCr 0:9c0917bfde97 255
GregCr 0:9c0917bfde97 256 /*!
GregCr 0:9c0917bfde97 257 * \brief Return text with Total Packet for the test.
GregCr 0:9c0917bfde97 258 *
GregCr 0:9c0917bfde97 259 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 260 */
GregCr 0:9c0917bfde97 261 char* GetTotalPackets( void );
GregCr 0:9c0917bfde97 262
GregCr 0:9c0917bfde97 263 /*!
GregCr 0:9c0917bfde97 264 * \brief Return text with current GPS Time.
GregCr 0:9c0917bfde97 265 *
GregCr 0:9c0917bfde97 266 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 267 */
GregCr 0:9c0917bfde97 268 char* GetGpsTime( void );
GregCr 0:9c0917bfde97 269
GregCr 0:9c0917bfde97 270 /*!
GregCr 0:9c0917bfde97 271 * \brief Return text with current GPS Position.
GregCr 0:9c0917bfde97 272 *
GregCr 0:9c0917bfde97 273 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 274 */
GregCr 0:9c0917bfde97 275 char* GetGpsPos( void );
GregCr 0:9c0917bfde97 276
GregCr 0:9c0917bfde97 277 /*!
GregCr 0:9c0917bfde97 278 * \brief Return text with current Proximity Value.
GregCr 0:9c0917bfde97 279 *
GregCr 0:9c0917bfde97 280 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 281 */
GregCr 0:9c0917bfde97 282 char* GetProximityValue( void );
GregCr 0:9c0917bfde97 283
GregCr 0:9c0917bfde97 284 /*!
GregCr 0:9c0917bfde97 285 * \brief Return text with current Radio Power Mode Value.
GregCr 0:9c0917bfde97 286 *
GregCr 0:9c0917bfde97 287 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 288 */
GregCr 0:9c0917bfde97 289 char* GetMenuDemoRadioPowerMode( void );
GregCr 0:9c0917bfde97 290
GregCr 0:9c0917bfde97 291 /*!
GregCr 0:9c0917bfde97 292 * \brief Return text with current Frequency Error Value.
GregCr 0:9c0917bfde97 293 *
GregCr 0:9c0917bfde97 294 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 295 */
GregCr 0:9c0917bfde97 296 char* GetFrequencyError( void );
GregCr 0:9c0917bfde97 297
GregCr 0:9c0917bfde97 298 /*!
GregCr 0:9c0917bfde97 299 * \brief Return text with current Ranging Channels Successfully Done Value.
GregCr 0:9c0917bfde97 300 *
GregCr 0:9c0917bfde97 301 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 302 */
GregCr 0:9c0917bfde97 303 char* GetRngChannelsOk( void );
GregCr 0:9c0917bfde97 304
GregCr 0:9c0917bfde97 305 /*!
GregCr 0:9c0917bfde97 306 * \brief Return text with current Ranging Request Count Value.
GregCr 0:9c0917bfde97 307 *
GregCr 0:9c0917bfde97 308 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 309 */
GregCr 0:9c0917bfde97 310 char* GetRangingRequestCount( void );
GregCr 0:9c0917bfde97 311
GregCr 0:9c0917bfde97 312 /*!
GregCr 0:9c0917bfde97 313 * \brief Return text with current Ranging Address Value.
GregCr 0:9c0917bfde97 314 *
GregCr 0:9c0917bfde97 315 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 316 */
GregCr 0:9c0917bfde97 317 char* GetRangingAddress( void );
GregCr 0:9c0917bfde97 318
GregCr 0:9c0917bfde97 319 /*!
GregCr 0:9c0917bfde97 320 * \brief Return text with current Ranging Antenna Value.
GregCr 0:9c0917bfde97 321 *
GregCr 0:9c0917bfde97 322 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 323 */
GregCr 0:9c0917bfde97 324 char* GetRangingAntenna( void );
GregCr 0:9c0917bfde97 325
GregCr 0:9c0917bfde97 326 /*!
GregCr 0:9c0917bfde97 327 * \brief Return text with current Ranging Distance Unit.
GregCr 0:9c0917bfde97 328 *
GregCr 0:9c0917bfde97 329 * \retval text Pointer on text to display
GregCr 0:9c0917bfde97 330 */
GregCr 0:9c0917bfde97 331 char* GetRangingUnit( void );
GregCr 0:9c0917bfde97 332
GregCr 0:9c0917bfde97 333 #endif // MENU_H