📄 aptask.c
字号:
#include "ap89021.h"
#include "apTask.h"
#include "ap89021.h"
#include <iom16v.h>
#include <macros.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
//interface
extern unsigned short currentImpact;
extern unsigned short impactCounter;
extern unsigned char currentImpactUpdated;
//Thresholds
#include "defSound.h"
void apTask(void)
{
unsigned char sndNum,i;
unsigned char apImpactUpdated = 0;
unsigned short apCurrentImpact;
if(apIsBusy())
return;
//read interface!!!
CLI();
if(currentImpactUpdated&0x02)
{
currentImpactUpdated &= ~0x02;
apImpactUpdated = 1;
apCurrentImpact = currentImpact;
}
SEI();
//Play sound
if (!apImpactUpdated)
return;
sndNum = 0xFF; //No Sound
for(i=0;i<NumThresholds;i++)
{
if(apCurrentImpact>=thresholdSetting[i])
sndNum = i;
else
break;
}
if(sndNum<NumThresholds)
apPlay(sndNum);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -