Kconfig: Add new WANT_SPI option to reduce code size
Make it possible to not compile in support for SPI on chips with small flash sizes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
|
||||
#include <string.h> // memcpy
|
||||
#include "autoconf.h" // CONFIG_HAVE_GPIO_SPI
|
||||
#include "autoconf.h" // CONFIG_WANT_SPI
|
||||
#include "board/gpio.h" // irq_disable
|
||||
#include "board/irq.h" // irq_disable
|
||||
#include "board/misc.h" // timer_read_time
|
||||
@@ -77,7 +77,7 @@ command_config_lis2dw(uint32_t *args)
|
||||
|
||||
switch (args[2]) {
|
||||
case SPI_SERIAL:
|
||||
if (CONFIG_HAVE_GPIO_SPI) {
|
||||
if (CONFIG_WANT_SPI) {
|
||||
ax->spi = spidev_oid_lookup(args[1]);
|
||||
ax->bus_type = SPI_SERIAL;
|
||||
break;
|
||||
@@ -126,7 +126,7 @@ lis2dw_query(struct lis2dw *ax, uint8_t oid)
|
||||
uint8_t fifo_ovrn = 0;
|
||||
uint8_t *d = &ax->sb.data[ax->sb.data_count];
|
||||
|
||||
if (CONFIG_HAVE_GPIO_SPI && ax->bus_type == SPI_SERIAL) {
|
||||
if (CONFIG_WANT_SPI && ax->bus_type == SPI_SERIAL) {
|
||||
uint8_t msg[7] = {0};
|
||||
uint8_t fifo[2] = {LIS_FIFO_SAMPLES | LIS_AM_READ , 0};
|
||||
|
||||
@@ -220,7 +220,7 @@ command_query_lis2dw_status(uint32_t *args)
|
||||
uint32_t time2 = 0;
|
||||
uint8_t status = 0;
|
||||
|
||||
if (CONFIG_HAVE_GPIO_SPI && ax->bus_type == SPI_SERIAL) {
|
||||
if (CONFIG_WANT_SPI && ax->bus_type == SPI_SERIAL) {
|
||||
uint8_t msg[2] = { LIS_FIFO_SAMPLES | LIS_AM_READ, 0x00 };
|
||||
time1 = timer_read_time();
|
||||
spidev_transfer(ax->spi, 1, sizeof(msg), msg);
|
||||
|
||||
Reference in New Issue
Block a user