Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Energy-Driven Computing
MSP430FR5994 BOOSTXL-CC1120-90 Library
Commits
1ec114d1
Commit
1ec114d1
authored
Jul 05, 2019
by
Edward Longman
Browse files
Add libary usage to minimal example
parent
a8a74a36
Changes
2
Hide whitespace changes
Inline
Side-by-side
source/lib/uart_drv/CMakeLists.txt
0 → 100644
View file @
1ec114d1
cmake_minimum_required
(
VERSION 2.8
)
include
(
${
CMAKE_SOURCE_DIR
}
/../common.cmake
)
add_library
(
uart_drv
STATIC
circ_buf.c
uart_drv.c
ee_printf.c
)
source/test/min.c
View file @
1ec114d1
...
...
@@ -10,7 +10,7 @@
* LOCAL FUNCTIONS
*/
extern
void
msp_setup
(
void
);
extern
unsigned
long
volatile
time_counter
;
unsigned
long
volatile
time_counter
;
/******************************************************************************
* GLOBALS
...
...
@@ -53,11 +53,11 @@ void main (void)
WDTCTL
=
WDTPW
+
WDTHOLD
;
/* Setup MSP specific functions, IO's, timers and WDT */
//Comes from lib/hal_mcu/hal_mcu.c
//Comes from lib/hal_mcu/hal_mcu.c
msp_setup
();
/* Initialize the UART port */
//
hal_uart_init();
hal_uart_init
();
/* enable uart echo function */
//uart_drv_toggle_echo();
...
...
@@ -94,8 +94,9 @@ void main (void)
{
/* Put MCU in low power mode, wait for UART and blink LED */
//Skip Low power mode to debug
HAL_LED2_OFF
();
_BIS_SR
(
LPM0_bits
+
GIE
);
//
_BIS_SR(LPM0_bits + GIE);
HAL_LED2_ON
();
idle_counter
++
;
...
...
@@ -105,19 +106,87 @@ void main (void)
*/
switch
(
state
)
{
/* print the
main menu
to the UART buffer */
/* print the
tick state
to the UART buffer */
case
WAIT
:
if
(
idle_counter
>
250
){
state
=
IDLE_RESET
;
}
if
(
time_counter
>
5
){
state
=
IDLE_RESET
;
uartSendString
(
"Tic:
\n\r
"
);
time_counter
=
0
;
}
state
=
OPERATE
;
break
;
case
OPERATE
:
state
=
OPERATE
;
break
;
HAL_LED1_OFF
();
break
;
case
OPERATE
:
if
(
time_counter
>
5
){
state
=
WAIT
;
uartSendString
(
"Tic:
\n\r
"
);
time_counter
=
0
;
}
HAL_LED1_ON
();
break
;
default:
state
=
WAIT
;
break
;
}
}
}
/******************************************************************************
* @fn uartSendString
*
* @brief Implements a simple uart string sender by automatically finding
* the end of line delimeter and using it to call the uart sub
* functions
*
* input parameters
*
* @param unsigned char *str
*
* output parameters
*
* @return void
*
*/
void
uartSendString
(
char
*
str
)
{
unsigned
char
ii
;
for
(
ii
=
0
;
ii
<
UART_BUFF_SIZE
;
ii
++
)
{
if
(
str
[
ii
]
==
13
)
{
uart_put_str
(
str
,
ii
+
1
);
ii
=
UART_BUFF_SIZE
;
}
}
return
;
}
/******************************************************************************
* @fn wdt_isr
*
* @brief Interrupt service routine for watch dog timer.
*
* input parameters
*
* @param void
*
* output parameters
*
* @return void
*
*/
HAL_ISR_FUNC_DECLARATION
(
wdt_isr
,
WDT
)
{
/* global "0.5 second" counter used for printing time stamped packet sniffer data */
time_counter
++
;
/* check to see if wake on wdt is enabled */
if
(
wakeup_on_wdt
==
1
)
{
/* exit from low power mode on ISR exit */
//_BIC_SR_IRQ(LPM3_bits);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment