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/StatusCommand.cpp
- Committer:
- Rhyme
- Date:
- 2018-04-24
- Revision:
- 0:0b6732b53bf4
File content as of revision 0:0b6732b53bf4:
/**
* Copyright 2015 Afero, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "StatusCommand.h"
#define SERIAL_PRINT_DBG_ASR_ON 0
StatusCommand::StatusCommand(uint16_t bytesToSend) {
_cmd = 0x30;
_bytesToSend = bytesToSend;
_bytesToRecv = 0;
}
StatusCommand::StatusCommand() {
_cmd = 0x30;
_bytesToSend = 0;
_bytesToRecv = 0;
}
StatusCommand::~StatusCommand() {
}
uint16_t StatusCommand::getSize() {
return sizeof(_cmd) + sizeof(_bytesToSend) + sizeof(_bytesToRecv);
}
uint16_t StatusCommand::getBytes(int *bytes) {
int index = 0;
bytes[index++] = (_cmd);
bytes[index++] = (_bytesToSend & 0xff);
bytes[index++] = ((_bytesToSend >> 8) & 0xff);
bytes[index++] = (_bytesToRecv & 0xff);
bytes[index++] = ((_bytesToRecv >> 8) & 0xff);
return index;
}
uint8_t StatusCommand::calcChecksum() {
uint8_t result = 0;
result += (_cmd);
result += (_bytesToSend & 0xff);
result += ((_bytesToSend >> 8) & 0xff);
result += (_bytesToRecv & 0xff);
result += ((_bytesToRecv >> 8) & 0xff);
return result;
}
void StatusCommand::setChecksum(uint8_t checksum) {
_checksum = checksum;
}
uint8_t StatusCommand::getChecksum() {
uint8_t result = 0;
result += (_cmd);
result += (_bytesToSend & 0xff);
result += ((_bytesToSend >> 8) & 0xff);
result += (_bytesToRecv & 0xff);
result += ((_bytesToRecv >> 8) & 0xff);
return result;
}
void StatusCommand::setAck(bool ack) {
_cmd = ack ? 0x31 : 0x30;
}
void StatusCommand::setBytesToSend(uint16_t bytesToSend) {
_bytesToSend = bytesToSend;
}
uint16_t StatusCommand::getBytesToSend() {
return _bytesToSend;
}
void StatusCommand::setBytesToRecv(uint16_t bytesToRecv) {
_bytesToRecv = bytesToRecv;
}
uint16_t StatusCommand::getBytesToRecv() {
return _bytesToRecv;
}
bool StatusCommand::equals(StatusCommand *statusCommand) {
return (_cmd == statusCommand->_cmd && _bytesToSend == statusCommand->_bytesToSend &&
_bytesToRecv == statusCommand->_bytesToRecv);
}
bool StatusCommand::isValid() {
return (_checksum == calcChecksum()) && (_cmd == 0x30 || _cmd == 0x31);
}
void StatusCommand::dumpBytes() {
#if SERIAL_PRINT_DBG_ASR_ON
int len = getSize();
int bytes[len];
getBytes(bytes);
printf("len : %d\n",len);
printf("data : ");
for (int i = 0; i < len; i++) {
if (i > 0) {
printf(", ");
}
int b = bytes[i] & 0xff;
printf("0x%02x", b) ;
}
printf("\n") ;
#endif
}
void StatusCommand::dump() {
#if SERIAL_PRINT_DBG_ASR_ON
printf("cmd : %s\n",_cmd == 0x30 ? "STATUS" : "STATUS_ACK");
printf("bytes to send : %d\n",_bytesToSend);
printf("bytes to receive : %d\n",_bytesToRecv);
#endif
}
La Suno