/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
* File Name : main.c
* Author : MCD Application Team
* Version : V2.0
* Date : 05/23/2008
* DescriptWHY8W-QT9DJ-P0VNX-L15PE-W4DCR-VP3FMion : Main program body
********************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
* FOR MORE INFORMATION PLEASE CAREFULLY READ THE LICENSE AGREEMENT FILE LOCATED
* IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.
*******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "si4432.h"
#define SI4432_CSH() GPIO_SetBits(GPIOB, GPIO_Pin_12) //P3OUT |= BIT0// PB12
#define SI4432_CSL() GPIO_ResetBits(GPIOB, GPIO_Pin_12) //P3OUT &= ~BIT0//
#define SI4432_SDNH() GPIO_SetBits(GPIOB, GPIO_Pin_1) //P3OUT |= BIT4//PB1
#define SI4432_SDNL() GPIO_ResetBits(GPIOB, GPIO_Pin_1) //P3OUT &= ~BIT4
#define SI4432_IRQ() GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_0) //(P2IN & BIT7) //PB0
static u8 Spi0Write(u8 byte);
void GPIO_Config(void);
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
#define code const
#define uint8 unsigned char
#define BAND_434
//#define BAND_868
//#define BAND_915
//==============================================================
// RF specific definitions
//==============================================================
#ifdef BAND_434
#define FW_VERSION "1.0 434MHz"
//define the default radio frequency
#define FREQ_BAND_SELECT 0x53 //frequency band select
#define NOMINAL_CAR_FREQ1 0x53 //default carrier frequency
#define NOMINAL_CAR_FREQ2 0x40
#endif
#ifdef BAND_868
#define FW_VERSION "1.0 868MHz"
//define the default radio ferquency
#define FREQ_BAND_SELECT 0x73 //frequency band select
#define NOMINAL_CAR_FREQ1 0x2C //default carrier frequency
#define NOMINAL_CAR_FREQ2 0x60
#endif
#ifdef BAND_915
#define FW_VERSION "1.0 915MHz"
//define the default radio ferquency
#define FREQ_BAND_SELECT 0x75 //frequency band select
#define NOMINAL_CAR_FREQ1 0x0A //default carrier frequency
#define NOMINAL_CAR_FREQ2 0x80
#endif
/*------------------------------------------------------------------------*/
/* GLOBAL variables */
/*------------------------------------------------------------------------*/
const unsigned char RMRfSettings[NMBR_OF_SAMPLE_SETTING1][NMBR_OF_PARAMETER] =
{
//revV2
// IFBW, COSR, CRO2, CRO1, CRO0, CTG1, CTG0, TDR1, TDR0, MMC1, FDEV, B_TIME
{0x01, 0x83, 0xc0, 0x13, 0xa9, 0x00, 0x05, 0x13, 0xa9, 0x20, 0x3a }, //DR: 2.4kbps, DEV: +-36kHz, BBBW: 75.2kHz
{0x04, 0x41, 0x60, 0x27, 0x52, 0x00, 0x0a, 0x27, 0x52, 0x20, 0x48 }, //DR: 4.8kbps, DEV: +-45kHz, BBBW: 95.3kHz
{0x91, 0x71, 0x40, 0x34, 0x6e, 0x00, 0x18, 0x4e, 0xa5, 0x20, 0x48 }, //DR: 9.6kbps, DEV: +-45kHz, BBBW: 112.8kHz
{0x26, 0x34, 0x02, 0x75, 0x25, 0x07, 0xFF, 0x9D, 0x49, 0x20, 0x15 }, //DR: 19.2kbps, DEV: +-9.6kHz, BBBW: 28.8kHz
{0x16, 0x34, 0x02, 0x75, 0x25, 0x07, 0xFF, 0x09, 0xD5, 0x00, 0x1F }, //DR: 38.4kbps, DEV: +-19.2kHz, BBBW: 57.6kHz
{0x03, 0x45, 0x01, 0xD7, 0xDC, 0x07, 0x6E, 0x0E, 0xBF, 0x00, 0x2E }, //DR: 57.6kbps, DEV: +-28.8kHz, BBBW: 86.4kHz
{0x99, 0x34, 0x02, 0x75, 0x25, 0x07, 0xFF, 0x1D, 0x7E, 0x00, 0x5C }, //DR: 115.2kbps, DEV: +-57.6kHz, BBBW: 172.8kHz
};
const unsigned char CMRfSettings[NMBR_OF_SAMPLE_SETTING2][NMBR_OF_PARAMETER] =
{
//revV2
// IFBW, COSR, CRO2, CRO1, CRO0, CTG1, CTG0, TDR1, TDR0, MMC1, FDEV, B_TIME
{0x8F, 0xE5, 0x80, 0x1A, 0x28, 0x00, 0x08, 0x4e, 0x79, 0x20, 0x90 }, //DR: 9.6kbps, DEV: +-90kHz, BBBW:184.8kHz
};
#ifdef BAND_434
//parameters of the frequency setting
const uint8 FreqSettings[4][7] =
{
// 2.4kbps, 4.8kbps, 9.6kbps, 19.2kbps, 38.4kbps 57.6kbps 115.2kbps
{4, 4, 4, 3, 3, 2, 1 }, //max channel number
{0x53, 0x53, 0x53, 0x58, 0x56, 0x5A, 0x61 }, //start freq. reg1
{0x40, 0x40, 0x40, 0x40, 0xC0, 0x40, 0xC0 }, //start freq. reg2
{33, 33, 33, 39, 45, 36, 0 }, //freq. step
};
#endif
#ifdef BAND_868
//parameters of the frequency setting
code uint8 FreqSettings[4][7] =
{
// 2.4kbps, 4.8kbps, 9.6kbps, 19.2kbps, 38.4kbps 57.6kbps 115.2kbps
{14, 14, 14, 11, 10, 8, 6 }, //max channel number
{0x2C, 0x2C, 0x2C, 0x2E, 0x2D, 0x2E, 0x32 }, //start freq. reg1
{0x60, 0x60, 0x60, 0x40, 0x40, 0xE0, 0x00 }, //start freq. reg2
{45, 45, 45, 55, 64, 78, 100 }, //freq. step
};
#endif
#ifdef BAND_915
//parameters of the frequency setting
code uint8 FreqSettings[4][7] =
{
// 2.4kbps, 4.8kbps, 9.6kbps, 19.2kbps, 38.4kbps 57.6kbps 115.2kbps
{60, 60, 60, 52, 45, 37, 29 }, //max channel number
{0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A }, //start freq. reg1
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }, //start freq. reg2
{48, 48, 48, 55, 64, 78, 100 }, //freq. step
};
#endif
unsigned char rf_ch;
unsigned char rf_pwr;
unsigned char rf_dr;
//RF_SAMPLE_SETTINGS rf_dr;
unsigned char mode = 0; //普通模式
void delay_ms(unsigned int delay)
{
unsigned int j;
unsigned short i;
if( delay == 0 )
{
return;
}
for(j=0;j<delay;j++)
{
for(i=0;i<2000;i++);
}
}
void Delay(u32 nCount)
{
for(; nCount != 0; nCount--);
}
void InitSPI2()
{
SPI_InitTypeDef SPI_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2,ENABLE);
SPI_Cmd(SPI2, DISABLE); //必须先禁能,才能改变MODE
SPI_InitStructure.SPI_Direction =SPI_Direction_2Lines_FullDuplex; //两线全双工
SPI_InitStructure.SPI_Mode =SPI_Mode_Master; //主
SPI_InitStructure.SPI_DataSize =SPI_DataSize_8b; //8位
SPI_InitStructure.SPI_CPOL =SPI_CPOL_High; //CPOL=1时钟悬空高
SPI_InitStructure.SPI_CPHA =SPI_CPHA_2Edge; //CPHA=1 数据捕获第2个
SPI_InitStructure.SPI_NSS =SPI_NSS_Soft; //软件NSS
SPI_InitStructure.SPI_BaudRatePrescaler =SPI_BaudRatePrescaler_256; //256分频
SPI_InitStructure.SPI_FirstBit =SPI_FirstBit_MSB; //高位在前
SPI_InitStructure.SPI_CRCPolynomial =7; //CRC7
SPI_Init(SPI2,&SPI_InitStructure);
SPI_Cmd(SPI2, ENABLE);
//spi的配置结束了可以使用了。
}
/*******************************************************************************
* Function Name : main
* Description : Main program.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
//读写十六位数据
unsigned short SpiReadWriteWord(unsigned short spi_in)
{
unsigned short temp16;
SI4432_CSL();
temp16 = (unsigned short) (Spi0Write( (unsigned char)((spi_in & 0xFF00) >> 8) ));
temp16 <<= 8;
temp16 += (unsigned short) (Spi0Write( (unsigned char)(spi_in & 0x00FF) ));
SI4432_CSH();
return temp16;
}
//写入地址和数据
void SpiWriteAddressData(unsigned char addr, unsigned char data)
{
SI4432_CSL();
Spi0Write(addr);
Spi0Write(data);
SI4432_CSH();
}
static u8 Spi0Write(u8 byte)
{
//while((SPI2->SR &SPI_I2S_FLAG_TXE)==RESET);
while((SPI_I2S_GetFlagStatus(SPI2,SPI_I2S_FLAG_TXE))==RESET);
//SPI2->DR = byte;
SPI_I2S_SendData(SPI2,byte);
//while((SPI2->SR &SPI_I2S_FLAG_RXNE)==RESET);
while((SPI_I2S_GetFlagStatus(SPI2,SPI_I2S_FLAG_RXNE))==RESET);
//return(SPI2->DR);
return( SPI_I2S_ReceiveData(SPI2) );//读寄存器用硬件清除标志位。
//SPI_I2S_ClearFlag(SPI2,SPI_I2S_FLAG_RXNE) ;直接软件清除标志位。
}
//SI4432初始化
RF_ENUM RfInitHw(void)
{
//Init IO
// P3DIR |= BIT0; //cs PB12
// P3DIR |= BIT4; //SDN PB1
// P2DIR &= ~BIT7; //nIRQ PB0
SI4432_CSH();
SI4432_SDNL();
InitSPI2();
//
SpiReadWriteWord(InterruptStatus1 << 8);
SpiReadWriteWord(InterruptStatus2 << 8);
//SW reset -> wait for POR interrupt
SpiWriteAddressData((REG_WRITE | OperatingFunctionControl1), 0x80);
//wait for POR interrupt from the radio (while the nIRQ pin is high)
while(SI4432_IRQ());
//read interrupt status registers to clear the interrupt flags and release NIRQ pin
SpiReadWriteWord(InterruptStatus1 << 8);
SpiReadWriteWord(InterruptStatus2 << 8);
//wait for chip ready interrupt from the radio (while the nIRQ pin is high)
while (SI4432_IRQ());
//read interrupt status registers to clear the interrupt flags and release NIRQ pin
SpiReadWriteWord(InterruptStatus1 << 8);
SpiReadWriteWord(InterruptStatus2 << 8);
//disable all ITs, except 'ichiprdy'
SpiWriteAddressData((REG_WRITE | InterruptEnable1), 0x00);
SpiWriteAddressData((REG_WRITE | InterruptEnable2), 0x02);
SpiReadWriteWord(InterruptStatus1 << 8);
SpiReadWriteWord(InterruptStatus2 << 8);
//set VCO
SpiWriteAddressData((REG_WRITE | VCOCurrentTrimming), 0x7F);
SpiWriteAddressData((REG_WRITE | DividerCurrentTrimming), 0xC0);
//reset digital testbus, disable scan test
SpiWriteAddressData((REG_WRITE | DigitalTestBus), 0x00);
//select nothing to the Analog Testbus
SpiWriteAddressData((REG_WRITE | AnalogTestBus), 0x0B);
//set frequency
SpiWriteAddressData((REG_WRITE | FrequencyBandSelect), FREQ_BAND_SELECT);
SpiWriteAddressData((REG_WRITE | NominalCarrierFrequency1), NOMINAL_CAR_FREQ1);
SpiWriteAddressData((REG_WRITE | NominalCarrierFrequency0), NOMINAL_CAR_FREQ2);
//set cap. bank rev. V2
SpiWriteAddressData((REG_WRITE | CrystalOscillatorLoadCapacitance), 0xD7);
//disable RX-TX headers,
SpiWriteAddressData((REG_WRITE | HeaderControl1), 0x00 );
SpiWriteAddressData((REG_WRITE | HeaderControl2), 0x02 );
SpiWriteAddressData((REG_WRITE | SyncWord3), 0x2D);
SpiWriteAddressData((REG_WRITE | SyncWord2), 0xD4);
//set GPIO0 to GND
SpiWriteAddressData((REG_WRITE | GPIO2Configuration), 0x14); //接收数据
//set GPIO1 & GPIO2 to control the TRX switch
SpiWriteAddressData((REG_WRITE | GPIO0Configuration), 0x15); //接收状态
SpiWriteAddressData((REG_WRITE | GPIO1Configuration), 0x12); //发送状态
rf_pwr = 0x1F; //default output power
rf_ch = 0; //default frequency channel
set_frq(rf_ch);
set_pwr(rf_pwr);
if (mode == 0)
{
rf_dr = 2; //default datarate 9.6 kbps
RFSetRfParameters((RF_SAMPLE_SETTINGS)rf_dr);
}
else
{
rf_dr = 0; //default datarate 9.6 kbps
RFSetRfParameters((RF_SAMPLE_SETTINGS)rf_dr);
}
return RF_OK;
}
//发送数据
RF_ENUM RFTransmit(uint8 * packet, uint8 length)
{
uint8 temp8;
//set packet content
SpiWriteAddressData((REG_WRITE | TransmitPacketLength), length);
for(temp8=0;temp8<length;temp8++)
{
SpiWriteAddressData((REG_WRITE | FIFOAccess),packet[temp8]);
}
//enable transmitter
SpiWriteAddressData((REG_WRITE | OperatingFunctionControl1), 0x09);
//enable the wanted ITs
SpiWriteAddressData((REG_WRITE | InterruptEnable1), 0x04);
SpiWriteAddressData((REG_WRITE | InterruptEnable2), 0x00);
SpiReadWriteWord(InterruptStatus1 << 8);
SpiReadWriteWord(InterruptStatus2 << 8);
while(SI4432_IRQ());
return RF_OK;
}
//接收数据
RF_ENUM RFReceive(void)
{
//enable receiver chain
SpiWriteAddressData((REG_WRITE | OperatingFunctionControl1), 0x05);
//enable the wanted ITs
SpiWriteAddressData((REG_WRITE | InterruptEnable1), 0x03);
SpiWriteAddressData((REG_WRITE | InterruptEnable2), 0x00);
SpiReadWriteWord(InterruptStatus1 << 8);
SpiReadWriteWord(InterruptStatus2 << 8);
return RF_OK;
}
RF_ENUM RFIdle(void)
{
SpiWriteAddressData((REG_WRITE | OperatingFunctionControl1), 0x01);
//diasble all ITs
SpiWriteAddressData((REG_WRITE | InterruptEnable1), 0x00);
SpiWriteAddressData((REG_WRITE | InterruptEnable2), 0x00);
SpiReadWriteWord(InterruptStatus1 << 8);
SpiReadWriteWord(InterruptStatus2 << 8);
return RF_OK;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: RF_ENUM RFPacketReceived(uint8 * packet, uint8 * length)
+
+ DESCRIPTION: check wheter the packet received or not.
+
+ INPUT: pointers for storing data and length
+
+ RETURN: RF_PACKET_RECEIVED: packet received
+ RF_NO_PACKET: packet is not yet received
+
+ NOTES:
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
RF_ENUM RFPacketReceived(uint8 * packet, uint8 * length)
{
uint8 i;
if(SI4432_IRQ() == 0)
{
i = (uint8)(0x00FF & SpiReadWriteWord(InterruptStatus1 << 8));
if( (i & 0x01) == 0x01 )
{//CRC error
//disable receiver
SpiWriteAddressData((REG_WRITE | OperatingFunctionControl1), 0x01);
return RF_CRC_ERROR;
}
if( (i & 0x02) == 0x02 )
{//packet received
//read buffer
*length = (uint8)(0x00FF & SpiReadWriteWord(ReceivedPacketLength << 8)) ;
for(i=0;i<*length;i++)
{
*packet++ = (uint8)(0x00FF & SpiReadWriteWord(FIFOAccess << 8));
}
//disable receiver
SpiWriteAddressData((REG_WRITE | OperatingFunctionControl1), 0x01);
return RF_PACKET_RECEIVED;
}
}
return RF_NO_PACKET;
}
RF_ENUM RFSetRfParameters(RF_SAMPLE_SETTINGS setting)
{
if (mode == 0)
{
//set the registers according the selected RF settings in the range mode
SpiWriteAddressData((REG_WRITE | IFFilterBandwidth), RMRfSettings[setting][0] );
SpiWriteAddressData((REG_WRITE | ClockRecoveryOversamplingRatio), RMRfSettings[setting][1]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryOffset2), RMRfSettings[setting][2]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryOffset1), RMRfSettings[setting][3]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryOffset0), RMRfSettings[setting][4]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryTimingLoopGain1), RMRfSettings[setting][5]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryTimingLoopGain0), RMRfSettings[setting][6]);
SpiWriteAddressData((REG_WRITE | TXDataRate1), RMRfSettings[setting][7]);
SpiWriteAddressData((REG_WRITE | TXDataRate0), RMRfSettings[setting][8]);
SpiWriteAddressData((REG_WRITE | ModulationModeControl1), RMRfSettings[setting][9]);
SpiWriteAddressData((REG_WRITE | FrequencyDeviation), RMRfSettings[setting][10]);
}
else
{
//set the registers according the selected RF settings in the compatible mode
SpiWriteAddressData((REG_WRITE | IFFilterBandwidth), CMRfSettings[setting][0] );
SpiWriteAddressData((REG_WRITE | ClockRecoveryOversamplingRatio), CMRfSettings[setting][1]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryOffset2), CMRfSettings[setting][2]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryOffset1), CMRfSettings[setting][3]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryOffset0), CMRfSettings[setting][4]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryTimingLoopGain1), CMRfSettings[setting][5]);
SpiWriteAddressData((REG_WRITE | ClockRecoveryTimingLoopGain0), CMRfSettings[setting][6]);
SpiWriteAddressData((REG_WRITE | TXDataRate1), CMRfSettings[setting][7]);
SpiWriteAddressData((REG_WRITE | TXDataRate0), CMRfSettings[setting][8]);
SpiWriteAddressData((REG_WRITE | ModulationModeControl1), CMRfSettings[setting][9]);
SpiWriteAddressData((REG_WRITE | FrequencyDeviation), CMRfSettings[setting][10]);
}
//enable packet handler & CRC16
SpiWriteAddressData((REG_WRITE | DataAccessControl), 0x8D);
SpiWriteAddressData((REG_WRITE | ModulationModeControl2), 0x63);
//set preamble length & detection threshold
SpiWriteAddressData((REG_WRITE | PreambleLength), (PREAMBLE_LENGTH << 1));
SpiWriteAddressData((REG_WRITE | PreambleDetectionControl), ( PD_LENGTH << 4) );
SpiWriteAddressData((REG_WRITE | ClockRecoveryGearshiftOverride), 0x03);
SpiWriteAddressData((REG_WRITE | AFCLoopGearshiftOverride), 0x40);
return RF_OK;
}
RF_ENUM set_frq(uint8 frq)
{
//set frequency
SpiWriteAddressData((REG_WRITE | NominalCarrierFrequency1), FreqSettings[1][rf_dr] );
SpiWriteAddressData((REG_WRITE | NominalCarrierFrequency0), FreqSettings[2][rf_dr] );
SpiWriteAddressData((REG_WRITE | FrequencyHoppingStepSize), FreqSettings[3][rf_dr] );
SpiWriteAddressData((REG_WRITE | FrequencyHoppingChannelSelect), frq);
delay_ms(100);//wait a bit
return RF_OK;
}
RF_ENUM set_pwr(uint8 pwr)
{
SpiWriteAddressData((REG_WRITE | TXPower), pwr);
delay_ms(100); //wait a bit
return RF_OK;
}
void GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |
RCC_APB2Periph_GPIOB |
RCC_APB2Periph_GPIOC |
RCC_APB2Periph_GPIOD |
RCC_APB2Periph_GPIOE |
RCC_APB2Periph_AFIO, ENABLE);
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE); //JTAG禁用但SW-DP使能
GPIO_DeInit(GPIOB);
/**
LED1 -> PB8 , LED2 -> PB9 , LED3 -> PE0 , LED4 -> PE1
*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13|GPIO_Pin_15|GPIO_Pin_14;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
/*GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure); */
}
#include <string.h>
#include <stdio.h>
int main(void)
{
char buf[100];
SystemInit();
GPIO_Config();
RfInitHw();
sprintf(buf,"%s","yufujian\n");
while (1)
{
// RfInitHw();
RFTransmit((unsigned char*)buf,strlen(buf));
// delay_ms(1000);
// Spi0Write(0x81);
// delay_ms(1);
}
return 0;
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t* file, uint32_t line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/