Skip to content

Commit 9d177d0

Browse files
committed
default 16mhz and timer enable
1 parent 6a6e8a6 commit 9d177d0

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

config/mcu-cfg.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,21 @@ USART_Config()
199199
{
200200
/**
201201
* Baud rate register value --------------------------------------------------
202+
*
203+
* use USART_BAUD_REG_CALC() for normal speed
204+
* use USART_BAUD_REG_2X_CALC for 2x speed
202205
*/
203206
UBRR0 = USART_BAUD_REG_CALC(9600UL) ;
204-
207+
208+
/**
209+
* Baud rate speed increase by 2
210+
*
211+
* U2X0
212+
* Enable - _H_
213+
* Disable - _L_
214+
*/
215+
UCSR0A = _L_(U2X0) ;
216+
205217
/**
206218
* USART transmit and receive activation -------------------------------------
207219
*
@@ -293,7 +305,7 @@ TIMER0_Config()
293305
* Ext T0 falling - _H_ | _H_ | _L_
294306
* Ext T0 rising - _H_ | _H_ | _H_
295307
*/
296-
TCCR0B = _L_(CS02) | _L_(CS01) | _L_(CS00) ;
308+
TCCR0B = _L_(CS02) | _H_(CS01) | _H_(CS00) ;
297309

298310
/**
299311
* Timer0 count value --------------------------------------------------------

config/mcu-cfg.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,26 @@
2525
extern "C" {
2626
#endif
2727

28-
#define F_CPU (8000000UL)
28+
#define F_CPU (16000000UL)
2929

3030
#define MCU_GPIO_DRIVER ENABLE
3131
#define MCU_EXTERNAL_INTERRUPT_DRIVER DISABLE
3232
#define MCU_ADC_DRIVER DISABLE
33-
#define MCU_USART_DRIVER DISABLE
33+
#define MCU_USART_DRIVER ENABLE
3434
#define MCU_I2C_DRIVER DISABLE
3535
#define MCU_SPI_DRIVER DISABLE
36-
#define MCU_TIMER0_DRIVER DISABLE
36+
#define MCU_TIMER0_DRIVER ENABLE
3737
#define MCU_TIMER1_DRIVER DISABLE
3838
#define MCU_TIMER2_DRIVER DISABLE
3939

4040
#define IS_DRIVER_ENABLE(module) (MCU_##module##_DRIVER == ENABLE)
4141

4242
/* ############################# SYSTIMER DRIVER ############################ */
4343

44-
#define MICROSECONDS_PER_SYSTIMER_OVERFLOW (2000U)
44+
#define SYSTIMER_PRESCALLER (64U)
45+
#define SYSTIMER_MAX_COUNT (256U)
46+
#define MICROSECONDS_PER_SYSTIMER_OVERFLOW \
47+
CLOCK_CYCLE_TO_MICROSECONDS(SYSTIMER_PRESCALLER * SYSTIMER_MAX_COUNT)
4548

4649
/* ############################### GPIO DRIVER ############################## */
4750

0 commit comments

Comments
 (0)