use more c-style
This commit is contained in:
parent
2dca010c7d
commit
9d7073387a
20
main.c
20
main.c
@ -116,13 +116,13 @@ uint8_t gBuffer[SPM_PAGESIZE];
|
||||
|
||||
void sendchar(uint8_t data)
|
||||
{
|
||||
loop_until_bit_is_set(UART_STATUS, UART_TXREADY);
|
||||
while (!(UART_STATUS & (1<<UART_TXREADY)));
|
||||
UART_DATA = data;
|
||||
}
|
||||
|
||||
uint8_t recvchar(void)
|
||||
{
|
||||
loop_until_bit_is_set(UART_STATUS, UART_RXREADY);
|
||||
while (!(UART_STATUS & (1<<UART_RXREADY)));
|
||||
return UART_DATA;
|
||||
}
|
||||
|
||||
@ -335,19 +335,19 @@ int main(void)
|
||||
#if (((F_CPU / 8 / 1000)*MY_WAIT) < 65535)
|
||||
#warning Information: setting prescaler to 8
|
||||
#define WAIT_VALUE ((F_CPU / 8 / 1000)*MY_WAIT)
|
||||
TCCR1B |= _BV(CS01);
|
||||
TCCR1B |= (1<<CS01);
|
||||
#elif ((((F_CPU / 64 / 1000)*MY_WAIT) < 65535))
|
||||
#warning Information: setting prescaler to 64
|
||||
#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))
|
||||
#warning Information: setting prescaler to 256
|
||||
#define WAIT_VALUE ((F_CPU / 256 / 1000)*MY_WAIT)
|
||||
TCCR1B |= _BV(CS02);
|
||||
TCCR1B |= (1<<CS02);
|
||||
#else //((((F_CPU / 1024 / 1000)*MY_WAIT) < 65535))
|
||||
#warning Information: setting prescaler to 1024
|
||||
#define WAIT_VALUE ((F_CPU / 1024 / 1000)*MY_WAIT)
|
||||
TCCR1B |= _BV(CS00) |_BV(CS02); //1024 prescaler
|
||||
TCCR1B |= (1<<CS00) | (1<<CS02); //1024 prescaler
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
@ -464,19 +464,19 @@ int main(void)
|
||||
#warning "Extension 'ReadFuseLock' enabled"
|
||||
// read "low" fuse bits
|
||||
} 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
|
||||
} 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
|
||||
} 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
|
||||
} else if (val == 'Q') {
|
||||
sendchar(read_fuse_lock(0x0002, _BV(BLBSET) | _BV(SPMEN)));
|
||||
sendchar(read_fuse_lock(0x0002, (1<<BLBSET) | (1<<SPMEN)));
|
||||
#endif
|
||||
|
||||
// Return device type
|
||||
|
Loading…
Reference in New Issue
Block a user