1 // ********************************************************************* 2 // IQRF standards header file * 3 // ********************************************************************* 4 // Copyright (c) MICRORISC s.r.o. 5 // 6 // File: $RCSfile: IQRFstandard.h,v $ 7 // Version: $Revision: 1.108 $ 8 // Date: $Date: 2024/04/17 12:50:14 $ 9 // 10 // Revision history: 11 // 2024/04/17 Release for DPA 4.31 12 // 2023/03/07 Release for DPA 4.30 13 // 2022/10/05 Release for DPA 4.18 14 // 2022/02/24 Release for DPA 4.17 15 // 2021/08/20 Release for DPA 4.16 16 // 2020/09/03 Release for DPA 4.15 17 // 2020/04/03 Release for DPA 4.14 18 // 2020/02/27 Release for DPA 4.13 19 // 2020/01/09 Release for DPA 4.12 20 // 2019/12/11 Release for DPA 4.11 21 // 2019/10/09 Release for DPA 4.10 22 // 2019/06/12 Release for DPA 4.03 23 // 2019/06/03 Release for DPA 4.02 24 // 2019/03/07 Release for DPA 4.01 25 // 2019/01/20 Release for DPA 4.00 26 // 2018/10/25 Release for DPA 3.03 27 // 2017/11/16 Release for DPA 3.02 28 // 2017/08/14 Release for DPA 3.01 29 // 30 // ********************************************************************* 31 32 // Online DPA documentation https://doc.iqrf.org/DpaTechGuide/ 33 // IQRF Standards documentation https://doc.iqrf.org/ 34 35 #ifndef _IQRFSTD_HEADER_ 36 #define _IQRFSTD_HEADER_ 37 38 //############################################################################################ 39 40 // Enumerate command valid for standards, when applicable 41 #define PCMD_STD_ENUMERATE 0x3E 42 43 #define FRC_STD_FRC_NO_VALUE 0 44 #define FRC_STD_FRC_NOT_IMPLEMENTED_VALUE 1 45 #define FRC_STD_FRC_ERROR_VALUE 2 46 #define FRC_STD_FRC_RESERVED 3 47 48 // ------------------------------------------------------------------------------------------- 49 // IQRF Sensors standard 50 // ------------------------------------------------------------------------------------------- 51 // IQRF Sensors standard peripheral 52 #define PNUM_STD_SENSORS 0x5E 53 // IQRF Sensors standard peripheral type 54 #define PERIPHERAL_TYPE_STD_SENSORS 0x5E 55 // Current version 56 #define STD_SENSORS_VERSION 15 57 58 // IQRF Sensors standard peripheral - read sensor values command 59 #define PCMD_STD_SENSORS_READ_VALUES 0x00 60 // IQRF Sensors standard peripheral - read sensor types and values command 61 #define PCMD_STD_SENSORS_READ_TYPES_AND_VALUES 0x01 62 63 // Beaming sensor command 64 #define PCMD_STD_SENSORS_READ_TYPES_AND_FRC_VALUES 0x7B 65 66 // IQRF Sensors standard peripheral - sensor types 67 #define STD_SENSOR_TYPE_NONE 0x00 68 // 2 bytes 69 #define STD_SENSOR_TYPE_TEMPERATURE 0x01 70 #define STD_SENSOR_TYPE_CO2 0x02 71 #define STD_SENSOR_TYPE_VOC 0x03 72 #define STD_SENSOR_TYPE_EXTRA_LOW_VOLTAGE 0x04 73 #define STD_SENSOR_TYPE_EARTHS_MAGNETIC_FIELD 0x05 74 #define STD_SENSOR_TYPE_LOW_VOLTAGE 0x06 75 #define STD_SENSOR_TYPE_CURRENT 0x07 76 #define STD_SENSOR_TYPE_POWER 0x08 77 #define STD_SENSOR_TYPE_MAINS_FREQUENCY 0x09 78 #define STD_SENSOR_TYPE_TIMESPAN 0x0A 79 #define STD_SENSOR_TYPE_ILLUMINANCE 0x0B 80 #define STD_SENSOR_TYPE_NO2 0x0C 81 #define STD_SENSOR_TYPE_SO2 0x0D 82 #define STD_SENSOR_TYPE_CO 0x0E 83 #define STD_SENSOR_TYPE_O3 0x0F 84 #define STD_SENSOR_TYPE_ATMOSPHERIC_PRESSURE 0x10 85 #define STD_SENSOR_TYPE_COLOR_TEMPERATURE 0x11 86 #define STD_SENSOR_TYPE_PARTICULATES_PM25 0x12 87 #define STD_SENSOR_TYPE_SOUND_PRESSURE_LEVEL 0x13 88 #define STD_SENSOR_TYPE_ALTITUDE 0x14 89 #define STD_SENSOR_TYPE_ACCELERATION 0x15 90 #define STD_SENSOR_TYPE_NH3 0x16 91 #define STD_SENSOR_TYPE_METHANE 0x17 92 #define STD_SENSOR_TYPE_SHORT_LENGTH 0x18 93 #define STD_SENSOR_TYPE_PARTICULATES_PM1 0x19 94 #define STD_SENSOR_TYPE_PARTICULATES_PM4 0x1A 95 #define STD_SENSOR_TYPE_PARTICULATES_PM10 0x1B 96 #define STD_SENSOR_TYPE_TVOC 0x1C 97 #define STD_SENSOR_TYPE_NOX 0x1D 98 99 // 1 byte 100 #define STD_SENSOR_TYPE_HUMIDITY 0x80 101 #define STD_SENSOR_TYPE_BINARYDATA7 0x81 102 #define STD_SENSOR_TYPE_POWER_FACTOR 0x82 103 #define STD_SENSOR_TYPE_UV_INDEX 0x83 104 #define STD_SENSOR_TYPE_PH 0x84 105 #define STD_SENSOR_TYPE_RSSI 0x85 106 107 // 4 bytes 108 #define STD_SENSOR_TYPE_BINARYDATA30 0xA0 109 #define STD_SENSOR_TYPE_CONSUMPTION 0xA1 110 #define STD_SENSOR_TYPE_DATETIME 0xA2 111 #define STD_SENSOR_TYPE_TIMESPAN_LONG 0xA3 112 #define STD_SENSOR_TYPE_LATITUDE 0xA4 113 #define STD_SENSOR_TYPE_LONGITUDE 0xA5 114 #define STD_SENSOR_TYPE_TEMPERATURE_FLOAT 0xA6 115 #define STD_SENSOR_TYPE_LENGTH 0xA7 116 117 // Computes constant (otherwise not optimal) quantity size 118 #define STD_SENSOR_TYPE_SIZE(q) ( ( ( (q) & 0x80 ) == 0x00 ) * 2 + ( ( (q) & 0xE0 ) == 0x80 ) * 1 + ( ( (q) & 0xE0 ) == 0xA0 ) * 4 + ( ( q & 0xC0 ) == 0xC0 || (q) == 0x00 ) * 0xFfFfFfFf /* hopefully causes overflow to signal error */ ) 119 120 // Multiple bytes 121 #define STD_SENSOR_TYPE_DATA_BLOCK 0xC0 122 123 // IQRF Sensors standard peripheral - FRC commands 124 #define FRC_STD_SENSORS_BIT 0x10 125 #define FRC_STD_SENSORS_1B 0x90 126 #define FRC_STD_SENSORS_2B 0xE0 127 #define FRC_STD_SENSORS_4B 0xF9 128 129 // Used at Local FRC by Controller to send quantities' values 130 #define FRC_STD_SENSORS_CTRL_CMD 0x11 131 132 typedef struct 133 { 134 // Equals to PNUM_STD_SENSORS 135 uns8 Header; 136 // Sensor type STD_SENSOR_TYPE_??? 137 uns8 SensorType; 138 // Sensor index (bits 0-4) + optional extended data (bits 5-7) 139 uns8 SensorIndex; 140 // Options 141 // bit 0 : sleep 142 // bits 1-7: reserved 143 uns8 Options; 144 // Optional sleep parameters 145 TPerOSSleep_Request SleepParameters; 146 } STRUCTATTR TPerStdSensorFrc; 147 148 149 #if defined( __CC5X__ ) && !defined( CC5XnotDPA ) 150 // The above structure located at memory 151 TPerStdSensorFrc PerStdSensorFrc @ DataOutBeforeResponseFRC; 152 #endif // #ifdef __CC5X__ 153 154 // Structure for PCMD_STD_SENSORS_READ[_TYPES_AND]_VALUES 155 typedef struct 156 { 157 uns8 Bitmap[4]; 158 uns8 WrittenData[DPA_MAX_DATA_LENGTH - 4]; 159 } STRUCTATTR TPerStdSensorRead_Request; 160 161 // IQRF Sensors standard peripheral - error values 162 // 2 bytes 163 #define STD_SENSOR_TYPE_TEMPERATURE_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 164 #define STD_SENSOR_TYPE_TEMPERATURE_IS_ERROR(v) ( (v) == 0x8000 ) 165 166 #define STD_SENSOR_TYPE_CO2_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 167 #define STD_SENSOR_TYPE_CO2_IS_ERROR(v) ( (v) == 0x8000 ) 168 169 #define STD_SENSOR_TYPE_VOC_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 170 #define STD_SENSOR_TYPE_VOC_IS_ERROR(v) ( (v) == 0x8000 ) 171 172 #define STD_SENSOR_TYPE_EXTRA_LOW_VOLTAGE_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 173 #define STD_SENSOR_TYPE_EXTRA_LOW_VOLTAGE_IS_ERROR(v) ( (v) == 0x8000 ) 174 175 #define STD_SENSOR_TYPE_EARTHS_MAGNETIC_FIELD_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 176 #define STD_SENSOR_TYPE_EARTHS_MAGNETIC_FIELD_IS_ERROR(v) ( (v) == 0x8000 ) 177 178 #define STD_SENSOR_TYPE_LOW_VOLTAGE_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 179 #define STD_SENSOR_TYPE_LOW_VOLTAGE_IS_ERROR(v) ( (v) == 0x8000 ) 180 181 #define STD_SENSOR_TYPE_CURRENT_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 182 #define STD_SENSOR_TYPE_CURRENT_IS_ERROR(v) ( (v) == 0x8000 ) 183 184 #define STD_SENSOR_TYPE_POWER_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 185 #define STD_SENSOR_TYPE_POWER_IS_ERROR(v) ( (v) == 0xFfFf ) 186 187 #define STD_SENSOR_TYPE_MAINS_FREQUENCY_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 188 #define STD_SENSOR_TYPE_MAINS_FREQUENCY_IS_ERROR(v) ( (v) == 0xFfFf ) 189 190 #define STD_SENSOR_TYPE_TIMESPAN_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 191 #define STD_SENSOR_TYPE_TIMESPAN_IS_ERROR(v) ( (v) == 0xFfFf ) 192 193 #define STD_SENSOR_TYPE_ILLUMINANCE_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 194 #define STD_SENSOR_TYPE_ILLUMINANCE_IS_ERROR(v) ( (v) == 0xFfFf ) 195 196 #define STD_SENSOR_TYPE_NO2_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 197 #define STD_SENSOR_TYPE_NO2_IS_ERROR(v) ( (v) == 0xFfFf ) 198 199 #define STD_SENSOR_TYPE_SO2_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 200 #define STD_SENSOR_TYPE_SO2_IS_ERROR(v) ( (v) == 0xFfFf ) 201 202 #define STD_SENSOR_TYPE_CO_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 203 #define STD_SENSOR_TYPE_CO_IS_ERROR(v) ( (v) == 0xFfFf ) 204 205 #define STD_SENSOR_TYPE_O3_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 206 #define STD_SENSOR_TYPE_O3_IS_ERROR(v) ( (v) == 0xFfFf ) 207 208 #define STD_SENSOR_TYPE_ATMOSPHERIC_PRESSURE_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 209 #define STD_SENSOR_TYPE_ATMOSPHERIC_PRESSURE_IS_ERROR(v) ( (v) == 0xFfFf ) 210 211 #define STD_SENSOR_TYPE_COLOR_TEMPERATURE_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 212 #define STD_SENSOR_TYPE_COLOR_TEMPERATURE_IS_ERROR(v) ( (v) == 0x8000 ) 213 214 #define STD_SENSOR_TYPE_PARTICULATES_PM25_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 215 #define STD_SENSOR_TYPE_PARTICULATES_PM25_IS_ERROR(v) ( (v) == 0x8000 ) 216 217 #define STD_SENSOR_TYPE_SOUND_PRESSURE_LEVEL_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 218 #define STD_SENSOR_TYPE_SOUND_PRESSURE_LEVEL_IS_ERROR(v) ( (v) == 0x8000 ) 219 220 #define STD_SENSOR_TYPE_ALTITUDE_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 221 #define STD_SENSOR_TYPE_ALTITUDE_IS_ERROR(v) ( (v) == 0xFfFf ) 222 223 #define STD_SENSOR_TYPE_ACCELERATION_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 224 #define STD_SENSOR_TYPE_ACCELERATION_IS_ERROR(v) ( (v) == 0x8000 ) 225 226 #define STD_SENSOR_TYPE_NH3_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 227 #define STD_SENSOR_TYPE_NH3_IS_ERROR(v) ( (v) == 0xFfFf ) 228 229 #define STD_SENSOR_TYPE_METHANE_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 230 #define STD_SENSOR_TYPE_METHANE_IS_ERROR(v) ( (v) == 0xFfFf ) 231 232 #define STD_SENSOR_TYPE_SHORT_LENGTH_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 233 #define STD_SENSOR_TYPE_SHORT_LENGTH_IS_ERROR(v) ( (v) == 0xFfFf ) 234 235 #define STD_SENSOR_TYPE_PARTICULATES_PM1_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 236 #define STD_SENSOR_TYPE_PARTICULATES_PM1_IS_ERROR(v) ( (v) == 0x8000 ) 237 238 #define STD_SENSOR_TYPE_PARTICULATES_PM4_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 239 #define STD_SENSOR_TYPE_PARTICULATES_PM4_IS_ERROR(v) ( (v) == 0x8000 ) 240 241 #define STD_SENSOR_TYPE_PARTICULATES_PM10_SET_ERROR(v) do { v = 0x8000; } while( 0 ) 242 #define STD_SENSOR_TYPE_PARTICULATES_PM10_IS_ERROR(v) ( (v) == 0x8000 ) 243 244 #define STD_SENSOR_TYPE_TVOC_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 245 #define STD_SENSOR_TYPE_TVOC_IS_ERROR(v) ( (v) == 0xFfFf ) 246 247 #define STD_SENSOR_TYPE_NOX_SET_ERROR(v) do { v = 0xFfFf; } while( 0 ) 248 #define STD_SENSOR_TYPE_NOX_IS_ERROR(v) ( (v) == 0xFfFf ) 249 250 // 1 byte 251 #define STD_SENSOR_TYPE_HUMIDITY_SET_ERROR(v) do { v = 0xEE; } while( 0 ) 252 #define STD_SENSOR_TYPE_HUMIDITY_IS_ERROR(v) ( (v) == 0xEE ) 253 254 #define STD_SENSOR_TYPE_BINARYDATA7_SET_ERROR(v) do { v = 0x80; } while( 0 ) 255 #define STD_SENSOR_TYPE_BINARYDATA7_IS_ERROR(v) ( ( (v) & 0x80 ) != 0x00 ) 256 257 #define STD_SENSOR_TYPE_POWER_FACTOR_SET_ERROR(v) do { v = 0xEE; } while( 0 ) 258 #define STD_SENSOR_TYPE_POWER_FACTOR_IS_ERROR(v) ( (v) == 0xEE ) 259 260 #define STD_SENSOR_TYPE_UV_INDEX_SET_ERROR(v) do { v = 0xFF; } while( 0 ) 261 #define STD_SENSOR_TYPE_UV_INDEX_IS_ERROR(v) ( (v) == 0xFF ) 262 263 #define STD_SENSOR_TYPE_PH_INDEX_SET_ERROR(v) do { v = 0xFF; } while( 0 ) 264 #define STD_SENSOR_TYPE_PH_INDEX_IS_ERROR(v) ( (v) == 0xFF ) 265 266 #define STD_SENSOR_TYPE_RSSI_INDEX_SET_ERROR(v) do { v = 0xFF; } while( 0 ) 267 #define STD_SENSOR_TYPE_RSSI_INDEX_IS_ERROR(v) ( (v) == 0xFF ) 268 269 // 4 bytes 270 #define STD_SENSOR_TYPE_BINARYDATA30_SET_ERROR(v) do { v = 0x80000000; } while( 0 ) 271 #define STD_SENSOR_TYPE_BINARYDATA30_IS_ERROR(v) ( ( (v) & 0x80000000 ) != 0x00000000 ) 272 273 #define STD_SENSOR_TYPE_CONSUMPTION_SET_ERROR(v) do { v = 0xFfFfFfFf; } while( 0 ) 274 #define STD_SENSOR_TYPE_CONSUMPTION_IS_ERROR(v) ( (v) == 0xFfFfFfFf ) 275 276 #define STD_SENSOR_TYPE_DATETIME_SET_ERROR(v) do { v = 0xFfFfFfFf; } while( 0 ) 277 #define STD_SENSOR_TYPE_DATETIME_IS_ERROR(v) ( (v) == 0xFfFfFfFf ) 278 279 #define STD_SENSOR_TYPE_TIMESPAN_LONG_SET_ERROR(v) do { v = 0xFfFfFfFf; } while( 0 ) 280 #define STD_SENSOR_TYPE_TIMESPAN_LONG_IS_ERROR(v) ( (v) == 0xFfFfFfFf ) 281 282 #define STD_SENSOR_TYPE_LATITUDE_SET_ERROR(v) do { v = 0xFF000000; } while( 0 ) 283 #define STD_SENSOR_TYPE_LATITUDE_IS_ERROR(v) ( ( (v) & 0xFF000000 ) == 0xFF000000 ) 284 285 #define STD_SENSOR_TYPE_LONGITUDE_SET_ERROR(v) do { v = 0xFF000000; } while( 0 ) 286 #define STD_SENSOR_TYPE_LONGITUDE_IS_ERROR(v) ( ( (v) & 0xFF000000 ) == 0xFF000000 ) 287 288 #define STD_SENSOR_TYPE_TEMPERATURE_FLOAT_SET_ERROR(v) do { v = 0x7FfFfFfF; /* NaN */ } while( 0 ) 289 #define STD_SENSOR_TYPE_TEMPERATURE_FLOAT_IS_ERROR(v) ( /* Test for NaN */ ( (v) & 0x7F800000 ) == 0x7F800000 /* Exponent==0xFF */ && ( (v) & 0x007FfFfF ) != 0 /* Fraction != 0 */ ) 290 291 #define STD_SENSOR_TYPE_LENGTH_SET_ERROR(v) do { v = 0x7FfFfFfF; /* NaN */ } while( 0 ) 292 #define STD_SENSOR_TYPE_LENGTH_IS_ERROR(v) ( /* Test for NaN */ ( (v) & 0x7F800000 ) == 0x7F800000 /* Exponent==0xFF */ && ( (v) & 0x007FfFfF ) != 0 /* Fraction != 0 */ ) 293 294 // Written data constants 295 #define STD_SENSOR_TYPE_TEMPERATURE_DATA_GET_1_POINT_CALIBRATION 1 296 #define STD_SENSOR_TYPE_TEMPERATURE_DATA_SET_1_POINT_CALIBRATION 2 297 298 #define STD_SENSOR_TYPE_HUMIDITY_DATA_GET_1_POINT_CALIBRATION 1 299 #define STD_SENSOR_TYPE_HUMIDITY_DATA_SET_1_POINT_CALIBRATION 2 300 301 // ------------------------------------------------------------------------------------------- 302 // IQRF Binary Outputs standard 303 // ------------------------------------------------------------------------------------------- 304 // IQRF Binary Outputs standard peripheral 305 #define PNUM_STD_BINARY_OUTPUTS 0x4B 306 // IQRF Binary Outputs peripheral type 307 #define PERIPHERAL_TYPE_STD_BINARY_OUTPUTS 0x4B 308 // Current version 309 #define STD_BINARY_OUTPUTS_VERSION 4 310 311 // IQRF Binary Outputs standard peripheral - set outputs 312 #define PCMD_STD_BINARY_OUTPUTS_SET 0x00 313 314 // Structure returned by PCMD_STD_ENUMERATE 315 typedef struct 316 { 317 uns8 Count; 318 } STRUCTATTR TPerStdBinaryOutputEnumerate_Response; 319 320 // Structure for PCMD_STD_BINARY_OUTPUTS_SET 321 typedef struct 322 { 323 uns8 Bitmap[4]; 324 uns8 NewState[DPA_MAX_DATA_LENGTH - 4]; 325 } STRUCTATTR TPerStdBinaryOutputSet_Request; 326 327 #define STD_BINARY_OUTPUT_STATE_OFF 0x00 328 #define STD_BINARY_OUTPUT_STATE_ON 0x01 329 330 #define STD_BINARY_OUTPUT_IS_STATE_OK(state) ( (state) != 0x80 ) 331 #define STD_BINARY_OUTPUT_IS_STATE_OFF(state) ( (state) == STD_BINARY_OUTPUT_STATE_OFF ) 332 #define STD_BINARY_OUTPUT_IS_STATE_ON(state) ( (state) >= STD_BINARY_OUTPUT_STATE_ON ) 333 #define STD_BINARY_OUTPUT_STATE_HAS_TIME(state) ( (state) > STD_BINARY_OUTPUT_STATE_ON ) 334 #define STD_BINARY_OUTPUT_STATE_TIME_IN_SECONDS(state) ( ( (state) & 0x80 ) != 0x00 ) 335 #define STD_BINARY_OUTPUT_STATE_GET_SECONDS(state) ( (state) & 0x7F ) 336 #define STD_BINARY_OUTPUT_STATE_TIME_IN_MINUTES(state) ( (state) > STD_BINARY_OUTPUT_STATE_ON && (state) <= 0x7F ) 337 #define STD_BINARY_OUTPUT_STATE_GET_MINUTES(state) (state) 338 339 // Structure returned by PCMD_STD_BINARY_OUTPUTS_SET 340 typedef struct 341 { 342 uns8 PreviousStates[4]; 343 } STRUCTATTR TPerStdBinaryOutputSet_Response; 344 345 346 // ------------------------------------------------------------------------------------------- 347 // IQRF Light standard 348 // ------------------------------------------------------------------------------------------- 349 // IQRF Light standard peripheral 350 #define PNUM_STD_LIGHT 0x71 351 // IQRF Light standard peripheral type 352 #define PERIPHERAL_TYPE_STD_LIGHT 0x71 353 // Current version 354 #define STD_LIGHT_VERSION 5 355 356 // IQRF Light standard peripheral - Set Power 357 #define PCMD_STD_LIGHT_SET 0x00 358 // IQRF Light standard peripheral - Increment Power 359 #define PCMD_STD_LIGHT_INC 0x01 360 // IQRF Light standard peripheral - Decrement Power 361 #define PCMD_STD_LIGHT_DEC 0x02 362 363 // IQRF Light standard peripheral - FRC commands 364 #define FRC_STD_LIGHT_ONOFF 0x10 365 #define FRC_STD_LIGHT_ALARM 0x11 366 367 // Structure returned by PCMD_STD_ENUMERATE 368 typedef struct 369 { 370 uns8 Count; 371 } STRUCTATTR TPerStdLightEnumerate_Response; 372 373 // Structure for PCMD_STD_LIGHT_??? 374 typedef struct 375 { 376 uns8 Bitmap[4]; 377 uns8 Power[DPA_MAX_DATA_LENGTH - 4]; 378 } STRUCTATTR TPerStdLightSetIncDec_Request; 379 380 #define STD_LIGHT_POWER_MIN 0 381 #define STD_LIGHT_POWER_MAX 100 382 #define STD_LIGHT_KEEP_POWER 127 383 #define STD_LIGHT_IS_POWER_OK(power) ( ( ( (power) & 0x7F ) <= STD_LIGHT_POWER_MAX ) || ( (power) & 0x7F ) == STD_LIGHT_KEEP_POWER ) 384 #define STD_LIGHT_TIME_FOLLOWS_POWER(power) ( ( (power) & 0x80 ) != 0x00 ) 385 386 #define STD_LIGHT_IS_TIME_OK(time) ( ( (time) & 0x7F ) != 0x00 ) 387 #define STD_LIGHT_TIME_IN_SECONDS(time) ( ( (time) & 0x80 ) != 0x00 ) 388 #define STD_LIGHT_TIME_GET_SECONDS(time) ( (time) & 0x7F ) 389 #define STD_LIGHT_TIME_IN_MINUTES(time) ( !STD_LIGHT_TIME_IN_SECONDS( time ) ) 390 #define STD_LIGHT_TIME_GET_MINUTES(time) (time) 391 392 // ------------------------------------------------------------------------------------------- 393 // IQRF DALI standard 394 // ------------------------------------------------------------------------------------------- 395 // IQRF DALI standard peripheral 396 #define PNUM_STD_DALI 0x4A 397 // IQRF DALI standard peripheral type 398 #define PERIPHERAL_TYPE_STD_DALI 0x4A 399 // Current version 400 #define STD_DALI_VERSION 0 401 402 // IQRF DALI standard peripheral - Send DALI commands 403 #define PCMD_STD_DALI_SEND_COMMANDS 0x00 404 // IQRF DALI standard peripheral - Send DALI commands asynchronously 405 #define PCMD_STD_DALI_SEND_COMMANDS_ASYNC 0x01 406 407 // IQRF DALI standard peripheral - FRC commands 408 #define FRC_STD_DALI_SEND 0xE0 409 410 // DALI answer byte #0 411 #if defined( __CC5X__ ) 412 typedef struct 413 { 414 bit Answer; 415 bit AnswerError; 416 bit _bit2_reserved; 417 bit _bit3_reserved; 418 bit _bit4_reserved; 419 bit _bit5_reserved; 420 bit _bit6_reserved; 421 bit Always1; 422 } TSTD_DALI_Answer0; 423 #else 424 typedef struct 425 { 426 unsigned Answer : 1; 427 unsigned AnswerError : 1; 428 unsigned _bit2_reserved : 1; 429 unsigned _bit3_reserved : 1; 430 unsigned _bit4_reserved : 1; 431 unsigned _bit5_reserved : 1; 432 unsigned _bit6_reserved : 1; 433 unsigned Always1; 434 } STRUCTATTR TSTD_DALI_Answer0; 435 #endif 436 437 // ------------------------------------------------------------------------------------------- 438 439 // DPA Message data structure (packet w/o NADR, PNUM, PCMD, HWPID) for IQRF standards 440 typedef union 441 { 442 // Structure for PCMD_STD_SENSORS_READ[_TYPES_AND]_VALUES 443 TPerStdSensorRead_Request PerStdSensorRead_Request; 444 445 // Structure returned by PCMD_STD_ENUMERATE for binary output 446 TPerStdBinaryOutputEnumerate_Response PerStdBinaryOutputEnumerate_Response; 447 448 // Structure for PCMD_STD_BINARY_OUTPUTS_SET 449 TPerStdBinaryOutputSet_Request PerStdBinaryOutputSet_Request; 450 451 // Structure returned by PCMD_STD_BINARY_OUTPUTS_SET 452 TPerStdBinaryOutputSet_Response PerStdBinaryOutputSet_Response; 453 454 // Structure returned by PCMD_STD_ENUMERATE for light 455 TPerStdLightEnumerate_Response PerStdLightEnumerate_Response; 456 } TDpaMessageIqrfStd; 457 458 #if defined( __CC5X__ ) && !defined( CC5XnotDPA ) 459 // The structure above mapped at the DpaMessage 460 TDpaMessageIqrfStd _DpaMessageIqrfStd @ DpaRfMessage; 461 #endif // #ifdef __CC5X__ 462 463 // ------------------------------------------------------------------------------------------- 464 465 #endif // _IQRFSTD_HEADER_ 466 467 //############################################################################################