[avr] wrap setup functions in a cli/sei pair

This commit is contained in:
Bart Van Der Meerssche 2011-02-17 23:49:54 +01:00
parent 18d91b024f
commit 3bb1345b29
1 changed files with 5 additions and 0 deletions

View File

@ -245,6 +245,7 @@ ISR(TIMER1_CAPT_vect)
disable_led(); disable_led();
// throttle the cpu clock to draw less amps // throttle the cpu clock to draw less amps
// raises the number of bytes that can be written to EEPROM from 43 to 48
clock_prescale_set(clock_div_16); clock_prescale_set(clock_div_16);
event.brown_out++; event.brown_out++;
@ -389,6 +390,8 @@ int main(void)
{ {
uint8_t i; uint8_t i;
cli();
// RS-485: Configure PD5=DE as output pin with low as default // RS-485: Configure PD5=DE as output pin with low as default
DDRD |= (1<<DDD5); DDRD |= (1<<DDD5);
// set high to transmit // set high to transmit
@ -408,6 +411,8 @@ int main(void)
// initialize the SPI in slave mode // initialize the SPI in slave mode
setup_spi(SPI_MODE_2, SPI_MSB, SPI_INTERRUPT, SPI_SLAVE); setup_spi(SPI_MODE_2, SPI_MSB, SPI_INTERRUPT, SPI_SLAVE);
sei();
for(;;) { for(;;) {
if (spi_status & SPI_NEW_CTRL_MSG) { if (spi_status & SPI_NEW_CTRL_MSG) {