/*
* Copyright (c) 2019-2021 Mauna Kea Semiconductor Holdings.
* All rights reserved.
*
*/
#include "mk_i2c.h"
#include "mk_trace.h"
#include "mk_wdt.h"
#include "mk_gpio.h"
#include "board.h"
#include "pin_mux.h"
#include "clock_config.h"
/*
MMC5633:
I2C Address:0x30
Product ID REG Address: 0x39, Value: 0x80
*/
/*
I2C_STATE_RESET = 0x00U,
I2C_STATE_READY = 0x01U,
I2C_STATE_BUSY_TX = 0x10U,
I2C_STATE_BUSY_RX = 0x20U,
I2C_STATE_BUSY_TRX = 0x30U,
I2C_STATE_TIMEOUT = 0x40U,
I2C_STATE_ERROR = 0x80U,
*/
#define MMC5633_PID_REG_ADDR 0x39
#define TARGET_ADDR 0x30
#define TEST_PORT I2C_ID0
#define SLAVE_TEST 0
static uint8_t rx_done = 0;
static uint8_t tx_done = 0;
static void i2c_read_callback(void *dev, uint32_t err_code)
{
rx_done = 1;
if (err_code)
{
LOG_INFO(TRACE_MODULE_APP, "I2C read error code %x\r\n", err_code);
Read MMC5633 Product ID
最新推荐文章于 2024-03-28 12:58:54 发布