Finished to port the NRF24L01P library in C on the W801 board
This commit is contained in:
parent
ab84498254
commit
58aaf74669
4
Makefile
4
Makefile
@ -6,6 +6,7 @@ GEN_IMAGES= $(TARGET).elf
|
|||||||
GEN_BINS = $(TARGET).bin
|
GEN_BINS = $(TARGET).bin
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
$(TOP_DIR)/app \
|
$(TOP_DIR)/app \
|
||||||
|
$(TOP_DIR)/app/app_lib \
|
||||||
$(TOP_DIR)/app/third_party/nano-shell-master \
|
$(TOP_DIR)/app/third_party/nano-shell-master \
|
||||||
$(TOP_DIR)/app/third_party/driver/NRF24L01P
|
$(TOP_DIR)/app/third_party/driver/NRF24L01P
|
||||||
endif # } PDIR
|
endif # } PDIR
|
||||||
@ -32,8 +33,9 @@ endif
|
|||||||
|
|
||||||
COMPONENTS_$(TARGET) = \
|
COMPONENTS_$(TARGET) = \
|
||||||
$(TOP_DIR)/app/libuser$(LIB_EXT) \
|
$(TOP_DIR)/app/libuser$(LIB_EXT) \
|
||||||
|
$(TOP_DIR)/app/app_lib/libapplib$(LIB_EXT) \
|
||||||
$(TOP_DIR)/app/third_party/nano-shell-master/libnanoshell$(LIB_EXT) \
|
$(TOP_DIR)/app/third_party/nano-shell-master/libnanoshell$(LIB_EXT) \
|
||||||
$(TOP_DIR)/app/third_party/driver/libnrf24l01p$(LIB_EXT)
|
$(TOP_DIR)/app/third_party/driver/NRF24L01P/libnrf24l01p$(LIB_EXT)
|
||||||
|
|
||||||
ifeq ($(USE_LIB), 0)
|
ifeq ($(USE_LIB), 0)
|
||||||
COMPONENTS_$(TARGET) += \
|
COMPONENTS_$(TARGET) += \
|
||||||
|
15
app/app_lib/Makefile
Normal file
15
app/app_lib/Makefile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
TOP_DIR = ../..
|
||||||
|
sinclude $(TOP_DIR)/tools/w800/conf.mk
|
||||||
|
|
||||||
|
ifndef PDIR
|
||||||
|
GEN_LIBS = libapplib$(LIB_EXT)
|
||||||
|
endif
|
||||||
|
|
||||||
|
#DEFINES +=
|
||||||
|
|
||||||
|
sinclude $(TOP_DIR)/tools/w800/rules.mk
|
||||||
|
|
||||||
|
INCLUDES := $(INCLUDES) -I $(PDIR)include
|
||||||
|
|
||||||
|
PDIR := ../$(PDIR)
|
||||||
|
sinclude $(PDIR)Makefile
|
13
app/app_lib/app_utils.c
Normal file
13
app/app_lib/app_utils.c
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include "app_utils.h"
|
||||||
|
|
||||||
|
static uint32_t millis_cnt = 0;
|
||||||
|
|
||||||
|
uint32_t millis(void)
|
||||||
|
{
|
||||||
|
return millis_cnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void millis_run_cb(void *arg)
|
||||||
|
{
|
||||||
|
millis_cnt++;
|
||||||
|
}
|
10
app/app_lib/app_utils.h
Normal file
10
app/app_lib/app_utils.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef APP_UTILS_H
|
||||||
|
#define APP_UTILS_H
|
||||||
|
|
||||||
|
#include "wm_include.h"
|
||||||
|
|
||||||
|
uint32_t millis(void);
|
||||||
|
|
||||||
|
void millis_run_cb(void *arg);
|
||||||
|
|
||||||
|
#endif //APP_UTILS_H
|
90
app/main.c
90
app/main.c
@ -21,6 +21,8 @@
|
|||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "FreeRTOSConfig.h"
|
#include "FreeRTOSConfig.h"
|
||||||
#include "app_common.h"
|
#include "app_common.h"
|
||||||
|
#include "NRF24L01P.h"
|
||||||
|
#include "app_utils.h"
|
||||||
|
|
||||||
tls_os_task_t nano_shell_task_handle = NULL;
|
tls_os_task_t nano_shell_task_handle = NULL;
|
||||||
tls_os_task_t nano_shell_server_task_handle = NULL;
|
tls_os_task_t nano_shell_server_task_handle = NULL;
|
||||||
@ -29,7 +31,6 @@ extern s16 uart1_rx_callback(u16 len, void *user_data);
|
|||||||
|
|
||||||
#define NANO_SHELL_TASK_STK_SIZE 640
|
#define NANO_SHELL_TASK_STK_SIZE 640
|
||||||
#define NANO_SHELL_SERVER_TASK_STK_SIZE 640
|
#define NANO_SHELL_SERVER_TASK_STK_SIZE 640
|
||||||
#define STATUS_LED WM_IO_PB_18
|
|
||||||
#define PWM_STATUS_LED WM_IO_PB_25
|
#define PWM_STATUS_LED WM_IO_PB_25
|
||||||
#define FADE_DOWN 1
|
#define FADE_DOWN 1
|
||||||
#define FADE_UP -1
|
#define FADE_UP -1
|
||||||
@ -40,6 +41,7 @@ extern s16 uart1_rx_callback(u16 len, void *user_data);
|
|||||||
|
|
||||||
|
|
||||||
u8 pulse_rate = PULSE_SLOW;
|
u8 pulse_rate = PULSE_SLOW;
|
||||||
|
bool nrf_irq = false;
|
||||||
|
|
||||||
void tls_netif_status_event_cb(u8 status)
|
void tls_netif_status_event_cb(u8 status)
|
||||||
{
|
{
|
||||||
@ -97,6 +99,32 @@ void tls_gpio_irq_cb(void *arg)
|
|||||||
tls_clr_gpio_irq_status(WM_IO_PB_07);
|
tls_clr_gpio_irq_status(WM_IO_PB_07);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tls_gpio_pb11_irq_cb(void *arg)
|
||||||
|
{
|
||||||
|
tls_clr_gpio_irq_status(WM_IO_PB_11);
|
||||||
|
nrf_irq = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void delay_ms(uint32_t ms)
|
||||||
|
{
|
||||||
|
tls_os_time_delay(pdMS_TO_TICKS(ms));
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t elapsed_ms(void)
|
||||||
|
{
|
||||||
|
return millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CE_HIGH(void)
|
||||||
|
{
|
||||||
|
tls_gpio_write(WM_IO_PB_10, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CE_LOW(void)
|
||||||
|
{
|
||||||
|
tls_gpio_write(WM_IO_PB_10, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void user_main(void *param)
|
void user_main(void *param)
|
||||||
{
|
{
|
||||||
u8 pwm_led_duty_cycle = 255;
|
u8 pwm_led_duty_cycle = 255;
|
||||||
@ -109,6 +137,7 @@ void user_main(void *param)
|
|||||||
wm_uart1_rx_config(WM_IO_PB_07);
|
wm_uart1_rx_config(WM_IO_PB_07);
|
||||||
tls_gpio_irq_enable(WM_IO_PB_07, WM_GPIO_IRQ_TRIG_DOUBLE_EDGE);
|
tls_gpio_irq_enable(WM_IO_PB_07, WM_GPIO_IRQ_TRIG_DOUBLE_EDGE);
|
||||||
tls_gpio_isr_register(WM_IO_PB_07, &(tls_gpio_irq_cb), NULL);
|
tls_gpio_isr_register(WM_IO_PB_07, &(tls_gpio_irq_cb), NULL);
|
||||||
|
|
||||||
//We set a a pin as touch sensor :
|
//We set a a pin as touch sensor :
|
||||||
wm_touch_sensor_config(WM_IO_PA_07);
|
wm_touch_sensor_config(WM_IO_PA_07);
|
||||||
tls_touchsensor_threshold_config(1, 120);
|
tls_touchsensor_threshold_config(1, 120);
|
||||||
@ -116,9 +145,25 @@ void user_main(void *param)
|
|||||||
tls_touchsensor_irq_enable(1);
|
tls_touchsensor_irq_enable(1);
|
||||||
tls_touchsensor_irq_register(&(touchsensor_cb));
|
tls_touchsensor_irq_register(&(touchsensor_cb));
|
||||||
|
|
||||||
|
//We set the CE and IRQ pin for the NRF module
|
||||||
|
tls_gpio_cfg(WM_IO_PB_10, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_FLOATING); //CE pin
|
||||||
|
tls_gpio_cfg(WM_IO_PB_11, WM_GPIO_DIR_INPUT, WM_GPIO_ATTR_FLOATING); //IRQ pins
|
||||||
|
tls_gpio_irq_enable(WM_IO_PB_11, WM_GPIO_IRQ_TRIG_FALLING_EDGE);
|
||||||
|
tls_gpio_isr_register(WM_IO_PB_11, &(tls_gpio_pb11_irq_cb), NULL);
|
||||||
|
|
||||||
|
|
||||||
//We init the uart 1
|
//We init the uart 1
|
||||||
tls_uart_port_init(TLS_UART_1, NULL, 0);
|
tls_uart_port_init(TLS_UART_1, NULL, 0);
|
||||||
|
|
||||||
|
//We create and start a timer to run the millis counter
|
||||||
|
struct tls_timer_cfg tmr_millis = {0};
|
||||||
|
tmr_millis.arg = NULL;
|
||||||
|
tmr_millis.is_repeat = true;
|
||||||
|
tmr_millis.timeout = 1;
|
||||||
|
tmr_millis.unit = TLS_TIMER_UNIT_MS;
|
||||||
|
tmr_millis.callback = &(millis_run_cb);
|
||||||
|
u8 tmr_millis_id = tls_timer_create(&tmr_millis);
|
||||||
|
tls_timer_start(tmr_millis_id);
|
||||||
|
|
||||||
//We create a task for the nano_shell process
|
//We create a task for the nano_shell process
|
||||||
u8 *nano_shell_task_stack = NULL, *nano_shell_server_task_stack = NULL;
|
u8 *nano_shell_task_stack = NULL, *nano_shell_server_task_stack = NULL;
|
||||||
@ -126,6 +171,32 @@ void user_main(void *param)
|
|||||||
tls_uart_rx_callback_register(TLS_UART_0, &(uart0_rx_callback), NULL);
|
tls_uart_rx_callback_register(TLS_UART_0, &(uart0_rx_callback), NULL);
|
||||||
tls_uart_rx_callback_register(TLS_UART_1, &(uart1_rx_callback), NULL);
|
tls_uart_rx_callback_register(TLS_UART_1, &(uart1_rx_callback), NULL);
|
||||||
|
|
||||||
|
//we test the NRF lib here
|
||||||
|
NRF24L01P_t NRF;
|
||||||
|
shell_printf("Checking NRF setup."NEW_LINE);
|
||||||
|
shell_printf("Setting SPI to 1 Mhz : %d."NEW_LINE, tls_spi_setup(SPI_DEFAULT_MODE, SPI_CS_ACTIVE_MODE, 8000000));
|
||||||
|
shell_printf("NRF begin : %d."NEW_LINE, NRF24L01P_begin(&NRF));
|
||||||
|
shell_printf("Is NRF connected : %d."NEW_LINE, NRF24L01P_isChipConnected(&NRF));
|
||||||
|
//NRF24L01P_setChannel(&NRF, 2);
|
||||||
|
NRF24L01P_setPALevel(&NRF, RF24_PA_LOW, false);
|
||||||
|
//NRF24L01P_setDataRate(&NRF, RF24_250KBPS);
|
||||||
|
//NRF24L01P_setRetries(&NRF, 8, 15);
|
||||||
|
NRF24L01P_enableDynamicPayloads(&NRF);
|
||||||
|
NRF24L01P_enableAckPayload(&NRF);
|
||||||
|
NRF24L01P_maskIRQ(&NRF, true, true, false);
|
||||||
|
|
||||||
|
const uint8_t ADDR[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
|
||||||
|
const uint8_t ack_pl[] = "1234567";
|
||||||
|
NRF24L01P_openWritingPipe(&NRF, "1Node");
|
||||||
|
NRF24L01P_openReadingPipe(&NRF, 1, "2Node");
|
||||||
|
NRF24L01P_writeAckPayload(&NRF, 1, ack_pl, sizeof ack_pl);
|
||||||
|
NRF24L01P_startListening(&NRF);
|
||||||
|
shell_printf("NRF PA level : %d"NEW_LINE, NRF24L01P_getPALevel(&NRF));
|
||||||
|
NRF24L01P_printDetails(&NRF);
|
||||||
|
/*uint8_t payload[32] = "Hello W801";
|
||||||
|
shell_printf("Sending payload : %d"NEW_LINE, NRF24L01P_write(&NRF, payload, sizeof payload));
|
||||||
|
NRF24L01P_printDetails(&NRF);*/
|
||||||
|
|
||||||
nano_shell_server_task_stack = tls_mem_alloc(sizeof(u32) * NANO_SHELL_SERVER_TASK_STK_SIZE);
|
nano_shell_server_task_stack = tls_mem_alloc(sizeof(u32) * NANO_SHELL_SERVER_TASK_STK_SIZE);
|
||||||
if(nano_shell_server_task_stack != NULL)
|
if(nano_shell_server_task_stack != NULL)
|
||||||
{
|
{
|
||||||
@ -178,6 +249,23 @@ void user_main(void *param)
|
|||||||
pwm_led_duty_cycle+=fading_direction;
|
pwm_led_duty_cycle+=fading_direction;
|
||||||
|
|
||||||
tls_os_time_delay(pdMS_TO_TICKS(pulse_rate));
|
tls_os_time_delay(pdMS_TO_TICKS(pulse_rate));
|
||||||
|
|
||||||
|
if(nrf_irq)
|
||||||
|
{
|
||||||
|
bool tx_ok, tx_fail, rx_ready;
|
||||||
|
NRF24L01P_whatHappened(&NRF, &tx_ok, &tx_fail, &rx_ready);
|
||||||
|
shell_printf("NRF event : tx_ok %d, tx_fail %d and rx_ready : %d, rx fifo full ? %u, tx fifo full ? %u"NEW_LINE, tx_ok, tx_fail, rx_ready, NRF24L01P_rxFifoFull(&NRF), NRF24L01P_txFifoFull(&NRF));
|
||||||
|
|
||||||
|
if(NRF24L01P_available(&NRF))
|
||||||
|
{
|
||||||
|
char payload[32] = "";
|
||||||
|
NRF24L01P_read(&NRF, payload, 8);
|
||||||
|
shell_printf("Received : #%s#\r\n", payload);
|
||||||
|
NRF24L01P_writeAckPayload(&NRF, 1, ack_pl, sizeof ack_pl);
|
||||||
|
}
|
||||||
|
|
||||||
|
nrf_irq = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,11 +133,17 @@ int _reset(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
|||||||
int _bus(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
int _bus(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
||||||
{
|
{
|
||||||
char spi_recv_buff[32] = "";
|
char spi_recv_buff[32] = "";
|
||||||
|
u32 fclk = SPI_DEFAULT_SPEED;
|
||||||
if(argc > 1)
|
if(argc > 1)
|
||||||
{
|
{
|
||||||
if(strcmp(argv[1], "spi_init") == 0)
|
if(strcmp(argv[1], "spi_init") == 0)
|
||||||
{
|
{
|
||||||
shell_printf("SPI init : %d"NEW_LINE, tls_spi_setup(SPI_DEFAULT_MODE, SPI_CS_ACTIVE_MODE, SPI_DEFAULT_SPEED));
|
if(argc == 3)
|
||||||
|
{
|
||||||
|
fclk = strtoul(argv[2], NULL, 10);
|
||||||
|
if(!fclk) fclk = SPI_DEFAULT_SPEED;
|
||||||
|
}
|
||||||
|
shell_printf("SPI init : %d, clk -> %u Hz"NEW_LINE, tls_spi_setup(SPI_DEFAULT_MODE, SPI_CS_ACTIVE_MODE, fclk), fclk);
|
||||||
}
|
}
|
||||||
else if(strcmp(argv[1], "spi_w") == 0)
|
else if(strcmp(argv[1], "spi_w") == 0)
|
||||||
{
|
{
|
||||||
|
1149
app/third_party/driver/NRF24L01P/NRF24L01P.c
vendored
1149
app/third_party/driver/NRF24L01P/NRF24L01P.c
vendored
File diff suppressed because it is too large
Load Diff
194
app/third_party/driver/NRF24L01P/NRF24L01P.h
vendored
194
app/third_party/driver/NRF24L01P/NRF24L01P.h
vendored
@ -1,4 +1,192 @@
|
|||||||
#include "wm_include.h"
|
#ifndef NRF24L01P_H
|
||||||
#include "app_common.h"
|
#define NRF24L01P_H
|
||||||
|
|
||||||
bool NRF24L01_init(void);
|
#include "NRF24L01P_hw_interface.h"
|
||||||
|
|
||||||
|
/*PUBLIC API*/
|
||||||
|
typedef enum rf24_datarate
|
||||||
|
{
|
||||||
|
/** (0) represents 1 Mbps */
|
||||||
|
RF24_1MBPS = 0,
|
||||||
|
/** (1) represents 2 Mbps */
|
||||||
|
RF24_2MBPS,
|
||||||
|
/** (2) represents 250 kbps */
|
||||||
|
RF24_250KBPS
|
||||||
|
} rf24_datarate_e;
|
||||||
|
|
||||||
|
typedef enum rf24_pa_dbm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* (0) represents:
|
||||||
|
* nRF24L01 | Si24R1 with<br>lnaEnabled = 1 | Si24R1 with<br>lnaEnabled = 0
|
||||||
|
* :-------:|:-----------------------------:|:----------------------------:
|
||||||
|
* -18 dBm | -6 dBm | -12 dBm
|
||||||
|
*/
|
||||||
|
RF24_PA_MIN = 0,
|
||||||
|
/**
|
||||||
|
* (1) represents:
|
||||||
|
* nRF24L01 | Si24R1 with<br>lnaEnabled = 1 | Si24R1 with<br>lnaEnabled = 0
|
||||||
|
* :-------:|:-----------------------------:|:----------------------------:
|
||||||
|
* -12 dBm | 0 dBm | -4 dBm
|
||||||
|
*/
|
||||||
|
RF24_PA_LOW,
|
||||||
|
/**
|
||||||
|
* (2) represents:
|
||||||
|
* nRF24L01 | Si24R1 with<br>lnaEnabled = 1 | Si24R1 with<br>lnaEnabled = 0
|
||||||
|
* :-------:|:-----------------------------:|:----------------------------:
|
||||||
|
* -6 dBm | 3 dBm | 1 dBm
|
||||||
|
*/
|
||||||
|
RF24_PA_HIGH,
|
||||||
|
/**
|
||||||
|
* (3) represents:
|
||||||
|
* nRF24L01 | Si24R1 with<br>lnaEnabled = 1 | Si24R1 with<br>lnaEnabled = 0
|
||||||
|
* :-------:|:-----------------------------:|:----------------------------:
|
||||||
|
* 0 dBm | 7 dBm | 4 dBm
|
||||||
|
*/
|
||||||
|
RF24_PA_MAX,
|
||||||
|
/**
|
||||||
|
* (4) This should not be used and remains for backward compatibility.
|
||||||
|
*/
|
||||||
|
RF24_PA_ERROR
|
||||||
|
} rf24_pa_dbm_e;
|
||||||
|
|
||||||
|
typedef enum rf24_crclength
|
||||||
|
{
|
||||||
|
/** (0) represents no CRC checksum is used */
|
||||||
|
RF24_CRC_DISABLED = 0,
|
||||||
|
/** (1) represents CRC 8 bit checksum is used */
|
||||||
|
RF24_CRC_8,
|
||||||
|
/** (2) represents CRC 16 bit checksum is used */
|
||||||
|
RF24_CRC_16
|
||||||
|
} rf24_crclength_e;
|
||||||
|
|
||||||
|
typedef struct NRF24L01P
|
||||||
|
{
|
||||||
|
uint8_t status;
|
||||||
|
uint8_t payload_size;
|
||||||
|
bool dynamic_payloads_enabled;
|
||||||
|
bool ack_payloads_enabled;
|
||||||
|
uint8_t pipe0_reading_address[5];
|
||||||
|
uint8_t addr_width;
|
||||||
|
uint8_t config_reg;
|
||||||
|
bool is_p_variant;
|
||||||
|
bool failure_detected;
|
||||||
|
} NRF24L01P_t;
|
||||||
|
|
||||||
|
bool NRF24L01P_begin(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_isChipConnected(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_startListening(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_stopListening(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_available(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_read(NRF24L01P_t *NRF, void *payload, uint8_t length);
|
||||||
|
|
||||||
|
bool NRF24L01P_write(NRF24L01P_t *NRF, const void *payload, uint8_t length);
|
||||||
|
|
||||||
|
void NRF24L01P_openWritingPipe(NRF24L01P_t *NRF, const uint8_t* address);
|
||||||
|
|
||||||
|
void NRF24L01P_openReadingPipe(NRF24L01P_t *NRF, uint8_t pipe, const uint8_t *address);
|
||||||
|
|
||||||
|
void NRF24L01P_printDetails(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_availablePipe(NRF24L01P_t *NRF, uint8_t *pipe);
|
||||||
|
|
||||||
|
bool NRF24L01P_rxFifoFull(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_txFifoFull(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_powerDown(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_powerUp(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_writeMulticast(NRF24L01P_t *NRF, const void *payload, uint8_t length, const bool multicast);
|
||||||
|
|
||||||
|
bool NRF24L01P_writeFast(NRF24L01P_t *NRF, const void *payload, uint8_t length);
|
||||||
|
|
||||||
|
bool NRF24L01P_writeFastMulticast(NRF24L01P_t *NRF, const void *payload, uint8_t length, const bool multicast);
|
||||||
|
|
||||||
|
bool NRF24L01P_writeBlocking(NRF24L01P_t *NRF, const void *payload, uint8_t length, uint32_t timeout);
|
||||||
|
|
||||||
|
bool NRF24L01P_txStandBy(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_txStandByTimeout(NRF24L01P_t *NRF, uint32_t timeout, bool start_tx);
|
||||||
|
|
||||||
|
bool NRF24L01P_writeAckPayload(NRF24L01P_t *NRF, uint8_t pipe, const void *payload, uint8_t length);
|
||||||
|
|
||||||
|
void NRF24L01P_whatHappened(NRF24L01P_t *NRF, bool *tx_ok, bool *tx_fail, bool *rx_ready);
|
||||||
|
|
||||||
|
void NRF24L01P_startFastWrite(NRF24L01P_t *NRF, const void *payload, uint8_t length, const bool multicast, bool start_tx);
|
||||||
|
|
||||||
|
bool NRF24L01P_startWrite(NRF24L01P_t *NRF, const void *payload, uint8_t length, const bool multicast);
|
||||||
|
|
||||||
|
void NRF24L01P_reUseTX(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
uint8_t NRF24L01P_flush_tx(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
uint8_t NRF24L01P_flush_rx(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_testCarrier(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_testRPD(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_closeReadingPipe(NRF24L01P_t *NRF, uint8_t pipe);
|
||||||
|
|
||||||
|
void NRF24L01P_setAddressWidth(NRF24L01P_t *NRF, uint8_t a_width);
|
||||||
|
|
||||||
|
void NRF24L01P_setRetries(NRF24L01P_t *NRF, uint8_t delay, uint8_t count);
|
||||||
|
|
||||||
|
void NRF24L01P_setChannel(NRF24L01P_t *NRF, uint8_t channel);
|
||||||
|
|
||||||
|
uint8_t NRF24L01P_getChannel(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_setPayloadSize(NRF24L01P_t *NRF, uint8_t size);
|
||||||
|
|
||||||
|
uint8_t NRF24L01P_getPayloadSize(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
uint8_t NRF24L01P_getDynamicPayloadSize(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_enableAckPayload(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_disableAckPayload(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_enableDynamicPayloads(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_disableDynamicPayloads(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_enableDynamicAck(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_isPVariant(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_setAutoAck(NRF24L01P_t *NRF, bool enable);
|
||||||
|
|
||||||
|
void NRF24L01P_setAutoAckPipe(NRF24L01P_t *NRF, uint8_t pipe, bool enable);
|
||||||
|
|
||||||
|
void NRF24L01P_setPALevel(NRF24L01P_t *NRF, rf24_pa_dbm_e level, bool lna_enable);
|
||||||
|
|
||||||
|
rf24_pa_dbm_e NRF24L01P_getPALevel(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
uint8_t NRF24L01P_getARC(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_setDataRate(NRF24L01P_t *NRF, rf24_datarate_e data_rate);
|
||||||
|
|
||||||
|
rf24_datarate_e NRF24L01P_getDataRate(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_setCRCLength(NRF24L01P_t *NRF, rf24_crclength_e length);
|
||||||
|
|
||||||
|
rf24_crclength_e NRF24L01P_getCRCLength(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_disableCRC(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
void NRF24L01P_maskIRQ(NRF24L01P_t *NRF, bool tx, bool fail, bool rx);
|
||||||
|
|
||||||
|
void NRF24L01P_startConstCarrier(NRF24L01P_t *NRF, rf24_pa_dbm_e level, uint8_t channel);
|
||||||
|
|
||||||
|
void NRF24L01P_stopConstCarrier(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
bool NRF24L01P_isAckPayloadAvailable(NRF24L01P_t *NRF);
|
||||||
|
|
||||||
|
#endif //NRF24L01P_H
|
20
app/third_party/driver/NRF24L01P/NRF24L01P_hw_interface.h
vendored
Normal file
20
app/third_party/driver/NRF24L01P/NRF24L01P_hw_interface.h
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef NRF24L01P_HW_INTERFACE_H
|
||||||
|
#define NRF24L01P_HW_INTERFACE_H
|
||||||
|
|
||||||
|
#include "wm_include.h"
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "app_common.h"
|
||||||
|
#include "nano_shell_interface.h"
|
||||||
|
#include "app_utils.h"
|
||||||
|
|
||||||
|
#define debug_printf(...) shell_printf(__VA_ARGS__); shell_printf(NEW_LINE)
|
||||||
|
|
||||||
|
void delay_ms(uint32_t ms);
|
||||||
|
|
||||||
|
uint32_t elapsed_ms(void);
|
||||||
|
|
||||||
|
void CE_HIGH(void);
|
||||||
|
|
||||||
|
void CE_LOW(void);
|
||||||
|
|
||||||
|
#endif //NRF24L01P_HW_INTERFACE_H
|
@ -87,6 +87,7 @@
|
|||||||
#include "wm_touchsensor.h"
|
#include "wm_touchsensor.h"
|
||||||
#include "wm_irq.h"
|
#include "wm_irq.h"
|
||||||
#include "wm_rtc.h"
|
#include "wm_rtc.h"
|
||||||
|
#include "wm_timer.h"
|
||||||
#include "wm_ble.h"
|
#include "wm_ble.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ INCLUDES += -I $(TOP_DIR)/src/os/rtos/include
|
|||||||
|
|
||||||
INCLUDES += -I $(TOP_DIR)/src/app/factorycmd
|
INCLUDES += -I $(TOP_DIR)/src/app/factorycmd
|
||||||
INCLUDES += -I $(TOP_DIR)/app_include
|
INCLUDES += -I $(TOP_DIR)/app_include
|
||||||
|
INCLUDES += -I $(TOP_DIR)/app/app_lib
|
||||||
INCLUDES += -I $(TOP_DIR)/app/third_party/nano-shell-master
|
INCLUDES += -I $(TOP_DIR)/app/third_party/nano-shell-master
|
||||||
INCLUDES += -I $(TOP_DIR)/app/third_party/driver/NRF24L01P
|
INCLUDES += -I $(TOP_DIR)/app/third_party/driver/NRF24L01P
|
||||||
#nimble host
|
#nimble host
|
||||||
|
Loading…
Reference in New Issue
Block a user