; 18649 Spring 2010
; group 7
; Justin Ray/justinr2
; other names would go here
; button_control_3.mf

;perform the button control test with button 2

;definitions for inputs
;period and ID for mEmpty
#DEFINE EMPTY_PER 500ms
;ID = base + 1 for chute 2
#DEFINE EMPTY_CAN_ID 0x0ABC4601
;physical button period
#DEFINE BTN_PER 50ms
;period and ID for mVend
#DEFINE VEND_PER 50ms
#DEFINE VEND_CAN_ID 0x08C81400
;period and ID for mCoinCount
#DEFINE COIN_COUNT_PER 100ms
#DEFINE COIN_COUNT_CAN_ID 0x0A583C00

;definitions for outputs (output periods are determined by the setting in the .cf file)
;ID = base + 1 for button 2
#DEFINE BUTTON_CAN_ID 0x09902801

;set input initial value
0.0s I COIN_COUNT_PER N COIN_COUNT_CAN_ID CoinCount = 0
0.0s I BTN_PER F Button 2 = false
0.0s I EMPTY_PER N EMPTY_CAN_ID Empty 2 = false
0.0s I VEND_PER N VEND_CAN_ID Vend = false

;#state 'S2.1 IDLE'
0.2s A F Light 2 : lighted == true
0.2s A N BUTTON_CAN_ID Button 2 : getButtonState == false

;#transition 'T2.6'
1.0s I EMPTY_PER N EMPTY_CAN_ID Empty 2 = true

;#state 'S2.2 EMPTY'
1.31s A F Light 2 : lighted == false
1.31s A N BUTTON_CAN_ID Button 2 : getButtonState == false

;****verify no action on button press
2.0s I BTN_PER F Button 2 = true

;#state 'S2.2 EMPTY'
2.31s A F Light 2 : lighted == false
2.31s A N BUTTON_CAN_ID Button 2 : getButtonState == false

;release button
2.5s I BTN_PER F Button 2 = false

;#transition 'T2.7'
3.0s I EMPTY_PER N EMPTY_CAN_ID Empty 2 = false

;#state 'S2.1 IDLE'
3.31s A F Light 2 : lighted == true
3.31s A N BUTTON_CAN_ID Button 2 : getButtonState == false

