|
26 | 26 | #define PRINT printk |
27 | 27 | #endif |
28 | 28 |
|
29 | | -#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO |
30 | | -#include <misc/sys_log.h> |
31 | | - |
32 | 29 | #include <string.h> |
33 | 30 | #include <spi.h> |
34 | 31 | #define SPI_DRV_NAME "SPI_0" |
@@ -66,37 +63,36 @@ struct spi_config spi_conf = { |
66 | 63 |
|
67 | 64 | static void _spi_show(struct spi_config *spi_conf) |
68 | 65 | { |
69 | | - SYS_LOG_INF("SPI Configuration:"); |
70 | | - SYS_LOG_INF("\tbits per word: %u", |
71 | | - SPI_WORD_SIZE_GET(spi_conf->config)); |
72 | | - SYS_LOG_INF("\tMode: %u", SPI_MODE(spi_conf->config)); |
73 | | - SYS_LOG_INF("\tMax speed Hz: 0x%X", spi_conf->max_sys_freq); |
| 66 | + PRINT("SPI Configuration:\n"); |
| 67 | + PRINT("\tbits per word: %u\n", SPI_WORD_SIZE_GET(spi_conf->config)); |
| 68 | + PRINT("\tMode: %u\n", SPI_MODE(spi_conf->config)); |
| 69 | + PRINT("\tMax speed Hz: 0x%X\n", spi_conf->max_sys_freq); |
74 | 70 | } |
75 | 71 |
|
76 | 72 | void main(void) |
77 | 73 | { |
78 | 74 | struct device *spi; |
79 | 75 |
|
80 | | - SYS_LOG_INF("==== SPI Test Application ===="); |
| 76 | + PRINT("==== SPI Test Application ====\n"); |
81 | 77 |
|
82 | 78 | spi = device_get_binding(SPI_DRV_NAME); |
83 | 79 |
|
84 | | - SYS_LOG_INF("Running..."); |
| 80 | + PRINT("Running...\n"); |
85 | 81 |
|
86 | 82 | spi_configure(spi, &spi_conf); |
87 | 83 | spi_slave_select(spi, SPI_SLAVE); |
88 | 84 |
|
89 | 85 | _spi_show(&spi_conf); |
90 | 86 |
|
91 | | - SYS_LOG_INF("Writing..."); |
| 87 | + PRINT("Writing...\n"); |
92 | 88 | spi_write(spi, (uint8_t *) wbuf, 6); |
93 | 89 |
|
94 | | - SYS_LOG_INF("SPI sent: %s", wbuf); |
| 90 | + PRINT("SPI sent: %s\n", wbuf); |
95 | 91 | print_buf_hex(rbuf, 6); |
96 | 92 |
|
97 | 93 | strcpy(wbuf, "So what then?"); |
98 | 94 | spi_transceive(spi, wbuf, 14, rbuf, 16); |
99 | 95 |
|
100 | | - SYS_LOG_INF("SPI transceived: %s", rbuf); |
| 96 | + PRINT("SPI transceived: %s\n", rbuf); |
101 | 97 | print_buf_hex(rbuf, 6); |
102 | 98 | } |
0 commit comments