亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nrf24l01.c

?? nRF24L01開發指導
?? C
?? 第 1 頁 / 共 3 頁
字號:
//if the argument rx_active_mode is false, the receiver will remain in standby mode
//  and not monitor for packets.  If the argument is true, the CE pin will be set 
//  and the 24L01 will monitor for packets.
void nrf24l01_set_as_rx_param(bool rx_active_mode, unsigned char config)
{
	config |= nrf24l01_CONFIG_PRIM_RX;
	
	if((config & nrf24l01_CONFIG_PWR_UP) != 0)
		nrf24l01_power_up_param(rx_active_mode, config);
	else
		nrf24l01_power_down_param(config);
}

//takes a 24L01 that is already in RX standby mode and puts it in active RX mode
void nrf24l01_rx_standby_to_active()
{
	nrf24l01_set_ce();
}

//takes a 24L01 that is already in active RX mode and puts it in RX standy mode
void nrf24l01_rx_active_to_standby()
{
	nrf24l01_clear_ce();
}

//sets up the 24L01 as a transmitter
//this function takes the existing contents of the CONFIG register and simply
//  clears the PRIM_RX bit in the CONFIG register.
//note: if the read value of the CONFIG register already has the PRIM_RX bit cleared, this 
//  function exits in order to not make an unecessary register write.
void nrf24l01_set_as_tx()
{
	unsigned char config;
	
	nrf24l01_read_register(nrf24l01_CONFIG, &config, 1);
	
	if((config & nrf24l01_CONFIG_PRIM_RX) == 0)
		return;
	
	config &= (~nrf24l01_CONFIG_PRIM_RX);
	
	nrf24l01_write_register(nrf24l01_CONFIG, &config, 1);

	nrf24l01_clear_ce();
}

//sets up the 24L01 as a transmitter
//this function allows the user to set the contents of the CONFIG register, but the function
//  clears the PRIM_RX bit in the CONFIG register, so the user does not need to.
void nrf24l01_set_as_tx_param(unsigned char config)
{
	config &= ~(nrf24l01_CONFIG_PRIM_RX);
	
	if((config & nrf24l01_CONFIG_PWR_UP) != 0)
		nrf24l01_power_up_param(false, config);
	else
		nrf24l01_power_down_param(config);
}

//executes the W_REGISTER SPI operation
//unsigned char regnumber indicates the register number assigned by the nrf24l01 specification.
//  For regnumber values, see section titled "register definitions" in nrf24l01.h.
//unsigned char * data should be of size 1 for all register writes except for RX_ADDR_P0, RX_ADDR_P1,
//	and TX_ADDR.  The size of data should be set according to the user-specified size of the address
//  length for the register the address is being sent to.
//unsigned int len is always the size of unsigned char * data.  For example, if data is declared as
//  data[6], len should equal 6.
//returns the value of the STATUS register
unsigned char nrf24l01_write_register(unsigned char regnumber, unsigned char * data, unsigned int len)
{
	return nrf24l01_execute_command(nrf24l01_W_REGISTER | (regnumber & nrf24l01_W_REGISTER_DATA), data, len, false);
}

//executes the R_REGISTER SPI operation
//unsigned char regnumber indicates the register number assigned by the nrf24l01 specification.
//  For regnumber values, see section titled "register definitions" in nrf24l01.h.
//unsigned char * data should be of size 1 for all register writes except for RX_ADDR_P0, RX_ADDR_P1,
//	and TX_ADDR.  The size of data should be set according to the user-specified size of the address
//  length for the register the address is being read from.
//unsigned int len is always the size of unsigned char * data.  For example, if data is declared as 
//  data[6], len = 6.
//returns the value of the STATUS register
unsigned char nrf24l01_read_register(unsigned char regnumber, unsigned char * data, unsigned int len)
{
	return nrf24l01_execute_command(regnumber & nrf24l01_R_REGISTER_DATA, data, len, true);
}

//executes the W_TX_PAYLOAD operation
//unsigned char * data is the actual payload to be sent to the nrf24l01.
//unsigned int len is the length of the payload being sent (this should be sized
//	according to the payload length specified by the receiving nrf24l01).
//if bool transmit is true, the nrf24l01 immediately transmits the data in the payload.
//	if false, the user must use the nrf24l01_transmit() function to send the payload.
//returns the value of the STATUS register
unsigned char nrf24l01_write_tx_payload(unsigned char * data, unsigned int len, bool transmit)
{
	unsigned char status;
	
	status = nrf24l01_execute_command(nrf24l01_W_TX_PAYLOAD, data, len, false);
	
	if(transmit == true)
		nrf24l01_transmit();
	
	return status;
}

//executes the R_RX_PAYLOAD instruction
//unsigned char * data is the actual payload that has been received by the nrf24l01.
//	The user must size data according to the payload width specified to the nrf24l01.
//	This variable is filled by this function, so individual byte values need not be
//	initialized by the user.
//unsigned int len is the length of the payload being clocked out of the nrf24l01 (this
//	should be sized according to the payload length specified to the nrf24l01).
//returns the value of the STATUS register
unsigned char nrf24l01_read_rx_payload(unsigned char * data, unsigned int len)
{
	unsigned char status;
	
	nrf24l01_clear_ce();
	status = nrf24l01_execute_command(nrf24l01_R_RX_PAYLOAD, data, len, true);
	nrf24l01_set_ce();
	
	return status;
}

//executes the FLUSH_TX SPI operation
//this funciton empties the contents of the TX FIFO
//returns the value of the STATUS register
unsigned char nrf24l01_flush_tx()
{
	return nrf24l01_execute_command(nrf24l01_FLUSH_TX, NULL, 0, true);
}

//executes the FLUSH_RX SPI operation
//this funciton empties the contents of the RX FIFO
//returns the value of the STATUS register
unsigned char nrf24l01_flush_rx()
{
	return nrf24l01_execute_command(nrf24l01_FLUSH_RX, NULL, 0, true);
}

//executes the REUSE_TX_PL SPI operation
//this funciton allows the user to constantly send a packet repeatedly when issued.
//returns the value of the STATUS register
unsigned char nrf24l01_reuse_tx_pl()
{
	return nrf24l01_execute_command(nrf24l01_REUSE_TX_PL, NULL, 0, true);
}

//executes the FLUSH_TX SPI operation
//this funciton does nothing
//returns the value of the STATUS register
unsigned char nrf24l01_nop()
{
	return nrf24l01_execute_command(nrf24l01_NOP, NULL, 0, true);
}

//transmits the current tx payload
void nrf24l01_transmit()
{
	nrf24l01_set_ce();
	delay_us(10);
	nrf24l01_clear_ce();
}

//clears the pin on the host microcontroller that is attached to the 24l01's CE pin
void nrf24l01_clear_ce()
{
	nrf24l01_CE_IOREGISTER &= ~nrf24l01_CE_PINMASK;
}

//sets the pin on the host microcontroller that is attached to the 24l01's CE pin
void nrf24l01_set_ce()
{
	nrf24l01_CE_IOREGISTER |= nrf24l01_CE_PINMASK;
}

//returns true if CE is high, false if not
bool nrf24l01_ce_pin_active()
{
	if((nrf24l01_CE_IOREGISTER & nrf24l01_CE_PINMASK) != 0)
		return true;
	else
		return false;
}

//sets the pin on the host microcontroller that is attached to the 24l01's CSN pin
void nrf24l01_clear_csn()
{
	nrf24l01_CSN_IOREGISTER &= ~nrf24l01_CSN_PINMASK;
}

//clears the pin on the host microcontroller that is attached to the 24l01's CSN pin
void nrf24l01_set_csn()
{
	nrf24l01_CSN_IOREGISTER |= nrf24l01_CSN_PINMASK;
}

//returns true if CSN is high, false if not
bool nrf24l01_csn_pin_active()
{
	if((nrf24l01_CSN_IOREGISTER & nrf24l01_CSN_PINMASK) != 0)
		return true;
	else
		return false;	
}

//sets the TX address in the TX_ADDR register
//unsigned char * address is the actual address to be used.  It should be sized
//	according to the tx_addr length specified to the nrf24l01.
//unsigned int len is the length of the address.  Its value should be specified
//	according to the tx_addr length specified to the nrf24l01.
void nrf24l01_set_tx_addr(unsigned char * address, unsigned int len)
{		
	nrf24l01_write_register(nrf24l01_TX_ADDR, address, len);
}

//sets the RX address in the RX_ADDR register that is offset by rxpipenum
//unsigned char * address is the actual address to be used.  It should be sized
//	according to the rx_addr length that is being filled.
//unsigned int len is the length of the address.  Its value should be specified
//	according to the rx_addr length specified to the nrf24l01.
//unsigned char rxpipenum is the pipe number (zero to five) whose address is being
//	specified.  If an invalid address (greater than five) is supplied, the function
//  does nothing.
void nrf24l01_set_rx_addr(unsigned char * address, unsigned int len, unsigned char rxpipenum)
{	
	if(rxpipenum > 5)
		return;
		
	nrf24l01_write_register(nrf24l01_RX_ADDR_P0 + rxpipenum, address, len);
}

//sets the RX payload width on the pipe offset by rxpipenum
//unsigned char payloadwidth is the length of the payload for the pipe referenced in
//  rxpipenum.  It must be less than or equal to 32.  If an invalid payload width is
//  specified, the function does nothing.
//unsigned char rxpipenum is the pipe number (zero to five) whose address is being
//	specified.  If an invalid address (greater than five) is supplied, the function
//  does nothing.
void nrf24l01_set_rx_pw(unsigned char payloadwidth, unsigned char rxpipenum)
{
	if((rxpipenum > 5) || (payloadwidth > 32))
		return;
		
	nrf24l01_write_register(nrf24l01_RX_PW_P0 + rxpipenum, &payloadwidth, 1);
}

//gets the RX payload width on the pipe offset by rxpipenum
//unsigned char rxpipenum is the pipe number (zero to five) whose address is being
//	specified.  If an invalid address (greater than five) is supplied, the function
//  does nothing.
unsigned char nrf24l01_get_rx_pw(unsigned char rxpipenum)
{
	unsigned char data;
	
	if((rxpipenum > 5))
		return;
		
	nrf24l01_read_register(nrf24l01_RX_PW_P0 + rxpipenum, &data, 1);
	
	return data;
}

//returns the value of the CONFIG register
unsigned char nrf24l01_get_config()
{
	unsigned char data;
	
	nrf24l01_read_register(nrf24l01_CONFIG, &data, 1);
	
	return data;
}

//sets the value of the CONFIG register
void nrf24l01_set_config(unsigned char config)
{
	nrf24l01_write_register(nrf24l01_CONFIG, &config, 1);
}

//returns the current RF channel in RF_CH register
unsigned char nrf24l01_get_rf_ch()
{
	unsigned char data;
	
	nrf24l01_read_register(nrf24l01_RF_CH, &data, 1);
	
	return data;
}

//unsigned char channel is the channel to be changed to.
void nrf24l01_set_rf_ch(unsigned char channel)
{
	unsigned char data;
	
	data = channel & ~nrf24l01_RF_CH_RESERVED;
	
	nrf24l01_write_register(nrf24l01_RF_CH, &data, 1);
}

//returns the value of the OBSERVE_TX register
unsigned char nrf24l01_get_observe_tx()
{
	unsigned char data;
	
	nrf24l01_read_register(nrf24l01_OBSERVE_TX, &data, 1);
	
	return data;
}

//returns the current PLOS_CNT value in OBSERVE_TX register
unsigned char nrf24l01_get_plos_cnt()
{
	unsigned char data;
	
	nrf24l01_read_register(nrf24l01_OBSERVE_TX, &data, 1);
	
	return ((data & nrf24l01_OBSERVE_TX_PLOS_CNT) >> 4);
}

//clears the PLOS_CNT field of the OBSERVE_TX register
//this function makes a read of the current value of RF_CH and
//  simply writes it back to the register, clearing PLOS_CNT
void nrf24l01_clear_plos_cnt()
{
	unsigned char data;
	
	nrf24l01_read_register(nrf24l01_RF_CH, &data, 1);
	nrf24l01_write_register(nrf24l01_RF_CH, &data, 1);
}

//clears the PLOS_CNT field of the OBSERVE_TX register
//this function allows the user to set the RF_CH register by using
//  the argument in the function during the PLOS_CNT clearing process
void nrf24l01_clear_plos_cnt_param(unsigned char rf_ch)
{
	nrf24l01_write_register(nrf24l01_RF_CH, &rf_ch, 1);
}

//returns the current ARC_CNT value in OBSERVE_TX register

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产成人在线| 中文字幕av一区二区三区高| 国产一区二区三区四区在线观看 | 国产欧美精品一区| 欧美日韩一区二区三区四区五区 | 日韩 欧美一区二区三区| 亚洲欧美一区二区在线观看| 日韩欧美国产一区二区在线播放 | 亚洲国产精品二十页| 欧美一级淫片007| 91传媒视频在线播放| 国产成人免费在线| 蜜臀精品一区二区三区在线观看| 综合网在线视频| 国产午夜精品美女毛片视频| 3751色影院一区二区三区| 一本一道波多野结衣一区二区| 国产精品一区二区三区乱码| 全国精品久久少妇| 亚洲制服欧美中文字幕中文字幕| 日本一区二区三区高清不卡| 亚洲精品一区二区精华| 69av一区二区三区| 欧美亚洲一区二区在线观看| 99在线精品免费| 国产成人a级片| 国产一区二区三区在线看麻豆| 午夜精品福利视频网站| 一区二区成人在线视频 | 婷婷久久综合九色综合绿巨人| 亚洲欧美日韩一区| 一区二区中文字幕在线| 国产清纯美女被跳蛋高潮一区二区久久w| 91精品国产综合久久精品性色| 在线欧美一区二区| 欧美影院精品一区| 欧洲一区二区av| 欧美最新大片在线看| 日本大香伊一区二区三区| 91伊人久久大香线蕉| 91亚洲精品乱码久久久久久蜜桃| 粉嫩av亚洲一区二区图片| 粉嫩绯色av一区二区在线观看| 国产电影一区在线| 成人免费看视频| bt7086福利一区国产| av中文一区二区三区| 一本色道综合亚洲| 欧美亚洲国产怡红院影院| 欧美性色黄大片| 69精品人人人人| 精品久久久久香蕉网| 久久久噜噜噜久噜久久综合| 国产偷国产偷亚洲高清人白洁| 国产人成亚洲第一网站在线播放| 中文字幕一区二区三区在线观看| 国产精品不卡一区| 一区二区欧美视频| 日韩av电影免费观看高清完整版| 免费的成人av| 国产成人av福利| 99精品视频在线观看免费| 欧美综合一区二区| 欧美zozozo| 日本一区免费视频| 亚洲午夜一二三区视频| 欧美aa在线视频| 成人永久aaa| 欧美色欧美亚洲另类二区| 91精品国产91久久综合桃花| 久久久一区二区三区捆绑**| 1区2区3区欧美| 婷婷开心激情综合| 国产成人综合亚洲网站| 色屁屁一区二区| 欧美一区二区大片| 国产欧美日本一区视频| 亚洲国产精品一区二区久久 | 日本精品一区二区三区四区的功能| 欧美日韩精品专区| 久久免费电影网| 一区二区三区在线观看国产| 免费av成人在线| 99国产精品99久久久久久| 91精品国产综合久久婷婷香蕉 | 日韩电影在线免费看| 国产高清精品在线| 欧美日韩一区高清| 久久精品欧美一区二区三区不卡 | 亚洲黄一区二区三区| 久久成人精品无人区| 91国偷自产一区二区三区观看| 日韩欧美一级精品久久| 亚洲天堂2014| 精品午夜久久福利影院 | 91福利在线看| 久久精品亚洲一区二区三区浴池| 亚洲一区二区视频在线观看| 国产自产2019最新不卡| 欧美色手机在线观看| 国产日韩v精品一区二区| 日日骚欧美日韩| 91在线视频播放| 日韩欧美国产精品一区| 亚洲一区二区精品久久av| 国产不卡一区视频| 日韩欧美的一区二区| 亚洲综合视频在线| 国产成人激情av| 亚洲精品在线一区二区| 天堂va蜜桃一区二区三区| 在线区一区二视频| 亚洲欧美激情插 | 在线精品视频免费播放| 国产精品另类一区| 国产一区二区导航在线播放| 欧美一级专区免费大片| 偷拍日韩校园综合在线| 在线亚洲高清视频| 亚洲素人一区二区| av成人老司机| 国产精品传媒入口麻豆| 成人综合日日夜夜| 久久女同精品一区二区| 精品一区二区在线观看| 91精品国产欧美一区二区成人| 一区二区三区精品视频| 91丨porny丨国产| **欧美大码日韩| 成人黄页在线观看| 国产精品亲子乱子伦xxxx裸| 国产高清不卡一区| 国产欧美日韩综合| 国产suv精品一区二区三区| 国产亚洲精久久久久久| 国产精品资源网站| 国产欧美日韩精品在线| 成人性生交大片免费看在线播放| 国产亚洲va综合人人澡精品 | 国产精品69久久久久水密桃| 精品国精品国产尤物美女| 九色综合狠狠综合久久| 精品国产一区二区三区不卡| 韩国在线一区二区| 久久久久9999亚洲精品| 成人禁用看黄a在线| 国产精品久久久久久久裸模| 99久久免费视频.com| 亚洲精品国产精品乱码不99| 欧美中文字幕亚洲一区二区va在线 | 2020国产精品自拍| 国产成人在线免费观看| 中文欧美字幕免费| 91黄色免费观看| 日韩二区三区在线观看| 精品久久免费看| 波多野结衣在线一区| 亚洲综合在线免费观看| 欧美疯狂性受xxxxx喷水图片| 美女视频网站久久| 久久久精品tv| 色就色 综合激情| 日韩和欧美一区二区三区| 精品国产不卡一区二区三区| 粉嫩av一区二区三区在线播放| 一区二区三区四区中文字幕| 欧美久久久久免费| 国产ts人妖一区二区| 一个色综合网站| 精品久久久久久综合日本欧美| 成人三级伦理片| 亚洲国产aⅴ成人精品无吗| 精品剧情在线观看| 99re热这里只有精品免费视频 | 韩国成人福利片在线播放| 成人欧美一区二区三区在线播放| 欧美日韩一区二区三区不卡| 寂寞少妇一区二区三区| 亚洲视频资源在线| 日韩欧美一卡二卡| 91麻豆免费观看| 久久国产婷婷国产香蕉| 亚洲欧美国产77777| 精品美女被调教视频大全网站| 99精品国产热久久91蜜凸| 爽好久久久欧美精品| 中文字幕中文在线不卡住| 欧美肥妇bbw| 99久久精品国产一区二区三区| 三级欧美在线一区| 亚洲欧洲成人自拍| 日韩一卡二卡三卡四卡| 91老司机福利 在线| 韩国理伦片一区二区三区在线播放| 亚洲欧美色一区| 久久综合丝袜日本网| 欧美日韩一区二区三区四区| av网站免费线看精品| 国内精品伊人久久久久影院对白| 伊人开心综合网|