📄 shuffle.c
字号:
/************************************************
*
* $Copyright 2001 Joseph J. Lemieux ALL RIGHTS RESERVED. $
*
* $Filename: C:\OSEKBook\src\CH13\src\shuffle.c $
*
* Description: Processing Program for Shuffling Switch
*
************************************************/
#ifndef SHUFFLEC
#define SHUFFLEC
/************************************************
*
* Include files
*
************************************************/
#include "typedefs.h"
#include "os.h"
#include "init.h"
#include "hw.h"
#include "dispdrv.h"
#include "mpc555.h"
#include "cardgame.h"
#include "shuffle.h"
/************************************************
*
* Local macros
*
************************************************/
/************************************************
*
* Local type definitions
*
************************************************/
/************************************************
*
* Local Function Prototypes
*
************************************************/
/************************************************
*
* Local Variables
*
************************************************/
/************************************************
*
* Local Constants
*
************************************************/
/************************************************
*
* Functions
*
************************************************/
INTERRUPT void IOShuffleSwitchISR(void);
/************************************************
*
* Function: InitShuffleSwitch
*
* Inputs: type - type of initialization occurring.
*
* Outputs: none
*
* Returns: void
*
* Description: Initialize the Shuffle Switch counter.
*
************************************************/
void InitShuffleSwitch(InitType type)
{
if(type==INIT_STARTUP)
{
InitCounter(SHUFFLE_COUNTER,0);
}
Set_ExtISR((ULONG *)IOShuffleSwitchISR,V_LEV0);
}
/************************************************
*
* Interrupt: IOShuffleSwitchISR
*
* Description: Triggered on an edge of switch
*
************************************************/
INTERRUPT void IOShuffleSwitchISR(void)
{
TickType tick;
UINT32 temp;
temp = mios1Int.mios1sr0;
mios1Int.mios1sr0 = ~(0x1000);
if(GetGameState() == GAME_SHUFFLING){
// EnterISR();
if(GetAlarm(ShuffleAlarm,(TickRefType)&tick) == E_OS_NOFUNC){
SetAbsAlarm(ShuffleAlarm,5,3);
WriteDisplay("\fSHUFFLING -");
}
CancelAlarm(ShufflingCompleteAlarm);
SetRelAlarm(ShufflingCompleteAlarm,1000,0);
IncrCounter(SHUFFLE_COUNTER);
// LeaveISR();
}
}
/************************************************
*
* Task: ShufflingComplete
*
* Description: Task that is triggered when shuffling
* is complete.
*
************************************************/
TASK(ShufflingComplete)
{
SetEvent(DealCards,SHUFFLED);
SetEvent(ProcessKeyPress,SHUFFLED);
TerminateTask();
}
#endif /* SHUFFLEC */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -