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
で呼ぶように変更しました。
main.cpp
- Committer:
- Rhyme
- Date:
- 2018-04-24
- Revision:
- 0:0b6732b53bf4
File content as of revision 0:0b6732b53bf4:
#include "mbed.h"
#include "vt100.h"
#include "afLib.h"
#include "af_mgr.h"
#include "edge_mgr.h"
#include "edge_time.h"
#include "edge_reset_mgr.h"
/**
* afero poc1.5 25-Dec-2017 version
* from this version, watch dog timer joined again.
*/
vt100 *tty = 0 ;
uint32_t wait_tolerance = 500 ; /* 5sec */
uint32_t connect_tolerance = 60 ; /* after 60 trials, reboot */
uint32_t wait_count = 0 ;
uint32_t connect_trial_count = 0 ;
/**
* wait_connection
* When gConnected == false, which is connection is lost.
* Each 5sec check attribute ATTR_WIFI_STDY_STATE to see
* if the connection has recovered.
* Meantime even if connection is established communicated
* data is invalid, so AF_SYSTEM_ASR_STATE is also
* checked for gLinked ;
* And in case connect_tolerance trials failed
* try to reboot the system if it can improve the situation.
*/
void wait_connection(void)
{
int result ;
wait_count++ ;
if (wait_count > wait_tolerance) {
reset_watch_dog() ;
if (gConnected == false) {
result = afero->getAttribute(ATTR_WIFI_STDY_STATE) ;
if (result != afSUCCESS) {
print_af_error(result) ;
}
}
if (gLinked == false) {
result = afero->getAttribute(AF_SYSTEM_ASR_STATE) ;
if (result != afSUCCESS) {
print_af_error(result) ;
}
}
connect_trial_count++ ;
if (connect_trial_count > connect_tolerance) {
reboot_edge() ;
}
wait_count = 0 ;
}
}
void kill_uart(void)
{
uint32_t *pta1_ctrl = (uint32_t *)0x40049004 ;
uint32_t *pta2_ctrl = (uint32_t *)0x40049008 ;
*pta1_ctrl = 0x0 ;
*pta2_ctrl = 0x0 ;
}
void init_hardware(void)
{
int i ;
int result ;
reset_watch_dog() ;
init_display() ;
reset_watch_dog() ;
init_aflib() ;
reset_watch_dog() ;
kill_uart() ;
init_sensors() ;
reset_watch_dog() ;
init_timer() ;
while(true) {
reset_watch_dog() ;
for (i = 0 ; i < 10 ; i++ ) {
afero->loop() ;
reset_watch_dog() ;
}
if ((gLinked == true)&&(gConnected == true)) {
wait_count = 0 ;
connect_trial_count = 0 ;
if (afero->isIdle()) {
result = init_edge_attribute() ;
if (result == 0) {
break ;
}
}
} else { /* gLinked == false */
wait_connection() ;
}
wait_ms(10) ;
}
do {
// while(!afero->isIdle()) {
reset_watch_dog() ;
for (i = 0 ; i < 10 ; i++ ) {
afero->loop() ;
wait_ms(100) ;
}
} while(!afero->isIdle()) ;
edge_mgr_status = EDGE_MGR_RUNNING ;
}
// main() runs in its own thread in the OS
int main() {
static uint32_t count_robin = 0 ;
tty = new vt100() ;
// tty->cls() ;
printf("Afero test program (ver. %s) started\n", __DATE__) ;
printf("=== Reset Reason ===\n") ;
print_reset_reason() ;
printf("====================\n") ;
init_hardware() ;
edge_splash() ;
while (true) {
count_robin++ ;
afero->loop() ;
if ((gLinked == true)&&(gConnected == true)) {
wait_count = 0 ;
connect_trial_count = 0 ;
if (afero->isIdle()) {
edge_loop(count_robin) ;
}
} else { /* gLinked == false */
wait_connection() ;
}
wait_ms(10) ;
}
}
La Suno