Gas Pressure Display Updated Power control for Pressure sensor added

Dependencies:   UniGraphic mbed vt100

Committer:
Rhyme
Date:
Fri Feb 16 08:27:50 2018 +0000
Revision:
0:37c8ecde13c2
control PSE530 power via PTC5 (pse530_en)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:37c8ecde13c2 1 #ifndef _AF_ATTRIBUTES_H_
Rhyme 0:37c8ecde13c2 2 #define _AF_ATTRIBUTES_H_
Rhyme 0:37c8ecde13c2 3
Rhyme 0:37c8ecde13c2 4 #include "mbed.h"
Rhyme 0:37c8ecde13c2 5 #include "afLib.h"
Rhyme 0:37c8ecde13c2 6
Rhyme 0:37c8ecde13c2 7 /**
Rhyme 0:37c8ecde13c2 8 * af_attributes.h
Rhyme 0:37c8ecde13c2 9 *
Rhyme 0:37c8ecde13c2 10 */
Rhyme 0:37c8ecde13c2 11
Rhyme 0:37c8ecde13c2 12 #define ATTRIBUTE_TYPE_SINT8 2
Rhyme 0:37c8ecde13c2 13 #define ATTRIBUTE_TYPE_SINT16 3
Rhyme 0:37c8ecde13c2 14 #define ATTRIBUTE_TYPE_SINT32 4
Rhyme 0:37c8ecde13c2 15 #define ATTRIBUTE_TYPE_SINT64 5
Rhyme 0:37c8ecde13c2 16 #define ATTRIBUTE_TYPE_BOOLEAN 1
Rhyme 0:37c8ecde13c2 17 #define ATTRIBUTE_TYPE_UTF8S 20
Rhyme 0:37c8ecde13c2 18 #define ATTRIBUTE_TYPE_BYTES 21
Rhyme 0:37c8ecde13c2 19 #define ATTRIBUTE_TYPE_FIXED_15_16 6
Rhyme 0:37c8ecde13c2 20
Rhyme 0:37c8ecde13c2 21 #define afSUCCESS 0 // Operation completed successfully
Rhyme 0:37c8ecde13c2 22 #define afERROR_NO_SUCH_ATTRIBUTE -1 // Request was made for unknown attribute id
Rhyme 0:37c8ecde13c2 23 #define afERROR_BUSY -2 // Request already in progress, try again
Rhyme 0:37c8ecde13c2 24 #define afERROR_INVALID_COMMAND -3 // Command could not be parsed
Rhyme 0:37c8ecde13c2 25 #define afERROR_QUEUE_OVERFLOW -4 // Queue is full
Rhyme 0:37c8ecde13c2 26 #define afERROR_QUEUE_UNDERFLOW -5 // Queue is empty
Rhyme 0:37c8ecde13c2 27 #define afERROR_INVALID_PARAM -6 // Bad input parameter
Rhyme 0:37c8ecde13c2 28
Rhyme 0:37c8ecde13c2 29 #define AF_SYSTEM_COMMAND 65012
Rhyme 0:37c8ecde13c2 30 #define AF_SYSTEM_ASR_STATE 65013
Rhyme 0:37c8ecde13c2 31 #define AF_SYSTEM_LINKED_TIMESTAMP 65015
Rhyme 0:37c8ecde13c2 32
Rhyme 0:37c8ecde13c2 33 #define MODULE_STATE_REBOOTED 0
Rhyme 0:37c8ecde13c2 34 #define MODULE_STATE_LINKED 1
Rhyme 0:37c8ecde13c2 35 #define MODULE_STATE_UPDATING 2
Rhyme 0:37c8ecde13c2 36 #define MOUDLE_STATE_UPDATE_READY 3
Rhyme 0:37c8ecde13c2 37
Rhyme 0:37c8ecde13c2 38 #define MODULE_COMMAND_NONE 0
Rhyme 0:37c8ecde13c2 39 #define MODULE_COMMAND_REBOOT 1
Rhyme 0:37c8ecde13c2 40
Rhyme 0:37c8ecde13c2 41 #define ATTR_SENSE_VAL 1
Rhyme 0:37c8ecde13c2 42 #define ATTR_ACCEL_PRESENT 100
Rhyme 0:37c8ecde13c2 43 #define ATTR_ACCEL_ENABLE 101
Rhyme 0:37c8ecde13c2 44 #define ATTR_ACCEL_INTERVAL 102
Rhyme 0:37c8ecde13c2 45 #define ATTR_ACCEL_VALUE 103
Rhyme 0:37c8ecde13c2 46
Rhyme 0:37c8ecde13c2 47 #define ATTR_COLOR0_PRESENT 200
Rhyme 0:37c8ecde13c2 48 #define ATTR_COLOR0_ENABLE 201
Rhyme 0:37c8ecde13c2 49 #define ATTR_COLOR0_INTERVAL 202
Rhyme 0:37c8ecde13c2 50 #define ATTR_COLOR0_TRIGMODE 203
Rhyme 0:37c8ecde13c2 51 #define ATTR_COLOR0_ITIME 204
Rhyme 0:37c8ecde13c2 52 #define ATTR_COLOR0_CALIBRATE 205
Rhyme 0:37c8ecde13c2 53 #define ATTR_COLOR0_PWM_R 206
Rhyme 0:37c8ecde13c2 54 #define ATTR_COLOR0_PWM_G 207
Rhyme 0:37c8ecde13c2 55 #define ATTR_COLOR0_PWM_B 208
Rhyme 0:37c8ecde13c2 56 #define ATTR_COLOR0_PWM_PERIOD 209
Rhyme 0:37c8ecde13c2 57 #define ATTR_COLOR0_PWM_TARGET 210
Rhyme 0:37c8ecde13c2 58 #define ATTR_COLOR0_R_VALUE 211
Rhyme 0:37c8ecde13c2 59 #define ATTR_COLOR0_G_VALUE 212
Rhyme 0:37c8ecde13c2 60 #define ATTR_COLOR0_B_VALUE 213
Rhyme 0:37c8ecde13c2 61
Rhyme 0:37c8ecde13c2 62 #define ATTR_COLOR1_PRESENT 220
Rhyme 0:37c8ecde13c2 63 #define ATTR_COLOR1_ENABLE 221
Rhyme 0:37c8ecde13c2 64 #define ATTR_COLOR1_INTERVAL 222
Rhyme 0:37c8ecde13c2 65 #define ATTR_COLOR1_TRIGMODE 223
Rhyme 0:37c8ecde13c2 66 #define ATTR_COLOR1_ITIME 224
Rhyme 0:37c8ecde13c2 67 #define ATTR_COLOR1_CALIBRATE 225
Rhyme 0:37c8ecde13c2 68 #define ATTR_COLOR1_PWM_R 226
Rhyme 0:37c8ecde13c2 69 #define ATTR_COLOR1_PWM_G 227
Rhyme 0:37c8ecde13c2 70 #define ATTR_COLOR1_PWM_B 228
Rhyme 0:37c8ecde13c2 71 #define ATTR_COLOR1_PWM_PERIOD 229
Rhyme 0:37c8ecde13c2 72 #define ATTR_COLOR1_PWM_TARGET 230
Rhyme 0:37c8ecde13c2 73 #define ATTR_COLOR1_R_VALUE 231
Rhyme 0:37c8ecde13c2 74 #define ATTR_COLOR1_G_VALUE 232
Rhyme 0:37c8ecde13c2 75 #define ATTR_COLOR1_B_VALUE 233
Rhyme 0:37c8ecde13c2 76
Rhyme 0:37c8ecde13c2 77 /* temperature sensor LM75B with color0 */
Rhyme 0:37c8ecde13c2 78 #define ATTR_TEMP0_PRESENT 300
Rhyme 0:37c8ecde13c2 79 #define ATTR_TEMP0_ENABLE 301
Rhyme 0:37c8ecde13c2 80 #define ATTR_TEMP0_INTERVAL 302
Rhyme 0:37c8ecde13c2 81 #define ATTR_TEMP0_VALUE 303
Rhyme 0:37c8ecde13c2 82
Rhyme 0:37c8ecde13c2 83 /* temperature sensor AT502-11 (before) */
Rhyme 0:37c8ecde13c2 84 #define ATTR_TEMP1_PRESENT 310
Rhyme 0:37c8ecde13c2 85 #define ATTR_TEMP1_ENABLE 311
Rhyme 0:37c8ecde13c2 86 #define ATTR_TEMP1_INTERVAL 312
Rhyme 0:37c8ecde13c2 87 #define ATTR_TEMP1_VALUE 313
Rhyme 0:37c8ecde13c2 88
Rhyme 0:37c8ecde13c2 89 /* temperature sensor AT502-11 (after) */
Rhyme 0:37c8ecde13c2 90 #define ATTR_TEMP2_PRESENT 320
Rhyme 0:37c8ecde13c2 91 #define ATTR_TEMP2_ENABLE 321
Rhyme 0:37c8ecde13c2 92 #define ATTR_TEMP2_INTERVAL 322
Rhyme 0:37c8ecde13c2 93 #define ATTR_TEMP2_VALUE 323
Rhyme 0:37c8ecde13c2 94
Rhyme 0:37c8ecde13c2 95 /* temperature sensor LM75B with color1 */
Rhyme 0:37c8ecde13c2 96 #define ATTR_TEMP3_PRESENT 330
Rhyme 0:37c8ecde13c2 97 #define ATTR_TEMP3_ENABLE 331
Rhyme 0:37c8ecde13c2 98 #define ATTR_TEMP3_INTERVAL 332
Rhyme 0:37c8ecde13c2 99 #define ATTR_TEMP3_VALUE 333
Rhyme 0:37c8ecde13c2 100
Rhyme 0:37c8ecde13c2 101 /* gas pressure sensor */
Rhyme 0:37c8ecde13c2 102 /* gas pressure sensor */
Rhyme 0:37c8ecde13c2 103 #define ATTR_GAS_PRESENT 400
Rhyme 0:37c8ecde13c2 104 #define ATTR_GAS_ENABLE 401
Rhyme 0:37c8ecde13c2 105 #define ATTR_GAS_INTERVAL 402
Rhyme 0:37c8ecde13c2 106 #define ATTR_GAS_VALUE 403
Rhyme 0:37c8ecde13c2 107 #define ATTR_GAS_THR_MODE 404
Rhyme 0:37c8ecde13c2 108 #define ATTR_GAS_THR_HIGH 405
Rhyme 0:37c8ecde13c2 109 #define ATTR_GAS_THR_LOW 406
Rhyme 0:37c8ecde13c2 110
Rhyme 0:37c8ecde13c2 111 /* current trans sensor */
Rhyme 0:37c8ecde13c2 112 #define ATTR_CURRENT_PRESENT 500
Rhyme 0:37c8ecde13c2 113 #define ATTR_CURRENT_ENABLE 501
Rhyme 0:37c8ecde13c2 114 #define ATTR_CURRENT_INTERVAL 502
Rhyme 0:37c8ecde13c2 115 #define ATTR_CURRENT_VALUE 503
Rhyme 0:37c8ecde13c2 116
Rhyme 0:37c8ecde13c2 117 #define ATTR_SOFTWARE_RESET 666
Rhyme 0:37c8ecde13c2 118 #define ATTR_DISPLAY_MODE 777
Rhyme 0:37c8ecde13c2 119 #define ATTR_MCU_RESET_REASON 999
Rhyme 0:37c8ecde13c2 120
Rhyme 0:37c8ecde13c2 121 #define ATTR_LED 1024
Rhyme 0:37c8ecde13c2 122 #define ATTR_IO0 1025
Rhyme 0:37c8ecde13c2 123 #define ATTR_IO1 1026
Rhyme 0:37c8ecde13c2 124 #define ATTR_IO2 1028
Rhyme 0:37c8ecde13c2 125 #define ATTR_BUTTON 1030
Rhyme 0:37c8ecde13c2 126 #define ATTR_IO3 1031
Rhyme 0:37c8ecde13c2 127
Rhyme 0:37c8ecde13c2 128 #define ATTR_BOOT_LOADER_VER 2001
Rhyme 0:37c8ecde13c2 129 #define ATTR_BLE_STACK_VER 2002
Rhyme 0:37c8ecde13c2 130 #define ATTR_FW_APP_VER 2003
Rhyme 0:37c8ecde13c2 131 #define ATTR_DEVICE_DESC 2004
Rhyme 0:37c8ecde13c2 132 #define ATTR_WIFI_VER 2006
Rhyme 0:37c8ecde13c2 133
Rhyme 0:37c8ecde13c2 134 #define ATTR_OFFLINE_SCHED 59001
Rhyme 0:37c8ecde13c2 135 #define ATTR_SECURITY_ENABLED 60000
Rhyme 0:37c8ecde13c2 136 #define ATTR_UTC_OFFSET 65001
Rhyme 0:37c8ecde13c2 137 #define ATTR_CONFIGURES_SSID 65004
Rhyme 0:37c8ecde13c2 138 #define ATTR_WIFI_BARS 65005
Rhyme 0:37c8ecde13c2 139 #define ATTR_WIFI_STDY_STATE 65006
Rhyme 0:37c8ecde13c2 140
Rhyme 0:37c8ecde13c2 141 #define ATTR_COMMAND 65012
Rhyme 0:37c8ecde13c2 142 #define ATTR_ASR_STATE 65013
Rhyme 0:37c8ecde13c2 143 #define ATTR_LOW_BATTERY 65014
Rhyme 0:37c8ecde13c2 144 #define ATTR_LINKED_TIMESTAMP 65015
Rhyme 0:37c8ecde13c2 145 #define ATTR_ATTR_ACK 65018
Rhyme 0:37c8ecde13c2 146 #define ATTR_REBOOT_REASON 65019
Rhyme 0:37c8ecde13c2 147 #define ATTR_BLE_COMMS 65020
Rhyme 0:37c8ecde13c2 148 #define ATTR_MCU_INTERFACE 65021
Rhyme 0:37c8ecde13c2 149
Rhyme 0:37c8ecde13c2 150 #define DISPLAY_MODE_OFF 0
Rhyme 0:37c8ecde13c2 151 #define DISPLAY_MODE_GAS 1
Rhyme 0:37c8ecde13c2 152 #define DISPLAY_MODE_SUMMARY 2
Rhyme 0:37c8ecde13c2 153 #define DISPLAY_MODE_CHART 3
Rhyme 0:37c8ecde13c2 154
Rhyme 0:37c8ecde13c2 155 typedef struct {
Rhyme 0:37c8ecde13c2 156 uint16_t id ;
Rhyme 0:37c8ecde13c2 157 char *description ;
Rhyme 0:37c8ecde13c2 158 int attribute_type ;
Rhyme 0:37c8ecde13c2 159 int size ;
Rhyme 0:37c8ecde13c2 160 } af_attribute_type ;
Rhyme 0:37c8ecde13c2 161
Rhyme 0:37c8ecde13c2 162 /**
Rhyme 0:37c8ecde13c2 163 * get_af_attr
Rhyme 0:37c8ecde13c2 164 * @param id attribute id value to look up
Rhyme 0:37c8ecde13c2 165 * @returns index of the attribute in the af_attribute_type af_attr[]
Rhyme 0:37c8ecde13c2 166 */
Rhyme 0:37c8ecde13c2 167 int get_af_attr(uint16_t id) ;
Rhyme 0:37c8ecde13c2 168
Rhyme 0:37c8ecde13c2 169 /**
Rhyme 0:37c8ecde13c2 170 * print_af_error
Rhyme 0:37c8ecde13c2 171 * @param resultCode return value from afLib function(s)
Rhyme 0:37c8ecde13c2 172 */
Rhyme 0:37c8ecde13c2 173 void print_af_error(int resultCode) ;
Rhyme 0:37c8ecde13c2 174
Rhyme 0:37c8ecde13c2 175 /**
Rhyme 0:37c8ecde13c2 176 * Callback that allows ASR to request an MCU attribute be changed.
Rhyme 0:37c8ecde13c2 177 * You should define this function in your MCU firmware to perform application-specific actions
Rhyme 0:37c8ecde13c2 178 * your code must take (e.g., updating the state of the hardware),
Rhyme 0:37c8ecde13c2 179 * in light of the attribute value change.
Rhyme 0:37c8ecde13c2 180 */
Rhyme 0:37c8ecde13c2 181 void attributeChangeRequest(
Rhyme 0:37c8ecde13c2 182 const uint8_t requestId,
Rhyme 0:37c8ecde13c2 183 const uint16_t attributeId,
Rhyme 0:37c8ecde13c2 184 const uint16_t valueLen,
Rhyme 0:37c8ecde13c2 185 const uint8_t *value
Rhyme 0:37c8ecde13c2 186 ) ;
Rhyme 0:37c8ecde13c2 187
Rhyme 0:37c8ecde13c2 188 /*
Rhyme 0:37c8ecde13c2 189 * Application callback that allows afLib to notify that an attribute has changed.
Rhyme 0:37c8ecde13c2 190 * This method will be called in response to a getAttribute call from the application
Rhyme 0:37c8ecde13c2 191 * and whenever a ASR module attribute changes.
Rhyme 0:37c8ecde13c2 192 */
Rhyme 0:37c8ecde13c2 193 void attributeUpdatedReport(
Rhyme 0:37c8ecde13c2 194 const uint8_t requestId,
Rhyme 0:37c8ecde13c2 195 const uint16_t attributeId,
Rhyme 0:37c8ecde13c2 196 const uint16_t valueLen,
Rhyme 0:37c8ecde13c2 197 const uint8_t *value
Rhyme 0:37c8ecde13c2 198 ) ;
Rhyme 0:37c8ecde13c2 199
Rhyme 0:37c8ecde13c2 200 extern afLib *afero ;
Rhyme 0:37c8ecde13c2 201 #endif /* _AF_ATTRIBUTES_H */