Skip to content

Commit

Permalink
ブザー用に DO4 を使用。PKT_ID_BUTTON の子機からの受信時に DO1 とともに DO4 もトグルし受信後はリセットされるま…
Browse files Browse the repository at this point in the history
…で DO1 の LED 点滅を継続。
  • Loading branch information
mkttanabe committed Apr 21, 2015
1 parent 19fcdef commit d904c48
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Samp_Monitor/Parent/Source/Parent.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ void cbToCoNet_vRxEvent(tsRxDataApp *pRx) {


if( sRxPktInfo.u8pkt == PKT_ID_BUTTON ){ if( sRxPktInfo.u8pkt == PKT_ID_BUTTON ){
vLED_Toggle(); vLED_Toggle();
#ifdef MODIFIED_BY_KLAB
// 子機のセンサモードが押しボタン・磁気スイッチの場合は
// 受信実績フラグを立て DO4 の状態を変化させる
// (DO4 には電子ブザーの接続を想定)
sAppData.received = TRUE;
vPortSet_TrueAsLo(PORT_OUT4, bPortRead(PORT_OUT1));
#endif
} }


// 出力用の関数を呼び出す // 出力用の関数を呼び出す
Expand Down Expand Up @@ -391,6 +398,11 @@ static void vInitHardware(int f_warm_start) {
vPortSetHi( PORT_OUT2 ); vPortSetHi( PORT_OUT2 );
vPortAsOutput( PORT_OUT2 ); vPortAsOutput( PORT_OUT2 );


#ifdef MODIFIED_BY_KLAB
vPortSetHi( PORT_OUT4 );
vPortAsOutput( PORT_OUT4 );
#endif

// LCD の設定 // LCD の設定
#ifdef USE_LCD #ifdef USE_LCD
vLcdInit(); vLcdInit();
Expand Down Expand Up @@ -440,6 +452,14 @@ static void vProcessEvCore(tsEvent *pEv, teEvent eEvent, uint32 u32evarg) {


if (eEvent == E_EVENT_TICK_SECOND) { if (eEvent == E_EVENT_TICK_SECOND) {
u32sec++; u32sec++;
#ifdef MODIFIED_BY_KLAB
// 子機のセンサモードが押しボタン・磁気スイッチかつ
// 受信実績があればリセットされるまで DO1 の LED 点滅を継続する
// (受信有無を事後に視認するための便宜)
if (sAppData.received) {
vPortSet_TrueAsLo(PORT_OUT1, !bPortRead(PORT_OUT1));
}
#endif
} }


switch (pEv->eState) { switch (pEv->eState) {
Expand Down
5 changes: 5 additions & 0 deletions Samp_Monitor/Parent/Source/appdata.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#ifndef APPDATA_H_ #ifndef APPDATA_H_
#define APPDATA_H_ #define APPDATA_H_


#define MODIFIED_BY_KLAB

#include <jendefs.h> #include <jendefs.h>
#include "ToCoNet.h" #include "ToCoNet.h"
#include "flash.h" #include "flash.h"
Expand Down Expand Up @@ -35,6 +37,9 @@ typedef struct {
uint8 u8DebugLevel; uint8 u8DebugLevel;


uint8 u8DO_State; // DOの状態(0:Hi, 1:Lo, それ以外:未定義) uint8 u8DO_State; // DOの状態(0:Hi, 1:Lo, それ以外:未定義)
#ifdef MODIFIED_BY_KLAB
bool_t received; // 受信実績有無フラグ (cbAppColdStart 内でのみ初期化)
#endif
} tsAppData_Pa; } tsAppData_Pa;
extern tsAppData_Pa sAppData_Pa; extern tsAppData_Pa sAppData_Pa;


Expand Down

0 comments on commit d904c48

Please sign in to comment.