Read MMC5633 Product ID

/*
 * 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);
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值