use more c-style

This commit is contained in:
Olaf Rempel 2006-05-26 19:29:55 +02:00
parent 2dca010c7d
commit 9d7073387a

20
main.c
View File

@ -116,13 +116,13 @@ uint8_t gBuffer[SPM_PAGESIZE];
void sendchar(uint8_t data) void sendchar(uint8_t data)
{ {
loop_until_bit_is_set(UART_STATUS, UART_TXREADY); while (!(UART_STATUS & (1<<UART_TXREADY)));
UART_DATA = data; UART_DATA = data;
} }
uint8_t recvchar(void) uint8_t recvchar(void)
{ {
loop_until_bit_is_set(UART_STATUS, UART_RXREADY); while (!(UART_STATUS & (1<<UART_RXREADY)));
return UART_DATA; return UART_DATA;
} }
@ -335,19 +335,19 @@ int main(void)
#if (((F_CPU / 8 / 1000)*MY_WAIT) < 65535) #if (((F_CPU / 8 / 1000)*MY_WAIT) < 65535)
#warning Information: setting prescaler to 8 #warning Information: setting prescaler to 8
#define WAIT_VALUE ((F_CPU / 8 / 1000)*MY_WAIT) #define WAIT_VALUE ((F_CPU / 8 / 1000)*MY_WAIT)
TCCR1B |= _BV(CS01); TCCR1B |= (1<<CS01);
#elif ((((F_CPU / 64 / 1000)*MY_WAIT) < 65535)) #elif ((((F_CPU / 64 / 1000)*MY_WAIT) < 65535))
#warning Information: setting prescaler to 64 #warning Information: setting prescaler to 64
#define WAIT_VALUE ((F_CPU / 64 / 1000)*MY_WAIT) #define WAIT_VALUE ((F_CPU / 64 / 1000)*MY_WAIT)
TCCR1B |= _BV(CS01)| _BV(CS00); TCCR1B |= (1<<CS01) | (1<<CS00);
#elif ((((F_CPU / 256 / 1000)*MY_WAIT) < 65535)) #elif ((((F_CPU / 256 / 1000)*MY_WAIT) < 65535))
#warning Information: setting prescaler to 256 #warning Information: setting prescaler to 256
#define WAIT_VALUE ((F_CPU / 256 / 1000)*MY_WAIT) #define WAIT_VALUE ((F_CPU / 256 / 1000)*MY_WAIT)
TCCR1B |= _BV(CS02); TCCR1B |= (1<<CS02);
#else //((((F_CPU / 1024 / 1000)*MY_WAIT) < 65535)) #else //((((F_CPU / 1024 / 1000)*MY_WAIT) < 65535))
#warning Information: setting prescaler to 1024 #warning Information: setting prescaler to 1024
#define WAIT_VALUE ((F_CPU / 1024 / 1000)*MY_WAIT) #define WAIT_VALUE ((F_CPU / 1024 / 1000)*MY_WAIT)
TCCR1B |= _BV(CS00) |_BV(CS02); //1024 prescaler TCCR1B |= (1<<CS00) | (1<<CS02); //1024 prescaler
#endif #endif
while (1) { while (1) {
@ -464,19 +464,19 @@ int main(void)
#warning "Extension 'ReadFuseLock' enabled" #warning "Extension 'ReadFuseLock' enabled"
// read "low" fuse bits // read "low" fuse bits
} else if (val == 'F') { } else if (val == 'F') {
sendchar(read_fuse_lock(0x0000, _BV(BLBSET) | _BV(SPMEN))); sendchar(read_fuse_lock(0x0000, (1<<BLBSET) | (1<<SPMEN)));
// read lock bits // read lock bits
} else if (val == 'r') { } else if (val == 'r') {
sendchar(read_fuse_lock(0x0001, _BV(BLBSET) | _BV(SPMEN))); sendchar(read_fuse_lock(0x0001, (1<<BLBSET) | (1<<SPMEN)));
// read high fuse bits // read high fuse bits
} else if (val == 'N') { } else if (val == 'N') {
sendchar(read_fuse_lock(0x0003, _BV(BLBSET) | _BV(SPMEN))); sendchar(read_fuse_lock(0x0003, (1<<BLBSET) | (1<<SPMEN)));
// read extended fuse bits // read extended fuse bits
} else if (val == 'Q') { } else if (val == 'Q') {
sendchar(read_fuse_lock(0x0002, _BV(BLBSET) | _BV(SPMEN))); sendchar(read_fuse_lock(0x0002, (1<<BLBSET) | (1<<SPMEN)));
#endif #endif
// Return device type // Return device type