Stabilus 322699 wDoublePID

Dependencies:   mbed QEI PID DmTftLibraryEx

Committer:
mverdy
Date:
Thu Nov 08 10:14:39 2018 +0000
Revision:
20:626b92b70bf7
Child:
21:ab8027016a2c
Addition of missing modules to synchronize with v1.5.2

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: 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"
mverdy 20:626b92b70bf7 20 #include "DemoApplication.h"
mverdy 20:626b92b70bf7 21 #include "sx1280.h"
mverdy 20:626b92b70bf7 22
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
mverdy 20:626b92b70bf7 99
mverdy 20:626b92b70bf7 100 /*!
mverdy 20:626b92b70bf7 101 * \brief Part of EEPROM to save or restore
mverdy 20:626b92b70bf7 102 */
mverdy 20:626b92b70bf7 103 typedef enum
mverdy 20:626b92b70bf7 104 {
mverdy 20:626b92b70bf7 105 ALL_DATA,
mverdy 20:626b92b70bf7 106 SCREEN_DATA,
mverdy 20:626b92b70bf7 107 DEMO_SETTINGS,
mverdy 20:626b92b70bf7 108 RADIO_LORA_PARAMS,
mverdy 20:626b92b70bf7 109 RADIO_RANGING_PARAMS,
mverdy 20:626b92b70bf7 110 RADIO_FLRC_PARAMS,
mverdy 20:626b92b70bf7 111 RADIO_GFSK_PARAMS,
mverdy 20:626b92b70bf7 112 RADIO_BLE_PARAMS
mverdy 20:626b92b70bf7 113 }EepromDataSet_t;
mverdy 20:626b92b70bf7 114
mverdy 20:626b92b70bf7 115 /*!
mverdy 20:626b92b70bf7 116 * \brief EepromData structure
mverdy 20:626b92b70bf7 117 */
mverdy 20:626b92b70bf7 118 typedef struct
mverdy 20:626b92b70bf7 119 {
mverdy 20:626b92b70bf7 120 MenuSettings_t MenuSettings;
mverdy 20:626b92b70bf7 121 DemoSettings_t DemoSettings;
mverdy 20:626b92b70bf7 122 ModulationParams_t ModulationParams;
mverdy 20:626b92b70bf7 123 PacketParams_t PacketParams;
mverdy 20:626b92b70bf7 124 uint16_t CheckSum;
mverdy 20:626b92b70bf7 125 }EepromData_t;
mverdy 20:626b92b70bf7 126
mverdy 20:626b92b70bf7 127 /*!
mverdy 20:626b92b70bf7 128 * \brief Eeprom structure
mverdy 20:626b92b70bf7 129 */
mverdy 20:626b92b70bf7 130 typedef struct
mverdy 20:626b92b70bf7 131 {
mverdy 20:626b92b70bf7 132 EepromData_t EepromData;
mverdy 20:626b92b70bf7 133 // Allows for the checksum to be carried out
mverdy 20:626b92b70bf7 134 uint8_t Buffer[EEPROM_BUFFER_SIZE];
mverdy 20:626b92b70bf7 135 }Eeprom_t;
mverdy 20:626b92b70bf7 136
mverdy 20:626b92b70bf7 137
mverdy 20:626b92b70bf7 138 /*!
mverdy 20:626b92b70bf7 139 * \brief Local copy of Eeprom. (defined in Eeprom.cpp)
mverdy 20:626b92b70bf7 140 */
mverdy 20:626b92b70bf7 141 extern Eeprom_t Eeprom;
mverdy 20:626b92b70bf7 142
mverdy 20:626b92b70bf7 143
mverdy 20:626b92b70bf7 144 /*!
mverdy 20:626b92b70bf7 145 * \brief Initialises the contents of EepromData
mverdy 20:626b92b70bf7 146 */
mverdy 20:626b92b70bf7 147 void EepromInit( void );
mverdy 20:626b92b70bf7 148
mverdy 20:626b92b70bf7 149 /*!
mverdy 20:626b92b70bf7 150 * \brief Read Eeprom from emulated EEPROM (in fact in Flash " higher address).
mverdy 20:626b92b70bf7 151 *
mverdy 20:626b92b70bf7 152 * \param [in] addr address of data (EEPROM offset not to be include)
mverdy 20:626b92b70bf7 153 * \param [in] buffer buffer to use for copy
mverdy 20:626b92b70bf7 154 * \param [in] size size of data to copy
mverdy 20:626b92b70bf7 155 *
mverdy 20:626b92b70bf7 156 * \retval status Status of operation (SUCCESS, ..)
mverdy 20:626b92b70bf7 157 */
mverdy 20:626b92b70bf7 158 uint8_t EepromMcuReadBuffer( uint16_t addr, uint8_t *buffer, uint16_t size );
mverdy 20:626b92b70bf7 159
mverdy 20:626b92b70bf7 160 /*!
mverdy 20:626b92b70bf7 161 * \brief Writes the EepromData to emulated EEPROM
mverdy 20:626b92b70bf7 162 *
mverdy 20:626b92b70bf7 163 * \param [in] dataSet Set of data to save or restore
mverdy 20:626b92b70bf7 164 */
mverdy 20:626b92b70bf7 165 void EepromSaveSettings( EepromDataSet_t dataSet);
mverdy 20:626b92b70bf7 166
mverdy 20:626b92b70bf7 167 /*!
mverdy 20:626b92b70bf7 168 * \brief Loads EepromData from emulated EEPROM
mverdy 20:626b92b70bf7 169 */
mverdy 20:626b92b70bf7 170 void EepromLoadGeneralSettings ( void );
mverdy 20:626b92b70bf7 171
mverdy 20:626b92b70bf7 172 /*!
mverdy 20:626b92b70bf7 173 * \brief Loads EepromData with updated modulation and packet parameters
mverdy 20:626b92b70bf7 174 *
mverdy 20:626b92b70bf7 175 * \param [in] modulation modulation type to select for mod. & packet params
mverdy 20:626b92b70bf7 176 */
mverdy 20:626b92b70bf7 177 void EepromLoadSettings( RadioPacketTypes_t modulation );
mverdy 20:626b92b70bf7 178
mverdy 20:626b92b70bf7 179 /*!
mverdy 20:626b92b70bf7 180 * \brief Initialises the contents of flash to default values & save to EEPROM
mverdy 20:626b92b70bf7 181 */
mverdy 20:626b92b70bf7 182 void EepromSetDefaultSettings( void );
mverdy 20:626b92b70bf7 183
mverdy 20:626b92b70bf7 184 /*!
mverdy 20:626b92b70bf7 185 * \brief Initialises the contents of flash to default values (for ranging
mverdy 20:626b92b70bf7 186 * demo : best set) & save to EEPROM
mverdy 20:626b92b70bf7 187 */
mverdy 20:626b92b70bf7 188 void EepromSetRangingDefaultSettings( void );
mverdy 20:626b92b70bf7 189
mverdy 20:626b92b70bf7 190 /*!
mverdy 20:626b92b70bf7 191 * \brief Reset the EEPROM to factory state
mverdy 20:626b92b70bf7 192 */
mverdy 20:626b92b70bf7 193 void EepromFactoryReset( void );
mverdy 20:626b92b70bf7 194
mverdy 20:626b92b70bf7 195 #endif //EEPROM_H
mverdy 20:626b92b70bf7 196