更新modbus,更新rtthread
This commit is contained in:
99
bsp_Device/bsp_SPI/bsp_W25Q.h
Normal file
99
bsp_Device/bsp_SPI/bsp_W25Q.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/*----------------------------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2022 Yuankang Liang(XerolySkinner)
|
||||
#
|
||||
# 本软件按原样提供,无任何明示或暗示
|
||||
# 在任何情况下,作者都不承担任何损害赔偿责任
|
||||
#
|
||||
# 使用的许可声明:
|
||||
# 1. 不得歪曲本软件的来源,你不能声称你编写了原始软件.
|
||||
# 2. 免费授予以任何目的,前提是版权声明出现在所有副本中.
|
||||
# 并且版权声明和许可声明同时出现.
|
||||
# 3. 你有使用,复制,修改,分发,和销售本软件的许可.
|
||||
# 4. 如果你在产品中使用,产品文档中的声明是赞赏的但不是必须的.
|
||||
# 5. 本通知不得从任何来源删除或更改.
|
||||
#
|
||||
# Yuankang Liang(XerolySkinner)
|
||||
# E-mail:zabbcccbbaz@163.com
|
||||
# QQ:2715099320
|
||||
# Mobile Phone:13005636215
|
||||
#
|
||||
# All rights reserved.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file bsp_W25Q.h
|
||||
* @brief 储存芯片
|
||||
* @mainpage 主要信息
|
||||
* @author Yuankang Liang(XerolySkinner)
|
||||
* @email zabbcccbbaz@163.com
|
||||
* @version V1.0.0
|
||||
* @date Mon Oct 9 08:32:28 2023
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __BSP_W25QXX_H
|
||||
#define __BSP_W25QXX_H
|
||||
|
||||
#include "varint.h"
|
||||
#include "spi.h"
|
||||
#ifdef __cplusplus
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// 类目
|
||||
/**
|
||||
* @brief TODO
|
||||
*/
|
||||
//W25X系列/Q系列芯片列表
|
||||
//W25Q80 ID 0XEF13
|
||||
//W25Q16 ID 0XEF14
|
||||
//W25Q32 ID 0XEF15
|
||||
//W25Q64 ID 0XEF16
|
||||
//W25Q128 ID 0XEF17
|
||||
#define W25Q80 0XEF13
|
||||
#define W25Q16 0XEF14
|
||||
#define W25Q32 0XEF15
|
||||
#define W25Q64 0XEF16
|
||||
#define W25Q128 0XEF17
|
||||
|
||||
extern u16 W25QXX_TYPE; //定义W25QXX芯片型号
|
||||
|
||||
#define W25QXX_CS_H HAL_GPIO_WritePin(W_CS_GPIO_Port,W_CS_Pin,GPIO_PIN_SET) //W25QXX的片选信号
|
||||
#define W25QXX_CS_L HAL_GPIO_WritePin(W_CS_GPIO_Port,W_CS_Pin,GPIO_PIN_RESET)
|
||||
//
|
||||
//指令表
|
||||
#define W25X_WriteEnable 0x06
|
||||
#define W25X_WriteDisable 0x04
|
||||
#define W25X_ReadStatusReg 0x05
|
||||
#define W25X_WriteStatusReg 0x01
|
||||
#define W25X_ReadData 0x03
|
||||
#define W25X_FastReadData 0x0B
|
||||
#define W25X_FastReadDual 0x3B
|
||||
#define W25X_PageProgram 0x02
|
||||
#define W25X_BlockErase 0xD8
|
||||
#define W25X_SectorErase 0x20
|
||||
#define W25X_ChipErase 0xC7
|
||||
#define W25X_PowerDown 0xB9
|
||||
#define W25X_ReleasePowerDown 0xAB
|
||||
#define W25X_DeviceID 0xAB
|
||||
#define W25X_ManufactDeviceID 0x90
|
||||
#define W25X_JedecDeviceID 0x9F
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void W25QXX_Init(void);
|
||||
u16 W25QXX_ReadID(void); //读取FLASH ID
|
||||
u8 W25QXX_ReadSR(void); //读取状态寄存器
|
||||
void W25QXX_Write_SR(u8 sr); //写状态寄存器
|
||||
void W25QXX_Write_Enable(void); //写使能
|
||||
void W25QXX_Write_Disable(void); //写保护
|
||||
void W25QXX_Write_NoCheck(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite);
|
||||
void W25QXX_Read(u8* pBuffer,u32 ReadAddr,u16 NumByteToRead); //读取flash
|
||||
void W25QXX_Write(u8* pBuffer,u32 WriteAddr,u16 NumByteToWrite);//写入flash
|
||||
void W25QXX_Erase_Chip(void); //整片擦除
|
||||
void W25QXX_Erase_Sector(u32 Dst_Addr); //扇区擦除
|
||||
void W25QXX_Wait_Busy(void); //等待空闲
|
||||
void W25QXX_PowerDown(void); //进入掉电模式
|
||||
void W25QXX_WAKEUP(void); //唤醒
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user