[Bsp] stm32f10x add fm24cl64 drv

This commit is contained in:
Aubr.Cool committed 2017-07-20 11:55:27 +08:00
1 parent 8f4e80669b
commit 81feb775fa
4 files changed
+635

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
/*
* File : fm24cl64.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2017, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2017-07-17 aubrcool@qq.com 1st version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include "i2c/fm24clxx.h"
const struct fm24clxx_config fm24cl64_cfg =
{
.size = 64 * 1024,
.addr = 0x50,
.flags = 0,
};
int rt_hw_fm24cl64_init(const char *fm_device_name, const char *i2c_bus)
{
return fm24clxx_register(fm_device_name, i2c_bus, (void *)&fm24cl64_cfg);
}
+22
View File
@@ -0,0 +1,22 @@
/*
* File : fm24cl64.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2017, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2017-07-17 aubrcool@qq.com 1st version
*/
#ifndef __FM24CL64_H__
#define __FM24CL64_H__
#include <rtthread.h>
extern int rt_hw_fm24cl64_init(const char *fm_device_name, const char *i2c_bus);
#endif /*__FM24CL64_H__*/
File diff suppressed because it is too large. Load diff
+42
View File
@@ -0,0 +1,42 @@
/*
* File : stm32f1_i2c.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2017-07-04 aubrcool@qq.com 1st version
*/
#include "stm32f10x.h"
#include <rtdevice.h>
#ifndef __STM32F10X_I2C_H__
#define __STM32F10X_I2C_H__
#include "stm32f10x.h"
#include "stm32f10x_i2c.h"
#include "board.h"
struct stm32_i2c_bus
{
struct rt_i2c_bus_device parent;
struct rt_event ev;
I2C_TypeDef *I2C;
struct rt_i2c_msg *msg;
rt_uint32_t msg_cnt;
volatile rt_uint32_t msg_ptr;
volatile rt_uint32_t dptr;
rt_uint32_t wait_stop;
};
/* public function list */
rt_err_t stm32_i2c_register(I2C_TypeDef *I2C, rt_uint32_t bitrate,
const char * i2c_bus_name);
#endif /*__STM32F10X_I2C_H__*/