Revert "misc: Remove generic PRINT macros from spi samples"

This reverts commit ea3a836e7e.

Change-Id: I7ad5d5c77244b3cec3eaed45a0348610bae15dec
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2016-08-23 13:15:03 -07:00
commit 4bcefbba73
2 changed files with 9 additions and 14 deletions

View file

@ -1,2 +1 @@
CONFIG_SPI=y
CONFIG_SYS_LOG=y

View file

@ -26,9 +26,6 @@
#define PRINT printk
#endif
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
#include <misc/sys_log.h>
#include <string.h>
#include <spi.h>
#define SPI_DRV_NAME "SPI_0"
@ -66,37 +63,36 @@ struct spi_config spi_conf = {
static void _spi_show(struct spi_config *spi_conf)
{
SYS_LOG_INF("SPI Configuration:");
SYS_LOG_INF("\tbits per word: %u",
SPI_WORD_SIZE_GET(spi_conf->config));
SYS_LOG_INF("\tMode: %u", SPI_MODE(spi_conf->config));
SYS_LOG_INF("\tMax speed Hz: 0x%X", spi_conf->max_sys_freq);
PRINT("SPI Configuration:\n");
PRINT("\tbits per word: %u\n", SPI_WORD_SIZE_GET(spi_conf->config));
PRINT("\tMode: %u\n", SPI_MODE(spi_conf->config));
PRINT("\tMax speed Hz: 0x%X\n", spi_conf->max_sys_freq);
}
void main(void)
{
struct device *spi;
SYS_LOG_INF("==== SPI Test Application ====");
PRINT("==== SPI Test Application ====\n");
spi = device_get_binding(SPI_DRV_NAME);
SYS_LOG_INF("Running...");
PRINT("Running...\n");
spi_configure(spi, &spi_conf);
spi_slave_select(spi, SPI_SLAVE);
_spi_show(&spi_conf);
SYS_LOG_INF("Writing...");
PRINT("Writing...\n");
spi_write(spi, (uint8_t *) wbuf, 6);
SYS_LOG_INF("SPI sent: %s", wbuf);
PRINT("SPI sent: %s\n", wbuf);
print_buf_hex(rbuf, 6);
strcpy(wbuf, "So what then?");
spi_transceive(spi, wbuf, 14, rbuf, 16);
SYS_LOG_INF("SPI transceived: %s", rbuf);
PRINT("SPI transceived: %s\n", rbuf);
print_buf_hex(rbuf, 6);
}