📄 tools.c
字号:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include "tools.h"
volatile unsigned char t1_tick;
unsigned char t1_cnt;
//Konstanten im EEPROM
#define EEPROM __attribute__ ((section (".eeprom")))
//Variablen im EEPROM
EEPROM unsigned char eeprom_sck_period=10;
ISR(SIG_OUTPUT_COMPARE1A)
{
t1_tick=1;
t1_cnt++;
}
unsigned char get_t1_tick(void)
{
if (t1_tick)
{
t1_tick=0;
return 1;
}
return 0;
}
/**
Wartet n*1ms - 1ms max.
*/
void wait_ms(unsigned int n)
{
while (n)
{
if (get_t1_tick()) n--;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -