diff --git a/source/lib/hal_mcu/CMakeLists.txt b/source/lib/hal_mcu/CMakeLists.txt index 5cf04a2c17dec54f5ec513dedc6f242a1a4bb19d..e450b2630d7aa5cd54b196e85471ff75fbe2a7b5 100644 --- a/source/lib/hal_mcu/CMakeLists.txt +++ b/source/lib/hal_mcu/CMakeLists.txt @@ -5,9 +5,9 @@ include(${CMAKE_SOURCE_DIR}/../common.cmake) add_library( hal_mcu STATIC - #hal_f2_timerA0.c - #hal_f2_timerB0.c - #hal_f5_timerB0.c - #hal_fr5_timer.c + hal_f2_timerA0.c + hal_f2_timerB0.c + hal_f5_timerB0.c + hal_fr5_timer.c hal_mcu.c ) diff --git a/source/lib/hal_mcu/hal_fr5_timer.c b/source/lib/hal_mcu/hal_fr5_timer.c index 129003bf7fbafb9777948b5711a49159b3d491ea..2bc3fbf5bda4f4974fbbd0f9084165205ef74735 100644 --- a/source/lib/hal_mcu/hal_fr5_timer.c +++ b/source/lib/hal_mcu/hal_fr5_timer.c @@ -44,6 +44,12 @@ unsigned char volatile timer_event; unsigned long volatile time_counter = 0; +unsigned char get_reset_timer_wake_event(){ + unsigned char temp_event = timer_event; + timer_event = 0; + return temp_event; +} + /****************************************************************************** * @fn hal_timer_init * @@ -269,7 +275,7 @@ unsigned int hal_timer_wait(unsigned int time) { } /****************************************************************************** - * @fn TIMERA2_ISR + * @fn TIMERA0_ISR * * @brief Timer interrupt service routine * @@ -283,13 +289,12 @@ unsigned int hal_timer_wait(unsigned int time) { * @return void * */ -HAL_ISR_FUNC_DECLARATION(timer_a1_isr,TIMER_A1){ -//#pragma vector=TIMERB1_VECTOR -//__interrupt void TIMERB1_ISR(void) { +HAL_ISR_FUNC_DECLARATION(timer_a1_isr,TIMER_A0){ +//#pragma vector=TIMERA0_VECTOR +//__interrupt void TIMERA0_ISR(void) { /* Any access, read or write, of the TBIV register automatically * resets the highest "pending" interrupt flag. */ - switch( __even_in_range(TAIV,14) ) { case TA0IV_NONE: break; // No interrupt case TA0IV_TACCR1: // Used to wake up radio from sleep diff --git a/source/lib/hal_mcu/hal_timer.h b/source/lib/hal_mcu/hal_timer.h index 9d26169ed3125b5ea07002a1c67874f9b24ede01..07332b4297c4acd0340faaf1bf1f6a299bdb333b 100644 --- a/source/lib/hal_mcu/hal_timer.h +++ b/source/lib/hal_mcu/hal_timer.h @@ -37,6 +37,9 @@ /* prototypes using in creating a simple RF link */ +/* Get timer wake event type */ +unsigned char get_reset_timer_wake_event(); + /* Start packet timer using Timer using ACLK as reference */ void hal_timer_init(unsigned int master_count); diff --git a/source/lib/uart_drv/uart_drv.c b/source/lib/uart_drv/uart_drv.c index e2dbf738042dcf2b0f69da18e119b5fbfa8cbd3e..fec181bb7e7a9e29547a34386435e479f0c962eb 100644 --- a/source/lib/uart_drv/uart_drv.c +++ b/source/lib/uart_drv/uart_drv.c @@ -543,7 +543,6 @@ void hal_uart_start_tx(void) HAL_ISR_FUNC_DECLARATION(eUSCI_isr, EUSCI_A0) { char tmp_uart_data; - P1OUT ^= BIT0; switch(__even_in_range(UCA0IV,4)) { case UCIV__NONE: @@ -571,7 +570,6 @@ HAL_ISR_FUNC_DECLARATION(eUSCI_isr, EUSCI_A0) isr_state = TX_ISR_OFF; UCA0IE &= ~UCTXIE; // Disable USCI_A0 TX interrupt } - P1OUT ^= BIT0; break; // Vector 4 - TXIFG default: break; diff --git a/source/test/min2.c b/source/test/min2.c index 0376bb15dfbda114b30eaa06b7ad46f3eb8d8776..d3ce675d682a86ed57a421115a784261144c2d7f 100644 --- a/source/test/min2.c +++ b/source/test/min2.c @@ -3,6 +3,7 @@ #include "lib/radio_drv/hal_types.h" #include "lib/hal_mcu/hal_mcu_fr5.h" #include "lib/uart_drv/uart_drv.h" +#include "lib/hal_mcu/hal_timer.h" /****************************************************************************** * LOCAL FUNCTIONS @@ -53,11 +54,12 @@ void main (void) /* Initialize the UART port */ hal_uart_init(); - // Enable the interupts on port 2 to catch the user button (TRXEB) - + // Setup the timer + hal_timer_init(0xFFFF); P1DIR |= BIT0 | BIT1; + P1OUT |= BIT0 | BIT1; __enable_interrupt(); /* Infinite loop with a 1 second timer */ while(1) @@ -67,6 +69,7 @@ void main (void) if(idle_counter!=main_time_counter){ idle_counter=main_time_counter; ee_printf("Cnt:%3i\n\r", idle_counter); + ee_printf("TA0CCR:0x%4X\n\r", TA0R); _delay_us(100000); } } @@ -90,6 +93,6 @@ HAL_ISR_FUNC_DECLARATION(wdt_isr,WDT) { main_time_counter++; /* global "0.5 second" counter used for printing time stamped packet sniffer data */ - P1OUT ^= BIT1; + P1OUT ^= BIT0; }