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:
parent
7bc48f69c2
commit
4bcefbba73
2 changed files with 9 additions and 14 deletions
|
@ -1,2 +1 @@
|
||||||
CONFIG_SPI=y
|
CONFIG_SPI=y
|
||||||
CONFIG_SYS_LOG=y
|
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
#define PRINT printk
|
#define PRINT printk
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
|
||||||
#include <misc/sys_log.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <spi.h>
|
#include <spi.h>
|
||||||
#define SPI_DRV_NAME "SPI_0"
|
#define SPI_DRV_NAME "SPI_0"
|
||||||
|
@ -66,37 +63,36 @@ struct spi_config spi_conf = {
|
||||||
|
|
||||||
static void _spi_show(struct spi_config *spi_conf)
|
static void _spi_show(struct spi_config *spi_conf)
|
||||||
{
|
{
|
||||||
SYS_LOG_INF("SPI Configuration:");
|
PRINT("SPI Configuration:\n");
|
||||||
SYS_LOG_INF("\tbits per word: %u",
|
PRINT("\tbits per word: %u\n", SPI_WORD_SIZE_GET(spi_conf->config));
|
||||||
SPI_WORD_SIZE_GET(spi_conf->config));
|
PRINT("\tMode: %u\n", SPI_MODE(spi_conf->config));
|
||||||
SYS_LOG_INF("\tMode: %u", SPI_MODE(spi_conf->config));
|
PRINT("\tMax speed Hz: 0x%X\n", spi_conf->max_sys_freq);
|
||||||
SYS_LOG_INF("\tMax speed Hz: 0x%X", spi_conf->max_sys_freq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
struct device *spi;
|
struct device *spi;
|
||||||
|
|
||||||
SYS_LOG_INF("==== SPI Test Application ====");
|
PRINT("==== SPI Test Application ====\n");
|
||||||
|
|
||||||
spi = device_get_binding(SPI_DRV_NAME);
|
spi = device_get_binding(SPI_DRV_NAME);
|
||||||
|
|
||||||
SYS_LOG_INF("Running...");
|
PRINT("Running...\n");
|
||||||
|
|
||||||
spi_configure(spi, &spi_conf);
|
spi_configure(spi, &spi_conf);
|
||||||
spi_slave_select(spi, SPI_SLAVE);
|
spi_slave_select(spi, SPI_SLAVE);
|
||||||
|
|
||||||
_spi_show(&spi_conf);
|
_spi_show(&spi_conf);
|
||||||
|
|
||||||
SYS_LOG_INF("Writing...");
|
PRINT("Writing...\n");
|
||||||
spi_write(spi, (uint8_t *) wbuf, 6);
|
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);
|
print_buf_hex(rbuf, 6);
|
||||||
|
|
||||||
strcpy(wbuf, "So what then?");
|
strcpy(wbuf, "So what then?");
|
||||||
spi_transceive(spi, wbuf, 14, rbuf, 16);
|
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);
|
print_buf_hex(rbuf, 6);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue