91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

基于STM32的HMC5983驅(qū)動代碼,此處使用的是spi通信,通信部分自己寫。

資源截圖

代碼片段和文件信息

/*
*
*?1.調(diào)試開發(fā)參考hmc5983資料即可。
*
*/


#include?“stdio.h“
#include?“hmc5983.h“
#include?“stm32_Delay.h“
#include?“usb_lib.h“
#include?“string.h“

#define?Dummy_Byte???0x80????//虛假數(shù)據(jù)

//初始化hmc5983
void?hmc5983_init(void)
{
??u8?CheckID[]=“123“;
??GPIO_InitTypeDef?GPIO_InitStructure;
??spi2_init();

??RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB?ENABLE);

??GPIO_InitStructure.GPIO_Pin?=?GPIO_Pin_9?|?GPIO_Pin_12;
??GPIO_InitStructure.GPIO_Mode?=?GPIO_Mode_Out_PP;
??GPIO_InitStructure.GPIO_Speed?=?GPIO_Speed_50MHz;
??GPIO_Init(GPIOB?&GPIO_InitStructure);

??GPIO_ResetBits(GPIOBGPIO_Pin_9);


??hmc5983_ReadBuf(HMC5983_IDA_REGCheckID3);?//讀取機(jī)器ID進(jìn)而判斷芯片是否準(zhǔn)備ok
??if(strncmp((char*)CheckIDHMC5983_ID3)!=0)
??{
#ifdef?MY_DEBUG
????printf(“Didn‘t?check?to?HMC5983!?ReadID:%s\n“CheckID);
#endif
??}
??else
??{
#ifdef?MY_DEBUG
????printf(“The?HMC5983?is?ready!\n“);
#endif
????hmc5983_WriteByte(HMC5983_CONF_REG_A0x14);????//正常測量,1次平均?30HZ
????hmc5983_WriteByte(HMC5983_CONF_REG_B0x30);????//±2.5Ga
????hmc5983_WriteByte(HMC5983_MODE_REG??0x01);????//

評論

共有 條評論