芯片解密STM通道ADS1120 SPI驱动程序
- 芯片解密#include "ADS1220.h"
- void ADS1220SendByte(u8 Byte)
- {
- //HAL_SPI_Transmit(&hspi1,&Byte,1,10);
- SPI2_ReadWriteByte(Byte);
- }
- unsigned char ADS1220ReceiveByte()
- {
- unsigned char SData = 0xff ,Result = 0;
- Result = SPI2_ReadWriteByte(SData);
- //HAL_SPI_TransmitReceive(&hspi1,&SData,&Result,1,10);
- return Result;
- }
- /*
- ******************************************************************************
- higher level functions
- */
- void ADS1220ReadRegister(int StartAddress, int NumRegs, unsigned * pData)
- {
- int i;
- /* send the command byte */
- ADS1220SendByte(ADS1220_CMD_RREG | (((StartAddress<<2) & 0x0c) |((NumRegs-1)&0x03)));
- /* get the register content */
- for (i=0; i< NumRegs; i++)
- {
- *pData++ = ADS1220ReceiveByte();
- }
- return;
- }
- void ADS1220WriteRegister(int StartAddress, int NumRegs, unsigned char * pData)
- {
- int i;
- /* send the command byte */
- ADS1220SendByte(ADS1220_CMD_WREG | (((StartAddress<<2) & 0x0c) |((NumRegs-1)&0x03)));
- /* send the data bytes */
- for (i=0; i< NumRegs; i++)
- {
- ADS1220SendByte(*pData++);
- }
- return;
- }
- void ADS1220SendResetCommand()
- {
- /* send the command byte */
- ADS1220SendByte(ADS1220_CMD_RESET);
- return;
- }
- void ADS1220SendStartCommand()
- {
- /* send the command byte */
- ADS1220SendByte(ADS1220_CMD_SYNC);
- return;
- }
- void ADS1220SendShutdownCommand()
- {
- /* send the command byte */
- ADS1220SendByte(ADS1220_CMD_SHUTDOWN);
- return;
- }

芯片解密