Skip to content

Commit

Permalink
Merge pull request #268 from suda-morris/iram/rmt_rx_callback_iram
Browse files Browse the repository at this point in the history
change(onewire): put callback function in iram
  • Loading branch information
suda-morris authored Nov 1, 2023
2 parents 0463f1c + 53b04da commit 9e9a935
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions onewire_bus/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 1-Wire Bus Driver
# Dallas 1-Wire Bus Driver

[![Component Registry](https://components.espressif.com/components/espressif/onewire_bus/badge.svg)](https://components.espressif.com/components/espressif/onewire_bus)

This directory contains an implementation for 1-Wire bus by different peripherals. Currently only RMT is supported as the backend.
This directory contains an implementation for Dallas 1-Wire bus by different peripherals. Currently only RMT is supported as the backend.
2 changes: 1 addition & 1 deletion onewire_bus/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "1.0.0"
version: "1.0.1"
description: Driver for Dalas 1-Wire bus
url: https://github.com/espressif/idf-extra-components/tree/master/onewire_bus
issues: "https://github.com/espressif/idf-extra-components/issues"
Expand Down
12 changes: 7 additions & 5 deletions onewire_bus/src/onewire_bus_impl_rmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "freertos/queue.h"
#include "freertos/semphr.h"
#include "esp_check.h"
#include "esp_attr.h"
#include "driver/rmt_tx.h"
#include "driver/rmt_rx.h"
#include "onewire_bus_impl_rmt.h"
Expand Down Expand Up @@ -124,21 +125,21 @@ typedef struct {
SemaphoreHandle_t bus_mutex;
} onewire_bus_rmt_obj_t;

const static rmt_symbol_word_t onewire_reset_pulse_symbol = {
static rmt_symbol_word_t onewire_reset_pulse_symbol = {
.level0 = 0,
.duration0 = ONEWIRE_RESET_PULSE_DURATION,
.level1 = 1,
.duration1 = ONEWIRE_RESET_WAIT_DURATION
};

const static rmt_symbol_word_t onewire_bit0_symbol = {
static rmt_symbol_word_t onewire_bit0_symbol = {
.level0 = 0,
.duration0 = ONEWIRE_SLOT_START_DURATION + ONEWIRE_SLOT_BIT_DURATION,
.level1 = 1,
.duration1 = ONEWIRE_SLOT_RECOVERY_DURATION
};

const static rmt_symbol_word_t onewire_bit1_symbol = {
static rmt_symbol_word_t onewire_bit1_symbol = {
.level0 = 0,
.duration0 = ONEWIRE_SLOT_START_DURATION,
.level1 = 1,
Expand All @@ -163,7 +164,8 @@ static esp_err_t onewire_bus_rmt_reset(onewire_bus_handle_t bus);
static esp_err_t onewire_bus_rmt_del(onewire_bus_handle_t bus);
static esp_err_t onewire_bus_rmt_destroy(onewire_bus_rmt_obj_t *bus_rmt);

static bool onewire_rmt_rx_done_callback(rmt_channel_handle_t channel, const rmt_rx_done_event_data_t *edata, void *user_data)
IRAM_ATTR
bool onewire_rmt_rx_done_callback(rmt_channel_handle_t channel, const rmt_rx_done_event_data_t *edata, void *user_data)
{
BaseType_t task_woken = pdFALSE;
onewire_bus_rmt_obj_t *bus_rmt = (onewire_bus_rmt_obj_t *)user_data;
Expand Down Expand Up @@ -312,7 +314,7 @@ esp_err_t onewire_new_bus_rmt(const onewire_bus_config_t *bus_config, const onew
ESP_GOTO_ON_ERROR(rmt_enable(bus_rmt->tx_channel), err, TAG, "enable rmt tx channel failed");

// release the bus by sending a special RMT symbol
static const rmt_symbol_word_t release_symbol = {
static rmt_symbol_word_t release_symbol = {
.level0 = 1,
.duration0 = 1,
.level1 = 1,
Expand Down

0 comments on commit 9e9a935

Please sign in to comment.