teensy 3.x i2c

This commit is contained in:
v01d 2016-08-13 18:57:50 -03:00
parent 5a97def131
commit 2743df1e64
3 changed files with 13 additions and 30 deletions

View File

@ -234,11 +234,11 @@
#ifdef CONFIG_KINETIS_I2C0
#ifdef CONFIG_TEENSY_3X_I2C_ALT_PINS
# define PIN_I2C0_SCL (PIN_I2C0_SCL_1 | PIN_ALT2_OPENDRAIN | PIN_ALT2_SLOW | PIN_ALT2_HIGHDRIVE)
# define PIN_I2C0_SDA (PIN_I2C0_SDA_1 | PIN_ALT2_OPENDRAIN | PIN_ALT2_SLOW | PIN_ALT2_HIGHDRIVE)
# define PIN_I2C0_SCL (PIN_I2C0_SCL_1 | PIN_ALT2_OPENDRAIN | PIN_ALT2_SLOW)
# define PIN_I2C0_SDA (PIN_I2C0_SDA_1 | PIN_ALT2_OPENDRAIN | PIN_ALT2_SLOW)
#else
# define PIN_I2C0_SCL (PIN_I2C0_SCL_2 | PIN_ALT2_OPENDRAIN | PIN_ALT2_SLOW /*| PIN_ALT2_HIGHDRIVE*/)
# define PIN_I2C0_SDA (PIN_I2C0_SDA_2 | PIN_ALT2_OPENDRAIN | PIN_ALT2_SLOW /*| PIN_ALT2_HIGHDRIVE*/)
# define PIN_I2C0_SCL (PIN_I2C0_SCL_2 | PIN_ALT2_OPENDRAIN | PIN_ALT2_SLOW)
# define PIN_I2C0_SDA (PIN_I2C0_SDA_2 | PIN_ALT2_OPENDRAIN | PIN_ALT2_SLOW)
#endif
#endif

View File

@ -2,24 +2,6 @@
* Included Files
************************************************************************************/
#if 0
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/i2c/i2c_master.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "chip.h"
#include "kinetis.h"
#include "teensy-3x.h"
#include "kinetis_i2c.h"
#endif
#include <nuttx/config.h>
#include <stdint.h>
@ -35,7 +17,6 @@
#include "kinetis_i2c.h"
#include "teensy-3x.h"
#if defined(CONFIG_KINETIS_I2C0) || defined(CONFIG_KINETIS_I2C1)
/************************************************************************************
@ -52,23 +33,22 @@
void kinetis_i2cdev_initialize(void)
{
FAR struct i2c_master_s *i2c;
i2c_dev = NULL;
#if defined(CONFIG_KINETIS_I2C0)
i2c = kinetis_i2cbus_initialize(0);
i2c_dev = kinetis_i2cbus_initialize(0);
#if defined(CONFIG_I2C_DRIVER)
i2c_register(i2c, 0);
i2c_register(i2c_dev, 0);
#endif
#endif
#if defined(CONFIG_KINETIS_I2C1)
i2c = kinetis_i2cbus_initialize(1);
#error Not yet supported in kinetis driver
i2c_dev = kinetis_i2cbus_initialize(1);
#if defined(CONFIG_I2C_DRIVER)
i2c_register(i2c, 1);
i2c_register(i2c_dev, 1);
#endif
#endif
}
#endif /* CONFIG_KINETIS_I2C0 || CONFIG_KINETIS_I2C1 */

View File

@ -44,6 +44,7 @@
#include <nuttx/compiler.h>
#include <stdint.h>
#include <arch/kinetis/chip.h>
#include <nuttx/i2c/i2c_master.h>
/************************************************************************************
* Pre-processor Definitions
@ -76,6 +77,8 @@
* Public data
************************************************************************************/
FAR struct i2c_master_s* i2c_dev;
#ifndef __ASSEMBLY__
/************************************************************************************