亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
久久久美女毛片| 欧美男男青年gay1069videost| 日韩欧美美女一区二区三区| 午夜国产精品一区| 337p亚洲精品色噜噜噜| 琪琪久久久久日韩精品| 精品国产91九色蝌蚪| 久久99国产精品久久99果冻传媒| 欧美嫩在线观看| 26uuu亚洲综合色| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 91精品国产入口| 欧美久久一二三四区| 日韩三级视频在线观看| 视频一区视频二区中文字幕| 欧美色图天堂网| 青青草国产成人av片免费| 精品国产a毛片| www.欧美.com| 丝袜美腿亚洲色图| 久久一区二区三区四区| 99re热这里只有精品免费视频| 亚洲一二三四在线| 精品国产免费久久| 日本精品一区二区三区高清 | 自拍av一区二区三区| 欧美综合欧美视频| 国产精品影视在线| 亚洲国产乱码最新视频| 久久午夜羞羞影院免费观看| 日本精品一区二区三区高清 | 成人av在线一区二区| 亚洲国产精品视频| 国产清纯白嫩初高生在线观看91 | 日本一不卡视频| 亚洲国产成人一区二区三区| 欧美嫩在线观看| 成人久久久精品乱码一区二区三区| 亚洲国产一二三| 国产精品看片你懂得| 欧美xxxx在线观看| 在线一区二区三区四区五区| 国产很黄免费观看久久| 婷婷开心激情综合| 亚洲精品视频免费看| 国产亚洲人成网站| 在线不卡的av| 色婷婷av一区| 成人av资源在线| 国产自产v一区二区三区c| 亚洲第四色夜色| 一区二区三区在线免费播放| 欧美国产日韩在线观看| 精品剧情v国产在线观看在线| 日韩精品中文字幕一区二区三区 | 婷婷久久综合九色综合伊人色| 亚洲欧洲一区二区三区| 久久先锋资源网| 这里只有精品99re| 欧美中文字幕亚洲一区二区va在线 | 欧美va亚洲va在线观看蝴蝶网| 91传媒视频在线播放| 91美女视频网站| 成人一区二区三区| 国产精品综合一区二区| 久久精品国产亚洲一区二区三区| 午夜欧美在线一二页| 亚洲一区二区三区影院| 日韩伦理电影网| 日韩毛片视频在线看| 中文字幕一区日韩精品欧美| 日本一区二区三区dvd视频在线 | 国产偷v国产偷v亚洲高清| 精品国产一区二区国模嫣然| 欧美大片一区二区| 日韩欧美专区在线| 欧美成人精品高清在线播放| 欧美一区在线视频| 日韩欧美国产综合| 久久理论电影网| 国产亚洲1区2区3区| 国产精品狼人久久影院观看方式| 国产精品三级久久久久三级| √…a在线天堂一区| 亚洲精品视频在线看| 亚洲国产欧美在线人成| 丝袜a∨在线一区二区三区不卡| 爽好多水快深点欧美视频| 亚洲成av人影院| 久久国产精品99久久久久久老狼| 久久99热这里只有精品| 国产高清在线精品| 粉嫩绯色av一区二区在线观看| 99久久精品国产一区二区三区| 91在线免费播放| 在线观看国产91| 91精品国产麻豆国产自产在线 | 国产精品亚洲一区二区三区在线| 国产美女主播视频一区| 99久久久精品免费观看国产蜜| 色视频欧美一区二区三区| 欧美精选一区二区| 久久久久久久久99精品| 亚洲人成亚洲人成在线观看图片| 亚洲高清免费一级二级三级| 蜜桃视频一区二区三区在线观看| 国产很黄免费观看久久| 欧美伊人久久久久久午夜久久久久| 欧美精品国产精品| 久久久www成人免费无遮挡大片| 国产一区二区精品在线观看| 99精品久久免费看蜜臀剧情介绍| 欧美在线啊v一区| 久久奇米777| 一区二区三区日韩欧美精品| 捆绑调教一区二区三区| www.欧美色图| 欧美一区二区三区四区在线观看| 国产亚洲成aⅴ人片在线观看| 亚洲国产欧美在线| 国产99久久久久| 56国语精品自产拍在线观看| 国产精品色哟哟网站| 日本欧美一区二区三区乱码| 风间由美一区二区三区在线观看 | 国产一区二区不卡老阿姨| av综合在线播放| 日韩精品一区二区三区在线播放| 中文字幕在线观看不卡| 日本中文字幕一区二区视频 | 一区二区三区波多野结衣在线观看 | 日韩成人dvd| 91丨porny丨中文| 久久婷婷综合激情| 婷婷久久综合九色综合绿巨人 | 亚洲综合图片区| 国产a精品视频| 日韩午夜在线影院| 亚洲高清免费视频| 91女神在线视频| 欧美国产禁国产网站cc| 蜜乳av一区二区三区| 欧美系列在线观看| 自拍偷拍亚洲欧美日韩| 国产不卡一区视频| 欧美大片日本大片免费观看| 亚洲a一区二区| 在线视频综合导航| 亚洲老司机在线| 成人动漫一区二区| 久久女同性恋中文字幕| 免费欧美日韩国产三级电影| 欧美色视频在线观看| 亚洲人吸女人奶水| 久久综合网色—综合色88| 日韩黄色小视频| 欧美亚州韩日在线看免费版国语版| 国产精品第13页| 国产iv一区二区三区| 国产99精品在线观看| 国产精品看片你懂得| 制服.丝袜.亚洲.中文.综合| 精品亚洲成a人| √…a在线天堂一区| 欧美午夜精品久久久久久孕妇| 亚洲制服丝袜av| 精品久久久久一区二区国产| 懂色av一区二区三区蜜臀| 亚洲精品伦理在线| 91麻豆精品国产综合久久久久久| 国产一区二区三区免费在线观看| 国产无人区一区二区三区| heyzo一本久久综合| 国产成人免费在线观看| 久久久久久9999| 国产高清一区日本| 国产精品久久久久久久第一福利| 成人免费福利片| 亚洲欧洲综合另类在线| 欧美丝袜丝交足nylons| 午夜视频在线观看一区二区| 91.麻豆视频| 麻豆精品在线看| 久久精品一区二区三区不卡 | 自拍偷拍亚洲激情| 在线观看av一区二区| 成人午夜电影网站| 亚洲欧美激情小说另类| 欧美日韩一区在线| 日韩成人精品在线| 2020国产精品自拍| 成人激情小说网站| 一区二区三区视频在线观看| 91精品国模一区二区三区| 国产一区在线不卡| 亚洲视频免费在线| 欧美酷刑日本凌虐凌虐| 国产精品一二一区| 亚洲最色的网站| 精品国产免费人成在线观看|