Temporary Connector Reversed Version

Dependencies:   UniGraphic mbed vt100

afero_poc15_180403R , J1 のピン配置を反転させたヴァージョンです。

Color2系を使用するためには以下のピンをジャンパで接続してください。
J1-D7 <-> J1-D0
J1-D6 <-> J1-D1

(調査中) また、こちらでテストした範囲では、
FRDM-KL25Z の V3.3 を、Modulo2 の VCC_3V3 ピンに接続してやる必要がありました。

尚、J1-D1, D0 を使用するために UART を無効にしているため
ログは表示されません。

TFTモジュールについて 
aitendoのTFTモジュールはデフォルトでは8bit bus モードになっています。
/media/uploads/Rhyme/img_2364.jpg

半田のジャンパを変えて、SPIの設定にしてください。
/media/uploads/Rhyme/img_2363.jpg

サーミスタについて
POC1.5 では サーミスタは 25℃の時に抵抗値が 50.0kΩになる502AT-11 が
4.95kΩのプルアップ(実際は10kΩx2の並列)で使用されていました。

今回の試作では抵抗値が 10.0kΩの 103AT-11 が
5.1kΩのプルアップで使用されていますので、係数を合わせるために
SMTC502AT-11 のコンストラクタを 
R0 = 10.0
R1 = 5.1
B = 3435
T0 = 298.15
で呼ぶように変更しました。

Committer:
Rhyme
Date:
Tue Apr 24 12:18:10 2018 +0000
Revision:
1:6c54dc8acf96
Parent:
0:0b6732b53bf4
to adjust with 103AT-11 with 5.1k pull-up, the constructor of 502AT-11 is called with R0=10.0, R1=5.1, B=3435, T0=298.15

Who changed what in which revision?

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