Stabilus 322699 wDoublePID
Dependencies: mbed QEI PID DmTftLibraryEx
Peripherals/Eeprom.h@23:b9d23a2f390e, 2022-02-10 (annotated)
- Committer:
- lex9296
- Date:
- Thu Feb 10 09:39:01 2022 +0000
- Revision:
- 23:b9d23a2f390e
- Parent:
- 21:ab8027016a2c
LA_0005 QEI che compila e legge tutti i Passi RT
Who changed what in which revision?
User | Revision | Line number | New 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: EEPROM routines 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 EEPROM_H |
mverdy | 20:626b92b70bf7 | 16 | #define EEPROM_H |
mverdy | 20:626b92b70bf7 | 17 | |
mverdy | 20:626b92b70bf7 | 18 | |
mverdy | 20:626b92b70bf7 | 19 | #include "Menu.h" |
lex9296 | 21:ab8027016a2c | 20 | //#include "DemoApplication.h" |
lex9296 | 21:ab8027016a2c | 21 | //#include "sx1280.h" |
lex9296 | 23:b9d23a2f390e | 22 | #include "DmTouchCalibration.h" |
mverdy | 20:626b92b70bf7 | 23 | |
mverdy | 20:626b92b70bf7 | 24 | /*! |
mverdy | 20:626b92b70bf7 | 25 | * \brief Define Buffer indexes for each EepromData for copy and restore |
mverdy | 20:626b92b70bf7 | 26 | */ |
mverdy | 20:626b92b70bf7 | 27 | #define SCR_CAL_FLAG_EEPROM_ADDR 0 // boolean |
mverdy | 20:626b92b70bf7 | 28 | #define SCR_CAL_POSA_EEPROM_ADDR 1 // int32 |
mverdy | 20:626b92b70bf7 | 29 | #define SCR_CAL_POSB_EEPROM_ADDR 5 // int32 |
mverdy | 20:626b92b70bf7 | 30 | #define SCR_CAL_POSC_EEPROM_ADDR 9 // int32 |
mverdy | 20:626b92b70bf7 | 31 | #define SCR_CAL_POSD_EEPROM_ADDR 13 // int32 |
mverdy | 20:626b92b70bf7 | 32 | #define SCR_CAL_POSE_EEPROM_ADDR 17 // int32 |
mverdy | 20:626b92b70bf7 | 33 | #define SCR_CAL_POSF_EEPROM_ADDR 21 // int32 |
mverdy | 20:626b92b70bf7 | 34 | #define APP_ENTITY_EEPROM_ADDR 25 // uint8 |
mverdy | 20:626b92b70bf7 | 35 | #define APP_ANT_SW_EEPROM_ADDR 26 // uint8 |
mverdy | 20:626b92b70bf7 | 36 | #define APP_FREQ_EEPROM_ADDR 27 // uint32_t Frequency; |
mverdy | 20:626b92b70bf7 | 37 | #define APP_TXPWR_EEPROM_ADDR 31 // int8_t TxPower; |
mverdy | 20:626b92b70bf7 | 38 | #define APP_MOD_TYPE_EEPROM_ADDR 32 // uint8_t ModulationType; |
mverdy | 20:626b92b70bf7 | 39 | #define APP_PER_NPAK_MAX_EEPROM_ADDR 33 // uint32_t MaxNumPacket; |
mverdy | 20:626b92b70bf7 | 40 | #define APP_RADIO_POWER_MODE_EEPROM_ADDR 37 // RadioRegulatorMode_t |
mverdy | 20:626b92b70bf7 | 41 | #define APP_RNG_REQ_COUNT_EEPROM_ADDR 38 // uint8_t |
mverdy | 20:626b92b70bf7 | 42 | #define APP_RNG_FULLSCALE_EEPROM_ADDR 39 // uint16_t |
mverdy | 20:626b92b70bf7 | 43 | #define APP_RNG_RFU_EEPROM_ADDR 41 |
mverdy | 20:626b92b70bf7 | 44 | #define APP_RNG_UNIT_EEPROM_ADDR 42 // ranging distance unit |
mverdy | 20:626b92b70bf7 | 45 | #define APP_RNG_ADDR_EEPROM_ADDR 43 // uint32_t |
mverdy | 20:626b92b70bf7 | 46 | #define APP_RNG_ANT_EEPROM_ADDR 47 // uint8_t RngAntenna |
mverdy | 20:626b92b70bf7 | 47 | #define MOD_PAK_TYPE_EEPROM_ADDR 48 // enum |
mverdy | 20:626b92b70bf7 | 48 | #define MOD_GFS_BRBW_EEPROM_ADDR 49 // BitrateBandwidth |
mverdy | 20:626b92b70bf7 | 49 | #define MOD_GFS_MOD_IND_EEPROM_ADDR 50 // ModulationIndex |
mverdy | 20:626b92b70bf7 | 50 | #define MOD_GFS_MOD_SHAP_EEPROM_ADDR 51 // ModulationShaping |
mverdy | 20:626b92b70bf7 | 51 | #define MOD_LOR_SPREADF_EEPROM_ADDR 52 // SpreadingFactor |
mverdy | 20:626b92b70bf7 | 52 | #define MOD_LOR_BW_EEPROM_ADDR 53 // Bandwidth |
mverdy | 20:626b92b70bf7 | 53 | #define MOD_LOR_CODERATE_EEPROM_ADDR 54 // CodingRate |
mverdy | 20:626b92b70bf7 | 54 | #define MOD_FLR_BRBW_EEPROM_ADDR 55 // BitrateBandwidth |
mverdy | 20:626b92b70bf7 | 55 | #define MOD_FLR_CODERATE_EEPROM_ADDR 56 // CodingRate |
mverdy | 20:626b92b70bf7 | 56 | #define MOD_FLR_MOD_SHAP_EEPROM_ADDR 57 // ModulationShaping |
mverdy | 20:626b92b70bf7 | 57 | #define MOD_BLE_BRBW_EEPROM_ADDR 58 // BitrateBandwidth |
mverdy | 20:626b92b70bf7 | 58 | #define MOD_BLE_MOD_IND_EEPROM_ADDR 59 // ModulationIndex |
mverdy | 20:626b92b70bf7 | 59 | #define MOD_BLE_MOD_SHAP_EEPROM_ADDR 60 // ModulationShaping |
mverdy | 20:626b92b70bf7 | 60 | #define MOD_RNG_SPREADF_EEPROM_ADDR 61 // SpreadingFactor |
mverdy | 20:626b92b70bf7 | 61 | #define MOD_RNG_BW_EEPROM_ADDR 62 // Bandwidth |
mverdy | 20:626b92b70bf7 | 62 | #define MOD_RNG_CODERATE_EEPROM_ADDR 63 // CodingRate |
mverdy | 20:626b92b70bf7 | 63 | #define PAK_PAK_TYPE_EEPROM_ADDR 64 // |
mverdy | 20:626b92b70bf7 | 64 | #define PAK_GFS_PREAMBLE_LEN_EEPROM_ADDR 65 // PreambleLength |
mverdy | 20:626b92b70bf7 | 65 | #define PAK_GFS_SYNC_LEN_EEPROM_ADDR 66 // SyncWordLength |
mverdy | 20:626b92b70bf7 | 66 | #define PAK_GFS_SYNC_MATCH_EEPROM_ADDR 67 // SyncWordMatch |
mverdy | 20:626b92b70bf7 | 67 | #define PAK_GFS_HEADERTYPE_EEPROM_ADDR 68 // HeaderType |
mverdy | 20:626b92b70bf7 | 68 | #define PAK_GFS_PL_LEN_EEPROM_ADDR 69 // PayloadLength |
mverdy | 20:626b92b70bf7 | 69 | #define PAK_GFS_CRC_LEN_EEPROM_ADDR 70 // CrcLength |
mverdy | 20:626b92b70bf7 | 70 | #define PAK_GFS_WHITENING_EEPROM_ADDR 71 // Whitening |
mverdy | 20:626b92b70bf7 | 71 | #define PAK_LOR_PREAMBLE_LEN_EEPROM_ADDR 72 // PreambleLength |
mverdy | 20:626b92b70bf7 | 72 | #define PAK_LOR_HEADERTYPE_EEPROM_ADDR 73 // HeaderType |
mverdy | 20:626b92b70bf7 | 73 | #define PAK_LOR_PL_LEN_EEPROM_ADDR 74 // PayloadLength |
mverdy | 20:626b92b70bf7 | 74 | #define PAK_LOR_CRC_MODE_EEPROM_ADDR 75 // CrcMode |
mverdy | 20:626b92b70bf7 | 75 | #define PAK_LOR_IQ_INV_EEPROM_ADDR 76 // InvertIQ |
mverdy | 20:626b92b70bf7 | 76 | #define PAK_RNG_PREAMBLE_LEN_EEPROM_ADDR 77 // PreambleLength |
mverdy | 20:626b92b70bf7 | 77 | #define PAK_RNG_HEADERTYPE_EEPROM_ADDR 78 // HeaderType |
mverdy | 20:626b92b70bf7 | 78 | #define PAK_RNG_PL_LEN_EEPROM_ADDR 79 // PayloadLength |
mverdy | 20:626b92b70bf7 | 79 | #define PAK_RNG_CRC_MODE_EEPROM_ADDR 80 // CrcMode |
mverdy | 20:626b92b70bf7 | 80 | #define PAK_RNG_IQ_INV_EEPROM_ADDR 81 // InvertIQ |
mverdy | 20:626b92b70bf7 | 81 | #define PAK_FLR_PREAMBLE_LEN_EEPROM_ADDR 82 // PreambleLength |
mverdy | 20:626b92b70bf7 | 82 | #define PAK_FLR_SYNC_LEN_EEPROM_ADDR 83 // SyncWordLength |
mverdy | 20:626b92b70bf7 | 83 | #define PAK_FLR_SYNC_MATCH_EEPROM_ADDR 84 // SyncWordMatch |
mverdy | 20:626b92b70bf7 | 84 | #define PAK_FLR_HEADERTYPE_EEPROM_ADDR 85 // HeaderType |
mverdy | 20:626b92b70bf7 | 85 | #define PAK_FLR_PL_LEN_EEPROM_ADDR 86 // PayloadLength |
mverdy | 20:626b92b70bf7 | 86 | #define PAK_FLR_CRC_LEN_EEPROM_ADDR 87 // CrcLength |
mverdy | 20:626b92b70bf7 | 87 | #define PAK_FLR_WHITENING_EEPROM_ADDR 88 // Whitening |
mverdy | 20:626b92b70bf7 | 88 | #define PAK_BLE_CON_STATE_EEPROM_ADDR 89 // ConnectionState |
mverdy | 20:626b92b70bf7 | 89 | #define PAK_BLE_CRC_FIELD_EEPROM_ADDR 90 // CrcField |
mverdy | 20:626b92b70bf7 | 90 | #define PAK_BLE_PAK_TYPE_EEPROM_ADDR 91 // BlePacketType |
mverdy | 20:626b92b70bf7 | 91 | #define PAK_BLE_WHITENING_EEPROM_ADDR 92 // Whitening |
mverdy | 20:626b92b70bf7 | 92 | #define EEPROM_CRC_EEPROM_ADDR 93 // uint16 |
mverdy | 20:626b92b70bf7 | 93 | |
mverdy | 20:626b92b70bf7 | 94 | /*! |
mverdy | 20:626b92b70bf7 | 95 | * \brief Eeprom buffer size. Cf. above. |
mverdy | 20:626b92b70bf7 | 96 | */ |
mverdy | 20:626b92b70bf7 | 97 | #define EEPROM_BUFFER_SIZE 95 |
mverdy | 20:626b92b70bf7 | 98 | |
lex9296 | 23:b9d23a2f390e | 99 | /*! |
lex9296 | 23:b9d23a2f390e | 100 | * \brief Available pages in menu. |
lex9296 | 23:b9d23a2f390e | 101 | */ |
lex9296 | 23:b9d23a2f390e | 102 | enum MenuPages |
lex9296 | 23:b9d23a2f390e | 103 | { |
lex9296 | 23:b9d23a2f390e | 104 | START_PAGE = 0, |
lex9296 | 23:b9d23a2f390e | 105 | PAGE_PING_PONG, |
lex9296 | 23:b9d23a2f390e | 106 | PAGE_PER, |
lex9296 | 23:b9d23a2f390e | 107 | PAGE_RANGING_MASTER, |
lex9296 | 23:b9d23a2f390e | 108 | PAGE_RANGING_SLAVE, |
lex9296 | 23:b9d23a2f390e | 109 | PAGE_RANGING_PARAM, |
lex9296 | 23:b9d23a2f390e | 110 | PAGE_RADIO_PARAM, |
lex9296 | 23:b9d23a2f390e | 111 | PAGE_RADIO_PARAM_FREQ, |
lex9296 | 23:b9d23a2f390e | 112 | PAGE_UTILITIES, |
lex9296 | 23:b9d23a2f390e | 113 | PAGE_RADIO_TEST, |
lex9296 | 23:b9d23a2f390e | 114 | PAGE_SLEEP_MODE, |
lex9296 | 23:b9d23a2f390e | 115 | PAGE_STBY_RC_MODE, |
lex9296 | 23:b9d23a2f390e | 116 | PAGE_STBY_XOSC_MODE, |
lex9296 | 23:b9d23a2f390e | 117 | PAGE_TX_CW, |
lex9296 | 23:b9d23a2f390e | 118 | PAGE_CONT_MODULATION |
lex9296 | 23:b9d23a2f390e | 119 | }; |
mverdy | 20:626b92b70bf7 | 120 | |
mverdy | 20:626b92b70bf7 | 121 | /*! |
mverdy | 20:626b92b70bf7 | 122 | * \brief Part of EEPROM to save or restore |
mverdy | 20:626b92b70bf7 | 123 | */ |
mverdy | 20:626b92b70bf7 | 124 | typedef enum |
mverdy | 20:626b92b70bf7 | 125 | { |
mverdy | 20:626b92b70bf7 | 126 | ALL_DATA, |
mverdy | 20:626b92b70bf7 | 127 | SCREEN_DATA, |
mverdy | 20:626b92b70bf7 | 128 | DEMO_SETTINGS, |
mverdy | 20:626b92b70bf7 | 129 | RADIO_LORA_PARAMS, |
mverdy | 20:626b92b70bf7 | 130 | RADIO_RANGING_PARAMS, |
mverdy | 20:626b92b70bf7 | 131 | RADIO_FLRC_PARAMS, |
mverdy | 20:626b92b70bf7 | 132 | RADIO_GFSK_PARAMS, |
mverdy | 20:626b92b70bf7 | 133 | RADIO_BLE_PARAMS |
mverdy | 20:626b92b70bf7 | 134 | }EepromDataSet_t; |
mverdy | 20:626b92b70bf7 | 135 | |
mverdy | 20:626b92b70bf7 | 136 | /*! |
lex9296 | 23:b9d23a2f390e | 137 | * \brief TFT calibration structure. |
lex9296 | 23:b9d23a2f390e | 138 | */ |
lex9296 | 23:b9d23a2f390e | 139 | typedef struct |
lex9296 | 23:b9d23a2f390e | 140 | { |
lex9296 | 23:b9d23a2f390e | 141 | bool ScreenCalibrated; |
lex9296 | 23:b9d23a2f390e | 142 | CalibrationMatrix Calibration; |
lex9296 | 23:b9d23a2f390e | 143 | }MenuSettings_t; |
lex9296 | 23:b9d23a2f390e | 144 | |
lex9296 | 23:b9d23a2f390e | 145 | /*! |
mverdy | 20:626b92b70bf7 | 146 | * \brief EepromData structure |
mverdy | 20:626b92b70bf7 | 147 | */ |
mverdy | 20:626b92b70bf7 | 148 | typedef struct |
mverdy | 20:626b92b70bf7 | 149 | { |
mverdy | 20:626b92b70bf7 | 150 | MenuSettings_t MenuSettings; |
lex9296 | 21:ab8027016a2c | 151 | // DemoSettings_t DemoSettings; |
lex9296 | 21:ab8027016a2c | 152 | // ModulationParams_t ModulationParams; |
lex9296 | 21:ab8027016a2c | 153 | // PacketParams_t PacketParams; |
mverdy | 20:626b92b70bf7 | 154 | uint16_t CheckSum; |
mverdy | 20:626b92b70bf7 | 155 | }EepromData_t; |
mverdy | 20:626b92b70bf7 | 156 | |
mverdy | 20:626b92b70bf7 | 157 | /*! |
mverdy | 20:626b92b70bf7 | 158 | * \brief Eeprom structure |
mverdy | 20:626b92b70bf7 | 159 | */ |
mverdy | 20:626b92b70bf7 | 160 | typedef struct |
mverdy | 20:626b92b70bf7 | 161 | { |
mverdy | 20:626b92b70bf7 | 162 | EepromData_t EepromData; |
mverdy | 20:626b92b70bf7 | 163 | // Allows for the checksum to be carried out |
mverdy | 20:626b92b70bf7 | 164 | uint8_t Buffer[EEPROM_BUFFER_SIZE]; |
mverdy | 20:626b92b70bf7 | 165 | }Eeprom_t; |
mverdy | 20:626b92b70bf7 | 166 | |
mverdy | 20:626b92b70bf7 | 167 | |
mverdy | 20:626b92b70bf7 | 168 | /*! |
mverdy | 20:626b92b70bf7 | 169 | * \brief Local copy of Eeprom. (defined in Eeprom.cpp) |
mverdy | 20:626b92b70bf7 | 170 | */ |
mverdy | 20:626b92b70bf7 | 171 | extern Eeprom_t Eeprom; |
mverdy | 20:626b92b70bf7 | 172 | |
mverdy | 20:626b92b70bf7 | 173 | |
mverdy | 20:626b92b70bf7 | 174 | /*! |
mverdy | 20:626b92b70bf7 | 175 | * \brief Initialises the contents of EepromData |
mverdy | 20:626b92b70bf7 | 176 | */ |
mverdy | 20:626b92b70bf7 | 177 | void EepromInit( void ); |
mverdy | 20:626b92b70bf7 | 178 | |
mverdy | 20:626b92b70bf7 | 179 | /*! |
mverdy | 20:626b92b70bf7 | 180 | * \brief Read Eeprom from emulated EEPROM (in fact in Flash " higher address). |
mverdy | 20:626b92b70bf7 | 181 | * |
mverdy | 20:626b92b70bf7 | 182 | * \param [in] addr address of data (EEPROM offset not to be include) |
mverdy | 20:626b92b70bf7 | 183 | * \param [in] buffer buffer to use for copy |
mverdy | 20:626b92b70bf7 | 184 | * \param [in] size size of data to copy |
mverdy | 20:626b92b70bf7 | 185 | * |
mverdy | 20:626b92b70bf7 | 186 | * \retval status Status of operation (SUCCESS, ..) |
mverdy | 20:626b92b70bf7 | 187 | */ |
mverdy | 20:626b92b70bf7 | 188 | uint8_t EepromMcuReadBuffer( uint16_t addr, uint8_t *buffer, uint16_t size ); |
mverdy | 20:626b92b70bf7 | 189 | |
mverdy | 20:626b92b70bf7 | 190 | /*! |
mverdy | 20:626b92b70bf7 | 191 | * \brief Writes the EepromData to emulated EEPROM |
mverdy | 20:626b92b70bf7 | 192 | * |
mverdy | 20:626b92b70bf7 | 193 | * \param [in] dataSet Set of data to save or restore |
mverdy | 20:626b92b70bf7 | 194 | */ |
mverdy | 20:626b92b70bf7 | 195 | void EepromSaveSettings( EepromDataSet_t dataSet); |
mverdy | 20:626b92b70bf7 | 196 | |
mverdy | 20:626b92b70bf7 | 197 | /*! |
mverdy | 20:626b92b70bf7 | 198 | * \brief Loads EepromData from emulated EEPROM |
mverdy | 20:626b92b70bf7 | 199 | */ |
mverdy | 20:626b92b70bf7 | 200 | void EepromLoadGeneralSettings ( void ); |
mverdy | 20:626b92b70bf7 | 201 | |
mverdy | 20:626b92b70bf7 | 202 | /*! |
mverdy | 20:626b92b70bf7 | 203 | * \brief Loads EepromData with updated modulation and packet parameters |
mverdy | 20:626b92b70bf7 | 204 | * |
mverdy | 20:626b92b70bf7 | 205 | * \param [in] modulation modulation type to select for mod. & packet params |
mverdy | 20:626b92b70bf7 | 206 | */ |
lex9296 | 21:ab8027016a2c | 207 | //void EepromLoadSettings( RadioPacketTypes_t modulation ); |
mverdy | 20:626b92b70bf7 | 208 | |
mverdy | 20:626b92b70bf7 | 209 | /*! |
mverdy | 20:626b92b70bf7 | 210 | * \brief Initialises the contents of flash to default values & save to EEPROM |
mverdy | 20:626b92b70bf7 | 211 | */ |
mverdy | 20:626b92b70bf7 | 212 | void EepromSetDefaultSettings( void ); |
mverdy | 20:626b92b70bf7 | 213 | |
mverdy | 20:626b92b70bf7 | 214 | /*! |
mverdy | 20:626b92b70bf7 | 215 | * \brief Initialises the contents of flash to default values (for ranging |
mverdy | 20:626b92b70bf7 | 216 | * demo : best set) & save to EEPROM |
mverdy | 20:626b92b70bf7 | 217 | */ |
mverdy | 20:626b92b70bf7 | 218 | void EepromSetRangingDefaultSettings( void ); |
mverdy | 20:626b92b70bf7 | 219 | |
mverdy | 20:626b92b70bf7 | 220 | /*! |
mverdy | 20:626b92b70bf7 | 221 | * \brief Reset the EEPROM to factory state |
mverdy | 20:626b92b70bf7 | 222 | */ |
mverdy | 20:626b92b70bf7 | 223 | void EepromFactoryReset( void ); |
mverdy | 20:626b92b70bf7 | 224 | |
mverdy | 20:626b92b70bf7 | 225 | #endif //EEPROM_H |
mverdy | 20:626b92b70bf7 | 226 |