mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Kinetis SPI and I2C are 0 based
The K whole family line has max 4 or each. But the supported
parts have the maximums listed below:
K46 and K66 3 SPI SPI0-SPI2
K46 and K66 4 I2C I2C0-I2C3
This commit is contained in:
@@ -51,7 +51,8 @@
|
||||
#include "kinetis.h"
|
||||
#include "twr-k60n512.h"
|
||||
|
||||
#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
|
||||
#if defined(CONFIG_KINETIS_SPI0) || defined(CONFIG_KINETIS_SPI1) || \
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
@@ -71,10 +72,10 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kinetis_spi1/2/3select and kinetis_spi1/2/3status
|
||||
* Name: kinetis_spi0/1/2select and kinetis_spi0/1/2status
|
||||
*
|
||||
* Description:
|
||||
* The external functions, kinetis_spi1/2/3select and kinetis_spi1/2/3status must be
|
||||
* The external functions, kinetis_spi0/1/2select and kinetis_spi0/1/2status must be
|
||||
* provided by board-specific logic. They are implementations of the select
|
||||
* and status methods of the SPI interface defined by struct spi_ops_s (see
|
||||
* include/nuttx/spi/spi.h). All other methods (including kinetis_spibus_initialize())
|
||||
@@ -83,7 +84,7 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
*
|
||||
* 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select
|
||||
* pins.
|
||||
* 2. Provide kinetis_spi1/2/3select() and kinetis_spi1/2/3status() functions in your
|
||||
* 2. Provide kinetis_spi0/1/2select() and kinetis_spi0/1/2status() functions in your
|
||||
* board-specific logic. These functions will perform chip selection and
|
||||
* status operations using GPIOs in the way your board is configured.
|
||||
* 3. Add a calls to kinetis_spibus_initialize() in your low level application
|
||||
@@ -95,6 +96,20 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI0
|
||||
void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI1
|
||||
void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
@@ -123,18 +138,4 @@ uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI3
|
||||
void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
#endif /* CONFIG_KINETIS_SPI0 || CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
|
||||
Reference in New Issue
Block a user