📄 sysinit.c
字号:
#include "public.h"
void port_init(void)
{
PORTA = 0x00;
DDRA = 0xFF;
PORTB = 0x00;
DDRB = 0xF7;
PORTC = 0xFF; //m103 output only
DDRC = 0x00;
PORTD = 0xFF;
DDRD = 0xFE; //PD0 input
PORTE = 0x00;
DDRE = 0xFE; //PE0 input
PORTF = 0x00;
DDRF = 0x00;
PORTG = 0x1F;
DDRG = 0x1F;
}
//call this routine to initialize all peripherals
void init_devices(void)
{
XDIV = 0x00; //xtal divider
XMCRA = 0x00; //external memory
port_init();
MCUCR = 0x00;
EICRA = 0x00; //extended ext ints
EICRB = 0x00; //extended ext ints
EIMSK = 0x00;
TIMSK = 0x00; //timer interrupt sources
ETIMSK = 0x00; //extended timer interrupt sources
}
void SysInit(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
init_devices();
spi_init();
AD_Init();
//SEI(); //re-enable interrupts
//all peripherals are now initialized
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -