CheckComm
/******************************************************************************/
CheckComm
Purpose: Check the strobe and ack ports associated with the COMM module
Parametes: none
Returns: boolean
create a static last strobe state
create a static last ack state
create a current strobe state
create a current ack state
set the ReturnVal to false
set current value of strobe pin to CurrentStrobeState
IF CurrentStrobeState different from lastBreedState
//event detected
IF CurrentStrobeState is HIGH
create new event
set new event type to ES_STROBERISE
post event to COMM module State Machine
set ReturnVal to true
ELSE CurrentStrobeState is LOW
create new event
set new event type to ES_STROBEFALL
post event to COMM module State Machine
set ReturnVal to true
ENDIF
ENDIF
set current value of ack pin to CurrentAckState
IF CurrentAckState different from lastAckState and CurrentAckState is HIGH
//Ack event detected
create new event
set new event type to ES_ACK
post event to COMM module State Machine
set ReturnVal to true
ENDIF
set lastStrobeState to CurrentStrobeState
set lastAckState to CurrentAckState
return ReturnVal
/******************************************************************************/
CheckBeeBreed
/******************************************************************************/
CheckBeeBreed
Purpose: Check the Hall effect sensor for rising edges to see when to breed new bee
Parametes: none
Returns: boolean
create a static last breed state
create a current breed state
set the ReturnVal to false
set current value of breed pin to CurrentBreedState
IF CurrentBreedState HIGH and different from lastBreedState
//event detected, post event
create new event
set new event type to ES_BREEDBEE
post event to Game Module State Machine
post event to InitSM
set ReturnVal to true
ENDIF
set lastBreedState to CurrentBreedState
return ReturnVal
/******************************************************************************/