foxclever / experiphdriver Goto Github PK
View Code? Open in Web Editor NEW一个基于C语言开发的面向底层设备驱动的驱动库
一个基于C语言开发的面向底层设备驱动的驱动库
`/* 设置写使能所存器*/
void SetWriteEnableLatchForFM25xxx(FM25ObjectType *fram)
{
uint8_t opCode = FM25_WREN;
fram->ChipSelect(FM25CS_Enable);
fram->Write(&opCode, 1);
fram->ChipSelect(FM25CS_Disable);/*此处应该是DISABLE,好几处这里都需要修改 */
ReadStatusForFM25xxx(fram);
}
/向FM25xxx写入数据/
void WriteBytesToFM25xxx(FM25ObjectType *fram, uint32_t regAddress, uint8_t *wData, uint16_t wSize)
{
uint8_t data[128];
uint8_t temp;
uint16_t index = 0;
data[index++] = FM25_WRITE;
if (fram->memAddLength == FM258BitMemAdd)
{
data[index++] = (uint8_t)regAddress;
if ((fram->mode == FM25L04B) || (fram->mode == FM25040B))
{
temp = (uint8_t)(regAddress >> 8);
data[0] |= ((temp & 0x01) << 3);
}
}
else if (fram->memAddLength == FM2516BitMemAdd)
{
data[index++] = (uint8_t)(regAddress >> 8);
data[index++] = (uint8_t)regAddress;
}
else
{
data[index++] = (uint8_t)(regAddress >> 16);
data[index++] = (uint8_t)(regAddress >> 8);
data[index++] = (uint8_t)regAddress;
}
for (int i = 0; i < wSize; i++)
{
data[index++] = wData[i];
}
if (((fram->status) & 0x0C) != 0x00)
{
WriteStatusForFM25xx(fram, fram->status & (~FM25_BPALL)); /* 这里应该是去掉写保护,原始代码没有去掉*/
}
if (((fram->status) & 0x02) != 0x02)
{
SetWriteEnableLatchForFM25xxx(fram);/*去掉写保护后应该再写使能,才能正常写入数据*/
}
fram->ChipSelect(FM25CS_Enable);
fram->Write(data, index);
fram->ChipSelect(FM25CS_Disable);
WriteStatusForFM25xx(fram, fram->status | FM25_BPALL);
}`
查看注释部分
没有上传模拟spi的代码
您好,我是一个STM32初学者,非常感谢你们出的这一系列外设的驱动,对初学者很友好。我最近在调试AD7192这个数模转换器,用来你们的驱动,但是总是有点小问题,希望您们能在每一个驱动中给出一个示例,来演示如何初始化、如何调用函数,对于我这种小白帮助会很大,谢谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.