4
This commit is contained in:
parent
bc848c297d
commit
3dc289d795
22
zh_rf24.c
22
zh_rf24.c
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
static void s_zh_rf24_processing(void *pvParameter);
|
static void s_zh_rf24_processing(void *pvParameter);
|
||||||
static void s_zh_rf24_irq_isr_handler(void *arg);
|
static void s_zh_rf24_irq_isr_handler(void *arg);
|
||||||
static void s_zh_rf24_irq_processing_task(void *pvParameter);
|
static void s_zh_rf24_irq_processing(void *pvParameter);
|
||||||
|
static void s_zh_rf24_read_register(const uint8_t *address, uint8_t *value, const uint8_t length);
|
||||||
|
|
||||||
static const char *TAG = "zh_rf24";
|
static const char *TAG = "zh_rf24";
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ esp_err_t zh_rf24_init(zh_rf24_init_config_t *config)
|
|||||||
ESP_LOGE(TAG, "RF24 initialization fail. Internal error.");
|
ESP_LOGE(TAG, "RF24 initialization fail. Internal error.");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
if (xTaskCreatePinnedToCore(&s_zh_rf24_irq_processing_task, "NULL", s_zh_rf24_init_config.stack_size, NULL, s_zh_rf24_init_config.task_priority, NULL, tskNO_AFFINITY) != pdPASS)
|
if (xTaskCreatePinnedToCore(&s_zh_rf24_irq_processing, "NULL", s_zh_rf24_init_config.stack_size, NULL, s_zh_rf24_init_config.task_priority, NULL, tskNO_AFFINITY) != pdPASS)
|
||||||
{
|
{
|
||||||
ESP_LOGE(TAG, "RF24 initialization fail. Internal error.");
|
ESP_LOGE(TAG, "RF24 initialization fail. Internal error.");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
@ -151,7 +152,7 @@ static void s_zh_rf24_irq_isr_handler(void *arg)
|
|||||||
xSemaphoreGiveFromISR(s_zh_rf24_irq_semaphore, NULL);
|
xSemaphoreGiveFromISR(s_zh_rf24_irq_semaphore, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void s_zh_rf24_irq_processing_task(void *pvParameter)
|
static void s_zh_rf24_irq_processing(void *pvParameter)
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -169,3 +170,18 @@ static void s_zh_rf24_irq_processing_task(void *pvParameter)
|
|||||||
}
|
}
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void s_zh_rf24_read_register(const uint8_t *address, uint8_t *value, const uint8_t length)
|
||||||
|
{
|
||||||
|
gpio_set_level(s_zh_rf24_init_config.csn_pin, 0);
|
||||||
|
spi_transaction_t spi_transaction = {0};
|
||||||
|
// spi_transaction.length = DataLength * 8;
|
||||||
|
// spi_transaction.tx_buffer = Dataout;
|
||||||
|
// spi_transaction.rx_buffer = Datain;
|
||||||
|
spi_device_transmit(s_zh_rf24_spi_handle, &spi_transaction);
|
||||||
|
|
||||||
|
// spi_transfer(dev, R_REGISTER | (REGISTER_MASK & reg));
|
||||||
|
// spi_read_byte(dev, value, value, len);
|
||||||
|
|
||||||
|
gpio_set_level(s_zh_rf24_init_config.csn_pin, 1);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user