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 モードになっています。

半田のジャンパを変えて、SPIの設定にしてください。

サーミスタについて
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
で呼ぶように変更しました。
afLib/iafLib.h@0:0b6732b53bf4, 2018-04-24 (annotated)
- Committer:
- Rhyme
- Date:
- Tue Apr 24 08:58:33 2018 +0000
- Revision:
- 0:0b6732b53bf4
Temporary Connector Reversed Version
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Rhyme | 0:0b6732b53bf4 | 1 | /** |
| Rhyme | 0:0b6732b53bf4 | 2 | * Copyright 2015 Afero, Inc. |
| Rhyme | 0:0b6732b53bf4 | 3 | * |
| Rhyme | 0:0b6732b53bf4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| Rhyme | 0:0b6732b53bf4 | 5 | * you may not use this file except in compliance with the License. |
| Rhyme | 0:0b6732b53bf4 | 6 | * You may obtain a copy of the License at |
| Rhyme | 0:0b6732b53bf4 | 7 | * |
| Rhyme | 0:0b6732b53bf4 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| Rhyme | 0:0b6732b53bf4 | 9 | * |
| Rhyme | 0:0b6732b53bf4 | 10 | * Unless required by applicable law or agreed to in writing, software |
| Rhyme | 0:0b6732b53bf4 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| Rhyme | 0:0b6732b53bf4 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| Rhyme | 0:0b6732b53bf4 | 13 | * See the License for the specific language governing permissions and |
| Rhyme | 0:0b6732b53bf4 | 14 | * limitations under the License. |
| Rhyme | 0:0b6732b53bf4 | 15 | */ |
| Rhyme | 0:0b6732b53bf4 | 16 | |
| Rhyme | 0:0b6732b53bf4 | 17 | /** |
| Rhyme | 0:0b6732b53bf4 | 18 | * afLib public interface |
| Rhyme | 0:0b6732b53bf4 | 19 | * |
| Rhyme | 0:0b6732b53bf4 | 20 | * This file defines everything your application should need for commuinicating with the Afero ASR-1 radio module. |
| Rhyme | 0:0b6732b53bf4 | 21 | * Is there is anything missing from this file, please post a request on the developer forum and we will see what |
| Rhyme | 0:0b6732b53bf4 | 22 | * we can do. |
| Rhyme | 0:0b6732b53bf4 | 23 | */ |
| Rhyme | 0:0b6732b53bf4 | 24 | #ifndef AFLIB_IAFLIB_H |
| Rhyme | 0:0b6732b53bf4 | 25 | #define AFLIB_IAFLIB_H |
| Rhyme | 0:0b6732b53bf4 | 26 | |
| Rhyme | 0:0b6732b53bf4 | 27 | #include "mbed.h" |
| Rhyme | 0:0b6732b53bf4 | 28 | #include <string> |
| Rhyme | 0:0b6732b53bf4 | 29 | using namespace std; |
| Rhyme | 0:0b6732b53bf4 | 30 | #include "afErrors.h" |
| Rhyme | 0:0b6732b53bf4 | 31 | #include "afSPI.h" |
| Rhyme | 0:0b6732b53bf4 | 32 | |
| Rhyme | 0:0b6732b53bf4 | 33 | #if defined (TARGET_TEENSY3_1) |
| Rhyme | 0:0b6732b53bf4 | 34 | #include "USBSerial.h" |
| Rhyme | 0:0b6732b53bf4 | 35 | #endif |
| Rhyme | 0:0b6732b53bf4 | 36 | |
| Rhyme | 0:0b6732b53bf4 | 37 | #define afMINIMUM_TIME_BETWEEN_REQUESTS 1000 |
| Rhyme | 0:0b6732b53bf4 | 38 | |
| Rhyme | 0:0b6732b53bf4 | 39 | #define MAX_ATTRIBUTE_SIZE 255 |
| Rhyme | 0:0b6732b53bf4 | 40 | |
| Rhyme | 0:0b6732b53bf4 | 41 | typedef void (*isr)(); |
| Rhyme | 0:0b6732b53bf4 | 42 | typedef void (*onAttributeSet)(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value); |
| Rhyme | 0:0b6732b53bf4 | 43 | typedef void (*onAttributeSetComplete)(const uint8_t requestId, const uint16_t attributeId, const uint16_t valueLen, const uint8_t *value); |
| Rhyme | 0:0b6732b53bf4 | 44 | |
| Rhyme | 0:0b6732b53bf4 | 45 | class iafLib { |
| Rhyme | 0:0b6732b53bf4 | 46 | public: |
| Rhyme | 0:0b6732b53bf4 | 47 | /** |
| Rhyme | 0:0b6732b53bf4 | 48 | * create |
| Rhyme | 0:0b6732b53bf4 | 49 | * |
| Rhyme | 0:0b6732b53bf4 | 50 | * Create an instance of the afLib object. The afLib is a singleton. Calling this method multiple |
| Rhyme | 0:0b6732b53bf4 | 51 | * times will return the same instance. |
| Rhyme | 0:0b6732b53bf4 | 52 | * |
| Rhyme | 0:0b6732b53bf4 | 53 | * @param mcuInterrupt The Arduino interrupt to be used (returned from digitalPinToInterrupt) |
| Rhyme | 0:0b6732b53bf4 | 54 | * @param isrWrapper This is the isr method that must be defined in your sketch |
| Rhyme | 0:0b6732b53bf4 | 55 | * @param attrSet Callback for notification of attribute set requests |
| Rhyme | 0:0b6732b53bf4 | 56 | * @param attrSetComplete Callback for notification of attribute set request completions |
| Rhyme | 0:0b6732b53bf4 | 57 | * @return iafLib * Instance of iafLib |
| Rhyme | 0:0b6732b53bf4 | 58 | */ |
| Rhyme | 0:0b6732b53bf4 | 59 | static iafLib * create(PinName mcuInterrupt, isr isrWrapper, |
| Rhyme | 0:0b6732b53bf4 | 60 | onAttributeSet attrSet, onAttributeSetComplete attrSetComplete, afSPI *theSPI); |
| Rhyme | 0:0b6732b53bf4 | 61 | |
| Rhyme | 0:0b6732b53bf4 | 62 | //wsugi 20161128 |
| Rhyme | 0:0b6732b53bf4 | 63 | static void destroy(); |
| Rhyme | 0:0b6732b53bf4 | 64 | |
| Rhyme | 0:0b6732b53bf4 | 65 | /** |
| Rhyme | 0:0b6732b53bf4 | 66 | * loop |
| Rhyme | 0:0b6732b53bf4 | 67 | * |
| Rhyme | 0:0b6732b53bf4 | 68 | * Called by the loop() method in your sketch to give afLib some CPU time |
| Rhyme | 0:0b6732b53bf4 | 69 | */ |
| Rhyme | 0:0b6732b53bf4 | 70 | virtual void loop(void) = 0; |
| Rhyme | 0:0b6732b53bf4 | 71 | |
| Rhyme | 0:0b6732b53bf4 | 72 | /** |
| Rhyme | 0:0b6732b53bf4 | 73 | * getAttribute |
| Rhyme | 0:0b6732b53bf4 | 74 | * |
| Rhyme | 0:0b6732b53bf4 | 75 | * Request the value of an attribute be returned from the ASR-1. |
| Rhyme | 0:0b6732b53bf4 | 76 | * Value will be returned in the attrSetComplete callback. |
| Rhyme | 0:0b6732b53bf4 | 77 | */ |
| Rhyme | 0:0b6732b53bf4 | 78 | virtual int getAttribute(const uint16_t attrId) = 0; |
| Rhyme | 0:0b6732b53bf4 | 79 | |
| Rhyme | 0:0b6732b53bf4 | 80 | /** |
| Rhyme | 0:0b6732b53bf4 | 81 | * setAttribute |
| Rhyme | 0:0b6732b53bf4 | 82 | * |
| Rhyme | 0:0b6732b53bf4 | 83 | * Request setting an attribute. |
| Rhyme | 0:0b6732b53bf4 | 84 | * For MCU attributes, the attribute value will be updated. |
| Rhyme | 0:0b6732b53bf4 | 85 | * For IO attributes, the attribute value will be updated, and then onAttrSetComplete will be called. |
| Rhyme | 0:0b6732b53bf4 | 86 | */ |
| Rhyme | 0:0b6732b53bf4 | 87 | virtual int setAttributeBool(const uint16_t attrId, const bool value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 88 | |
| Rhyme | 0:0b6732b53bf4 | 89 | virtual int setAttribute8(const uint16_t attrId, const int8_t value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 90 | |
| Rhyme | 0:0b6732b53bf4 | 91 | virtual int setAttribute16(const uint16_t attrId, const int16_t value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 92 | |
| Rhyme | 0:0b6732b53bf4 | 93 | virtual int setAttribute32(const uint16_t attrId, const int32_t value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 94 | |
| Rhyme | 0:0b6732b53bf4 | 95 | virtual int setAttribute64(const uint16_t attrId, const int64_t value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 96 | |
| Rhyme | 0:0b6732b53bf4 | 97 | virtual int setAttribute(const uint16_t attrId, const string &value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 98 | |
| Rhyme | 0:0b6732b53bf4 | 99 | virtual int setAttribute(const uint16_t attrId, const uint16_t valueLen, const char *value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 100 | |
| Rhyme | 0:0b6732b53bf4 | 101 | virtual int setAttribute(const uint16_t attrId, const uint16_t valueLen, const uint8_t *value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 102 | |
| Rhyme | 0:0b6732b53bf4 | 103 | /** |
| Rhyme | 0:0b6732b53bf4 | 104 | * setAttributeComplete |
| Rhyme | 0:0b6732b53bf4 | 105 | * |
| Rhyme | 0:0b6732b53bf4 | 106 | * Call this in response to an onAttrSet. This lets the ASR-1 know that the set request has been handled. |
| Rhyme | 0:0b6732b53bf4 | 107 | */ |
| Rhyme | 0:0b6732b53bf4 | 108 | virtual int setAttributeComplete(uint8_t requestId, const uint16_t attrId, const uint16_t valueLen, const uint8_t *value) = 0; |
| Rhyme | 0:0b6732b53bf4 | 109 | |
| Rhyme | 0:0b6732b53bf4 | 110 | /** |
| Rhyme | 0:0b6732b53bf4 | 111 | * isIdle |
| Rhyme | 0:0b6732b53bf4 | 112 | * |
| Rhyme | 0:0b6732b53bf4 | 113 | * Call to find out of the ASR-1 is currently handling a request. |
| Rhyme | 0:0b6732b53bf4 | 114 | * |
| Rhyme | 0:0b6732b53bf4 | 115 | * @return true if an operation is in progress |
| Rhyme | 0:0b6732b53bf4 | 116 | */ |
| Rhyme | 0:0b6732b53bf4 | 117 | virtual bool isIdle() = 0; |
| Rhyme | 0:0b6732b53bf4 | 118 | |
| Rhyme | 0:0b6732b53bf4 | 119 | /** |
| Rhyme | 0:0b6732b53bf4 | 120 | * mcuISR |
| Rhyme | 0:0b6732b53bf4 | 121 | * |
| Rhyme | 0:0b6732b53bf4 | 122 | * Called by your sketch to pass the interrupt along to afLib. |
| Rhyme | 0:0b6732b53bf4 | 123 | */ |
| Rhyme | 0:0b6732b53bf4 | 124 | virtual void mcuISR() = 0; |
| Rhyme | 0:0b6732b53bf4 | 125 | }; |
| Rhyme | 0:0b6732b53bf4 | 126 | #endif //AFLIB_IAFLIB_H |
La Suno