Use the logging module (Openmote)

This commit is contained in:
George Oikonomou 2017-10-18 00:18:05 +01:00 committed by George Oikonomou
parent 82b6875e62
commit 59e5ec6860
2 changed files with 9 additions and 29 deletions

View File

@ -173,8 +173,8 @@ typedef uint32_t rtimer_clock_t;
* *
* @{ * @{
*/ */
#ifndef PLATFORM_CONF_STARTUP_VERBOSE #ifndef LOG_CONF_LEVEL_MAIN
#define PLATFORM_CONF_STARTUP_VERBOSE 1 /**< Set to 0 to decrease startup verbosity */ #define LOG_CONF_LEVEL_MAIN LOG_LEVEL_NONE /**< Set to 0 to decrease startup verbosity */
#endif #endif
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -269,8 +269,8 @@ typedef uint32_t rtimer_clock_t;
#undef UART_CONF_ENABLE #undef UART_CONF_ENABLE
#define UART_CONF_ENABLE 0 #define UART_CONF_ENABLE 0
#undef PLATFORM_CONF_STARTUP_VERBOSE #undef LOG_CONF_LEVEL_MAIN
#define PLATFORM_CONF_STARTUP_VERBOSE 0 #define LOG_CONF_LEVEL_MAIN LOG_LEVEL_NONE
#endif /* CC2538_CONF_QUIET */ #endif /* CC2538_CONF_QUIET */
/** /**

View File

@ -71,17 +71,10 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if PLATFORM_STARTUP_VERBOSE /* Log configuration */
#define PRINTF(...) printf(__VA_ARGS__) #include "sys/log.h"
#else #define LOG_MODULE "OpenMote CC2538"
#define PRINTF(...) #define LOG_LEVEL LOG_LEVEL_MAIN
#endif
#if UART_CONF_ENABLE
#define PUTS(s) puts(s)
#else
#define PUTS(s)
#endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**
* \brief Board specific iniatialisation * \brief Board specific iniatialisation
@ -121,17 +114,6 @@ set_rf_params(void)
/* Populate linkaddr_node_addr. Maintain endianness */ /* Populate linkaddr_node_addr. Maintain endianness */
memcpy(&linkaddr_node_addr, &ext_addr[8 - LINKADDR_SIZE], LINKADDR_SIZE); memcpy(&linkaddr_node_addr, &ext_addr[8 - LINKADDR_SIZE], LINKADDR_SIZE);
#if PLATFORM_STARTUP_VERBOSE
{
int i;
printf("Contiki configured with address ");
for(i = 0; i < LINKADDR_SIZE - 1; i++) {
printf("%02x:", linkaddr_node_addr.u8[i]);
}
printf("%02x\n", linkaddr_node_addr.u8[i]);
}
#endif
NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID); NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID);
NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr); NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr);
NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, CC2538_RF_CHANNEL); NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, CC2538_RF_CHANNEL);
@ -183,15 +165,13 @@ platform_init_stage_two()
void void
platform_init_stage_three() platform_init_stage_three()
{ {
PUTS(BOARD_STRING); LOG_INFO(BOARD_STRING);
board_init(); board_init();
set_rf_params(); set_rf_params();
#if PLATFORM_STARTUP_VERBOSE
soc_print_info(); soc_print_info();
#endif
process_start(&sensors_process, NULL); process_start(&sensors_process, NULL);