kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'refactor/remove_deprecated_can_stuffs' into 'master'
twai: remove the deprecated "CAN" driver code See merge request espressif/esp-idf!20746pull/9839/head
commit
5135145f5e
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#warning driver/can.h is deprecated, please use driver/twai.h instead
|
||||
|
||||
#include "hal/can_types.h"
|
||||
#include "driver/twai.h"
|
||||
|
||||
/* ---------------------------- Compatibility ------------------------------- */
|
||||
|
||||
#define CAN_GENERAL_CONFIG_DEFAULT(tx_io_num, rx_io_num, op_mode) TWAI_GENERAL_CONFIG_DEFAULT(tx_io_num, rx_io_num, op_mode)
|
||||
|
||||
#define CAN_ALERT_TX_IDLE TWAI_ALERT_TX_IDLE
|
||||
#define CAN_ALERT_TX_SUCCESS TWAI_ALERT_TX_SUCCESS
|
||||
#define CAN_ALERT_BELOW_ERR_WARN TWAI_ALERT_BELOW_ERR_WARN
|
||||
#define CAN_ALERT_ERR_ACTIVE TWAI_ALERT_ERR_ACTIVE
|
||||
#define CAN_ALERT_RECOVERY_IN_PROGRESS TWAI_ALERT_RECOVERY_IN_PROGRESS
|
||||
#define CAN_ALERT_BUS_RECOVERED TWAI_ALERT_BUS_RECOVERED
|
||||
#define CAN_ALERT_ARB_LOST TWAI_ALERT_ARB_LOST
|
||||
#define CAN_ALERT_ABOVE_ERR_WARN TWAI_ALERT_ABOVE_ERR_WARN
|
||||
#define CAN_ALERT_BUS_ERROR TWAI_ALERT_BUS_ERROR
|
||||
#define CAN_ALERT_TX_FAILED TWAI_ALERT_TX_FAILED
|
||||
#define CAN_ALERT_RX_QUEUE_FULL TWAI_ALERT_RX_QUEUE_FULL
|
||||
#define CAN_ALERT_ERR_PASS TWAI_ALERT_ERR_PASS
|
||||
#define CAN_ALERT_BUS_OFF TWAI_ALERT_BUS_OFF
|
||||
#define CAN_ALERT_ALL TWAI_ALERT_ALL
|
||||
#define CAN_ALERT_NONE TWAI_ALERT_NONE
|
||||
#define CAN_ALERT_AND_LOG TWAI_ALERT_AND_LOG
|
||||
|
||||
#define CAN_IO_UNUSED TWAI_IO_UNUSED
|
||||
|
||||
#define CAN_STATE_STOPPED TWAI_STATE_STOPPED
|
||||
#define CAN_STATE_RUNNING TWAI_STATE_RUNNING
|
||||
#define CAN_STATE_BUS_OFF TWAI_STATE_BUS_OFF
|
||||
#define CAN_STATE_RECOVERING TWAI_STATE_RECOVERING
|
||||
|
||||
#if SOC_TWAI_SUPPORTED
|
||||
typedef twai_state_t can_state_t;
|
||||
typedef twai_general_config_t can_general_config_t;
|
||||
typedef twai_status_info_t can_status_info_t;
|
||||
#endif // SOC_TWAI_SUPPORTED
|
||||
|
||||
#define can_driver_install(g_config, t_config, f_config) twai_driver_install(g_config, t_config, f_config)
|
||||
#define can_driver_uninstall() twai_driver_uninstall()
|
||||
#define can_start() twai_start()
|
||||
#define can_stop() twai_stop()
|
||||
#define can_transmit(message, ticks_to_wait) twai_transmit(message, ticks_to_wait)
|
||||
#define can_receive(message, ticks_to_wait) twai_receive(message, ticks_to_wait)
|
||||
#define can_read_alerts(alerts, ticks_to_wait) twai_read_alerts(alerts, ticks_to_wait)
|
||||
#define can_reconfigure_alerts(alerts_enabled, current_alerts) twai_reconfigure_alerts(alerts_enabled, current_alerts)
|
||||
#define can_initiate_recovery() twai_initiate_recovery()
|
||||
#define can_get_status_info(status_info) twai_get_status_info(status_info)
|
||||
#define can_clear_transmit_queue() twai_clear_transmit_queue()
|
||||
#define can_clear_receive_queue() twai_clear_receive_queue()
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,139 +0,0 @@
|
|||
// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/*******************************************************************************
|
||||
* NOTICE
|
||||
* The hal is not public api, don't use in application code.
|
||||
* See readme.md in hal/include/hal/readme.md
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#warning hal/can_hal.h is deprecated, please use hal/twai_hal.h instead
|
||||
|
||||
#include "hal/twai_hal.h"
|
||||
#include "hal/can_types.h"
|
||||
|
||||
/* ------------------------- Defines and Typedefs --------------------------- */
|
||||
|
||||
//Error active interrupt related
|
||||
#define CAN_HAL_EVENT_BUS_OFF TWAI_HAL_EVENT_BUS_OFF
|
||||
#define CAN_HAL_EVENT_BUS_RECOV_CPLT TWAI_HAL_EVENT_BUS_RECOV_CPLT
|
||||
#define CAN_HAL_EVENT_BUS_RECOV_PROGRESS TWAI_HAL_EVENT_BUS_RECOV_PROGRESS
|
||||
#define CAN_HAL_EVENT_ABOVE_EWL TWAI_HAL_EVENT_ABOVE_EWL
|
||||
#define CAN_HAL_EVENT_BELOW_EWL TWAI_HAL_EVENT_BELOW_EWL
|
||||
#define CAN_HAL_EVENT_ERROR_PASSIVE TWAI_HAL_EVENT_ERROR_PASSIVE
|
||||
#define CAN_HAL_EVENT_ERROR_ACTIVE TWAI_HAL_EVENT_ERROR_ACTIVE
|
||||
#define CAN_HAL_EVENT_BUS_ERR TWAI_HAL_EVENT_BUS_ERR
|
||||
#define CAN_HAL_EVENT_ARB_LOST TWAI_HAL_EVENT_ARB_LOST
|
||||
#define CAN_HAL_EVENT_RX_BUFF_FRAME TWAI_HAL_EVENT_RX_BUFF_FRAME
|
||||
#define CAN_HAL_EVENT_TX_BUFF_FREE TWAI_HAL_EVENT_TX_BUFF_FREE
|
||||
|
||||
typedef twai_hal_context_t can_hal_context_t;
|
||||
|
||||
typedef twai_hal_frame_t can_hal_frame_t;
|
||||
|
||||
/* ---------------------------- Init and Config ----------------------------- */
|
||||
|
||||
static inline bool can_hal_init(can_hal_context_t *hal_ctx){
|
||||
return twai_hal_init(hal_ctx);
|
||||
}
|
||||
|
||||
static inline void can_hal_deinit(can_hal_context_t *hal_ctx)
|
||||
{
|
||||
twai_hal_deinit(hal_ctx);
|
||||
}
|
||||
|
||||
static inline void can_hal_configure(can_hal_context_t *hal_ctx, const can_timing_config_t *t_config, const can_filter_config_t *f_config, uint32_t intr_mask, uint32_t clkout_divider)
|
||||
{
|
||||
twai_hal_configure(hal_ctx, t_config, f_config, intr_mask, clkout_divider);
|
||||
}
|
||||
|
||||
/* -------------------------------- Actions --------------------------------- */
|
||||
|
||||
static inline void can_hal_start(can_hal_context_t *hal_ctx, can_mode_t mode)
|
||||
{
|
||||
twai_hal_start(hal_ctx, mode);
|
||||
}
|
||||
|
||||
static inline void can_hal_stop(can_hal_context_t *hal_ctx)
|
||||
{
|
||||
twai_hal_stop(hal_ctx);
|
||||
}
|
||||
|
||||
static inline void can_hal_start_bus_recovery(can_hal_context_t *hal_ctx)
|
||||
{
|
||||
twai_hal_start_bus_recovery(hal_ctx);
|
||||
}
|
||||
|
||||
static inline uint32_t can_hal_get_tec(can_hal_context_t *hal_ctx)
|
||||
{
|
||||
return twai_hal_get_tec(hal_ctx);
|
||||
}
|
||||
|
||||
static inline uint32_t can_hal_get_rec(can_hal_context_t *hal_ctx)
|
||||
{
|
||||
return twai_hal_get_rec(hal_ctx);
|
||||
}
|
||||
|
||||
static inline uint32_t can_hal_get_rx_msg_count(can_hal_context_t *hal_ctx)
|
||||
{
|
||||
return twai_hal_get_rx_msg_count(hal_ctx);
|
||||
}
|
||||
|
||||
static inline bool can_hal_check_last_tx_successful(can_hal_context_t *hal_ctx)
|
||||
{
|
||||
return twai_hal_check_last_tx_successful(hal_ctx);
|
||||
}
|
||||
|
||||
static inline bool can_hal_check_state_flags(can_hal_context_t *hal_ctx, uint32_t check_flags)
|
||||
{
|
||||
return twai_hal_check_state_flags(hal_ctx, check_flags);
|
||||
}
|
||||
|
||||
/* ----------------------------- Event Handling ----------------------------- */
|
||||
|
||||
static inline uint32_t can_hal_decode_interrupt_events(can_hal_context_t *hal_ctx) {
|
||||
return twai_hal_decode_interrupt(hal_ctx);
|
||||
}
|
||||
|
||||
/* ------------------------------- TX and RX -------------------------------- */
|
||||
|
||||
static inline void can_hal_format_frame(const can_message_t *message, can_hal_frame_t *frame)
|
||||
{
|
||||
twai_hal_format_frame(message, frame);
|
||||
}
|
||||
|
||||
static inline void can_hal_parse_frame(can_hal_frame_t *frame, can_message_t *message)
|
||||
{
|
||||
twai_hal_parse_frame(frame, message);
|
||||
}
|
||||
|
||||
static inline void can_hal_set_tx_buffer_and_transmit(can_hal_context_t *hal_ctx, can_hal_frame_t *tx_frame)
|
||||
{
|
||||
twai_hal_set_tx_buffer_and_transmit(hal_ctx, tx_frame);
|
||||
}
|
||||
|
||||
static inline void can_hal_read_rx_buffer_and_clear(can_hal_context_t *hal_ctx, can_hal_frame_t *rx_frame)
|
||||
{
|
||||
twai_hal_read_rx_buffer_and_clear(hal_ctx, rx_frame);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,246 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* NOTICE
|
||||
* The ll is not public api, don't use in application code.
|
||||
* See readme.md in hal/include/hal/readme.md
|
||||
******************************************************************************/
|
||||
|
||||
// The Lowlevel layer for CAN
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#warning hal/can_ll.h is deprecated, please use hal/twai_ll.h instead
|
||||
|
||||
#include "hal/twai_ll.h"
|
||||
#include "hal/can_types.h"
|
||||
#include "soc/can_periph.h"
|
||||
|
||||
/* ------------------------- Defines and Typedefs --------------------------- */
|
||||
|
||||
#define CAN_LL_STATUS_RBS TWAI_LL_STATUS_RBS
|
||||
#define CAN_LL_STATUS_DOS TWAI_LL_STATUS_DOS
|
||||
#define CAN_LL_STATUS_TBS TWAI_LL_STATUS_TBS
|
||||
#define CAN_LL_STATUS_TCS TWAI_LL_STATUS_TCS
|
||||
#define CAN_LL_STATUS_RS TWAI_LL_STATUS_RS
|
||||
#define CAN_LL_STATUS_TS TWAI_LL_STATUS_TS
|
||||
#define CAN_LL_STATUS_ES TWAI_LL_STATUS_ES
|
||||
#define CAN_LL_STATUS_BS TWAI_LL_STATUS_BS
|
||||
|
||||
#define CAN_LL_INTR_RI TWAI_LL_INTR_RI
|
||||
#define CAN_LL_INTR_TI TWAI_LL_INTR_TI
|
||||
#define CAN_LL_INTR_EI TWAI_LL_INTR_EI
|
||||
#define CAN_LL_INTR_EPI TWAI_LL_INTR_EPI
|
||||
#define CAN_LL_INTR_ALI TWAI_LL_INTR_ALI
|
||||
#define CAN_LL_INTR_BEI TWAI_LL_INTR_BEI
|
||||
|
||||
typedef twai_ll_frame_buffer_t can_ll_frame_buffer_t;
|
||||
|
||||
/* ---------------------------- Mode Register ------------------------------- */
|
||||
|
||||
static inline void can_ll_enter_reset_mode(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_enter_reset_mode(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_exit_reset_mode(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_exit_reset_mode(hw);
|
||||
}
|
||||
|
||||
static inline bool can_ll_is_in_reset_mode(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_is_in_reset_mode(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_mode(can_dev_t *hw, can_mode_t mode)
|
||||
{
|
||||
twai_ll_set_mode(hw, mode);
|
||||
}
|
||||
|
||||
/* --------------------------- Command Register ----------------------------- */
|
||||
|
||||
static inline void can_ll_set_cmd_tx(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_set_cmd_tx(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_cmd_tx_single_shot(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_set_cmd_tx_single_shot(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_cmd_abort_tx(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_set_cmd_abort_tx(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_cmd_release_rx_buffer(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_set_cmd_release_rx_buffer(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_cmd_clear_data_overrun(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_set_cmd_clear_data_overrun(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_cmd_self_rx_request(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_set_cmd_self_rx_request(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_cmd_self_rx_single_shot(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_set_cmd_self_rx_single_shot(hw);
|
||||
}
|
||||
|
||||
/* --------------------------- Status Register ------------------------------ */
|
||||
|
||||
static inline uint32_t can_ll_get_status(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_get_status(hw);
|
||||
}
|
||||
|
||||
static inline bool can_ll_is_fifo_overrun(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_is_fifo_overrun(hw);
|
||||
}
|
||||
|
||||
static inline bool can_ll_is_last_tx_successful(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_is_last_tx_successful(hw);
|
||||
}
|
||||
|
||||
/* -------------------------- Interrupt Register ---------------------------- */
|
||||
|
||||
static inline uint32_t can_ll_get_and_clear_intrs(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_get_and_clear_intrs(hw);
|
||||
}
|
||||
|
||||
/* ----------------------- Interrupt Enable Register ------------------------ */
|
||||
|
||||
static inline void can_ll_set_enabled_intrs(can_dev_t *hw, uint32_t intr_mask)
|
||||
{
|
||||
twai_ll_set_enabled_intrs(hw, intr_mask);
|
||||
}
|
||||
|
||||
/* ------------------------ Bus Timing Registers --------------------------- */
|
||||
|
||||
static inline void can_ll_set_bus_timing(can_dev_t *hw, uint32_t brp, uint32_t sjw, uint32_t tseg1, uint32_t tseg2, bool triple_sampling)
|
||||
{
|
||||
twai_ll_set_bus_timing(hw, brp, sjw, tseg1, tseg2, triple_sampling);
|
||||
}
|
||||
|
||||
/* ----------------------------- ALC Register ------------------------------- */
|
||||
|
||||
static inline void can_ll_clear_arb_lost_cap(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_clear_arb_lost_cap(hw);
|
||||
}
|
||||
|
||||
/* ----------------------------- ECC Register ------------------------------- */
|
||||
|
||||
static inline void can_ll_clear_err_code_cap(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_clear_err_code_cap(hw);
|
||||
}
|
||||
|
||||
/* ----------------------------- EWL Register ------------------------------- */
|
||||
|
||||
static inline void can_ll_set_err_warn_lim(can_dev_t *hw, uint32_t ewl)
|
||||
{
|
||||
twai_ll_set_err_warn_lim(hw, ewl);
|
||||
}
|
||||
|
||||
static inline uint32_t can_ll_get_err_warn_lim(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_get_err_warn_lim(hw);
|
||||
}
|
||||
|
||||
/* ------------------------ RX Error Count Register ------------------------- */
|
||||
|
||||
static inline uint32_t can_ll_get_rec(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_get_rec(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_rec(can_dev_t *hw, uint32_t rec)
|
||||
{
|
||||
twai_ll_set_rec(hw, rec);
|
||||
}
|
||||
|
||||
/* ------------------------ TX Error Count Register ------------------------- */
|
||||
|
||||
static inline uint32_t can_ll_get_tec(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_get_tec(hw);
|
||||
}
|
||||
|
||||
static inline void can_ll_set_tec(can_dev_t *hw, uint32_t tec)
|
||||
{
|
||||
twai_ll_set_tec(hw, tec);
|
||||
}
|
||||
|
||||
/* ---------------------- Acceptance Filter Registers ----------------------- */
|
||||
|
||||
static inline void can_ll_set_acc_filter(can_dev_t* hw, uint32_t code, uint32_t mask, bool single_filter)
|
||||
{
|
||||
twai_ll_set_acc_filter(hw, code, mask, single_filter);
|
||||
}
|
||||
|
||||
/* ------------------------- TX/RX Buffer Registers ------------------------- */
|
||||
|
||||
static inline void can_ll_set_tx_buffer(can_dev_t *hw, can_ll_frame_buffer_t *tx_frame)
|
||||
{
|
||||
twai_ll_set_tx_buffer(hw, tx_frame);
|
||||
}
|
||||
|
||||
static inline void can_ll_get_rx_buffer(can_dev_t *hw, can_ll_frame_buffer_t *rx_frame)
|
||||
{
|
||||
twai_ll_get_rx_buffer(hw, rx_frame);
|
||||
}
|
||||
|
||||
static inline void can_ll_format_frame_buffer(uint32_t id, uint8_t dlc, const uint8_t *data,
|
||||
uint32_t flags, can_ll_frame_buffer_t *tx_frame)
|
||||
{
|
||||
twai_ll_format_frame_buffer(id, dlc, data, flags, tx_frame);
|
||||
}
|
||||
|
||||
static inline void can_ll_prase_frame_buffer(can_ll_frame_buffer_t *rx_frame, uint32_t *id, uint8_t *dlc,
|
||||
uint8_t *data, uint32_t *flags)
|
||||
{
|
||||
twai_ll_parse_frame_buffer(rx_frame, id, dlc, data, flags);
|
||||
}
|
||||
|
||||
/* ----------------------- RX Message Count Register ------------------------ */
|
||||
|
||||
static inline uint32_t can_ll_get_rx_msg_count(can_dev_t *hw)
|
||||
{
|
||||
return twai_ll_get_rx_msg_count(hw);
|
||||
}
|
||||
|
||||
/* ------------------------- Clock Divider Register ------------------------- */
|
||||
|
||||
static inline void can_ll_set_clkout(can_dev_t *hw, uint32_t divider)
|
||||
{
|
||||
twai_ll_set_clkout(hw, divider);
|
||||
}
|
||||
|
||||
static inline void can_ll_enable_extended_reg_layout(can_dev_t *hw)
|
||||
{
|
||||
twai_ll_enable_extended_reg_layout(hw);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#warning hal/can_types.h is deprecated, please use hal/twai_types.h instead
|
||||
|
||||
#include "hal/twai_types.h"
|
||||
|
||||
/* ---------------------------- Compatibility ------------------------------- */
|
||||
|
||||
#define CAN_EXTD_ID_MASK TWAI_EXTD_ID_MASK
|
||||
#define CAN_STD_ID_MASK TWAI_STD_ID_MASK
|
||||
#define CAN_FRAME_MAX_DLC TWAI_FRAME_MAX_DLC
|
||||
#define CAN_FRAME_EXTD_ID_LEN_BYTES TWAI_FRAME_EXTD_ID_LEN_BYTES
|
||||
#define CAN_FRAME_STD_ID_LEN_BYTES TWAI_FRAME_STD_ID_LEN_BYTES
|
||||
#define CAN_ERR_PASS_THRESH TWAI_ERR_PASS_THRESH
|
||||
|
||||
#define CAN_MSG_FLAG_NONE TWAI_MSG_FLAG_NONE
|
||||
#define CAN_MSG_FLAG_EXTD TWAI_MSG_FLAG_EXTD
|
||||
#define CAN_MSG_FLAG_RTR TWAI_MSG_FLAG_RTR
|
||||
#define CAN_MSG_FLAG_SS TWAI_MSG_FLAG_SS
|
||||
#define CAN_MSG_FLAG_SELF TWAI_MSG_FLAG_SELF
|
||||
#define CAN_MSG_FLAG_DLC_NON_COMP TWAI_MSG_FLAG_DLC_NON_COMP
|
||||
|
||||
#if (SOC_TWAI_BRP_MAX > 128) || (CONFIG_ESP32_REV_MIN >= 2)
|
||||
#define CAN_TIMING_CONFIG_12_5KBITS() TWAI_TIMING_CONFIG_12_5KBITS()
|
||||
#define CAN_TIMING_CONFIG_16KBITS() TWAI_TIMING_CONFIG_16KBITS()
|
||||
#define CAN_TIMING_CONFIG_20KBITS() TWAI_TIMING_CONFIG_20KBITS()
|
||||
#endif
|
||||
#define CAN_TIMING_CONFIG_25KBITS() TWAI_TIMING_CONFIG_25KBITS()
|
||||
#define CAN_TIMING_CONFIG_50KBITS() TWAI_TIMING_CONFIG_50KBITS()
|
||||
#define CAN_TIMING_CONFIG_100KBITS() TWAI_TIMING_CONFIG_100KBITS()
|
||||
#define CAN_TIMING_CONFIG_125KBITS() TWAI_TIMING_CONFIG_125KBITS()
|
||||
#define CAN_TIMING_CONFIG_250KBITS() TWAI_TIMING_CONFIG_250KBITS()
|
||||
#define CAN_TIMING_CONFIG_500KBITS() TWAI_TIMING_CONFIG_500KBITS()
|
||||
#define CAN_TIMING_CONFIG_800KBITS() TWAI_TIMING_CONFIG_800KBITS()
|
||||
#define CAN_TIMING_CONFIG_1MBITS() TWAI_TIMING_CONFIG_1MBITS()
|
||||
|
||||
#define CAN_FILTER_CONFIG_ACCEPT_ALL() TWAI_FILTER_CONFIG_ACCEPT_ALL()
|
||||
|
||||
typedef twai_mode_t can_mode_t;
|
||||
#define CAN_MODE_NORMAL TWAI_MODE_NORMAL
|
||||
#define CAN_MODE_NO_ACK TWAI_MODE_NO_ACK
|
||||
#define CAN_MODE_LISTEN_ONLY TWAI_MODE_LISTEN_ONLY
|
||||
|
||||
typedef twai_message_t can_message_t;
|
||||
typedef twai_timing_config_t can_timing_config_t;
|
||||
typedef twai_filter_config_t can_filter_config_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#warning soc/can_periph.h is deprecated, please use soc/twai_periph.h instead
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/can_struct.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#warning soc/can_struct.h is deprecated, please use soc/twai_struct.h instead
|
||||
|
||||
#include "soc/twai_struct.h"
|
||||
|
||||
typedef twai_dev_t can_dev_t;
|
||||
extern can_dev_t CAN;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -369,16 +369,6 @@
|
|||
#define SOC_PM_SUPPORT_RTC_FAST_MEM_PD (1)
|
||||
#define SOC_PM_SUPPORT_RTC_SLOW_MEM_PD (1)
|
||||
|
||||
/* ---------------------------- Compatibility ------------------------------- */
|
||||
#define SOC_CAN_SUPPORTED SOC_TWAI_SUPPORTED
|
||||
#define CAN_BRP_MIN SOC_TWAI_BRP_MIN
|
||||
#define CAN_BRP_MAX SOC_TWAI_BRP_MAX
|
||||
#define CAN_SUPPORT_MULTI_ADDRESS_LAYOUT SOC_TWAI_SUPPORT_MULTI_ADDRESS_LAYOUT
|
||||
#if SOC_CAPS_ECO_VER >= 2
|
||||
# define CAN_BRP_DIV_SUPPORTED SOC_TWAI_BRP_DIV_SUPPORTED
|
||||
# define CAN_BRP_DIV_THRESH SOC_TWAI_BRP_DIV_THRESH
|
||||
#endif
|
||||
|
||||
/*-------------------------- SDMMC CAPS -----------------------------------------*/
|
||||
|
||||
/* On ESP32, clock/cmd/data pins use IO MUX.
|
||||
|
|
|
@ -36,7 +36,6 @@ PROVIDE ( EMAC_DMA = 0x3ff69000 );
|
|||
PROVIDE ( EMAC_EXT = 0x3ff69800 );
|
||||
PROVIDE ( EMAC_MAC = 0x3ff6A000 );
|
||||
PROVIDE ( TWAI = 0x3ff6B000 );
|
||||
PROVIDE ( CAN = 0x3ff6B000 );
|
||||
PROVIDE ( MCPWM1 = 0x3ff6C000 );
|
||||
PROVIDE ( I2S1 = 0x3ff6D000 );
|
||||
PROVIDE ( UART2 = 0x3ff6E000 );
|
||||
|
|
|
@ -21,9 +21,9 @@ ADC
|
|||
ADC Oneshot & Continuous Mode drivers
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The ADC oneshot mode driver has been redesigned.
|
||||
The ADC oneshot mode driver has been redesigned.
|
||||
|
||||
- The new driver is in ``esp_adc`` component and the include path is ``esp_adc/adc_oneshot.h``.
|
||||
- The new driver is in ``esp_adc`` component and the include path is ``esp_adc/adc_oneshot.h``.
|
||||
- The legacy driver is still available in the previous include path ``driver/adc.h``.
|
||||
|
||||
The ADC continuous mode driver has been moved from ``driver`` component to ``esp_adc`` component.
|
||||
|
@ -56,8 +56,8 @@ API Changes
|
|||
|
||||
- The ADC power management APIs ``adc_power_acquire`` and ``adc_power_release`` have made private and moved to ``esp_private/adc_share_hw_ctrl.h``.
|
||||
|
||||
- The two APIs were previously made public due to a HW errata workaround.
|
||||
- Now, ADC power management is completely handled internally by drivers.
|
||||
- The two APIs were previously made public due to a HW errata workaround.
|
||||
- Now, ADC power management is completely handled internally by drivers.
|
||||
- Users who still require this API can include ``esp_private/adc_share_hw_ctrl.h`` to continue using these functions.
|
||||
|
||||
- ``driver/adc2_wifi_private.h`` has been moved to ``esp_private/adc_share_hw_ctrl.h``.
|
||||
|
@ -87,11 +87,11 @@ GPIO
|
|||
Sigma-Delta Modulator
|
||||
---------------------
|
||||
|
||||
The Sigma-Delta Modulator driver has been redesigned into :doc:`SDM <../../api-reference/peripherals/sdm>`.
|
||||
|
||||
- The new driver implements a factory pattern, where the SDM channels are managed in a pool internally, thus users don't have to fix a SDM channel to a GPIO manually.
|
||||
- All SDM channels can be allocated dynamically.
|
||||
|
||||
The Sigma-Delta Modulator driver has been redesigned into :doc:`SDM <../../api-reference/peripherals/sdm>`.
|
||||
|
||||
- The new driver implements a factory pattern, where the SDM channels are managed in a pool internally, thus users don't have to fix a SDM channel to a GPIO manually.
|
||||
- All SDM channels can be allocated dynamically.
|
||||
|
||||
Although it's recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/sigmadelta.h``. However, by default, including ``driver/sigmadelta.h`` will trigger the build warning below. The warning can be suppressed by Kconfig option :ref:`CONFIG_SDM_SUPPRESS_DEPRECATE_WARN`.
|
||||
|
||||
.. code-block:: text
|
||||
|
@ -117,7 +117,7 @@ GPIO
|
|||
Timer Group Driver
|
||||
------------------
|
||||
|
||||
Timer Group driver has been redesigned into :doc:`GPTimer <../../api-reference/peripherals/gptimer>`, which aims to unify and simplify the usage of general purpose timer.
|
||||
Timer Group driver has been redesigned into :doc:`GPTimer <../../api-reference/peripherals/gptimer>`, which aims to unify and simplify the usage of general purpose timer.
|
||||
|
||||
Although it's recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/timer.h``. However, by default, including ``driver/timer.h`` will trigger the build warning below. The warning can be suppressed by the Kconfig option :ref:`CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN`.
|
||||
|
||||
|
@ -149,8 +149,8 @@ Breaking Changes in Usage
|
|||
UART
|
||||
----
|
||||
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
:header-rows: 1
|
||||
|
||||
* - Removed/Deprecated items
|
||||
|
@ -162,18 +162,18 @@ UART
|
|||
* - ``uart_isr_free()``
|
||||
- None
|
||||
- UART interrupt handling is implemented by driver itself.
|
||||
* - ``use_ref_tick`` in :cpp:type:`uart_config_t`
|
||||
* - ``use_ref_tick`` in :cpp:type:`uart_config_t`
|
||||
- :cpp:member:`uart_config_t::source_clk`
|
||||
- Select the clock source.
|
||||
- Select the clock source.
|
||||
* - ``uart_enable_pattern_det_intr()``
|
||||
- :cpp:func:`uart_enable_pattern_det_baud_intr`
|
||||
- Enable pattern detection interrupt.
|
||||
- :cpp:func:`uart_enable_pattern_det_baud_intr`
|
||||
- Enable pattern detection interrupt.
|
||||
|
||||
I2C
|
||||
---
|
||||
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
:width: 700 px
|
||||
:header-rows: 1
|
||||
|
||||
* - Removed/Deprecated items
|
||||
|
@ -182,7 +182,7 @@ I2C
|
|||
* - ``i2c_isr_register()``
|
||||
- None
|
||||
- I2C interrupt handling is implemented by driver itself.
|
||||
* - ``i2c_isr_register()``
|
||||
* - ``i2c_isr_register()``
|
||||
- None
|
||||
- I2C interrupt handling is implemented by driver itself.
|
||||
* - ``i2c_opmode_t``
|
||||
|
@ -192,15 +192,15 @@ I2C
|
|||
SPI
|
||||
---
|
||||
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
:header-rows: 1
|
||||
|
||||
* - Removed/Deprecated items
|
||||
- Replacement
|
||||
- Remarks
|
||||
* - ``spi_cal_clock()``
|
||||
- :cpp:func:`spi_get_actual_clock`
|
||||
- :cpp:func:`spi_get_actual_clock`
|
||||
- Get SPI real working frequency.
|
||||
|
||||
- The internal header file ``spi_common_internal.h`` has been moved to ``esp_private/spi_common_internal.h``.
|
||||
|
@ -210,22 +210,22 @@ SPI
|
|||
SDMMC
|
||||
-----
|
||||
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
:header-rows: 1
|
||||
|
||||
* - Removed/Deprecated items
|
||||
- Replacement
|
||||
- Remarks
|
||||
* - ``sdmmc_host_pullup_en()``
|
||||
- set ``SDMMC_SLOT_FLAG_INTERNAL_PULLUP`` flag in :cpp:member:`sdmmc_slot_config_t::flags`
|
||||
- set ``SDMMC_SLOT_FLAG_INTERNAL_PULLUP`` flag in :cpp:member:`sdmmc_slot_config_t::flags`
|
||||
- Enable internal pull up.
|
||||
|
||||
LEDC
|
||||
-----
|
||||
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
.. list-table::
|
||||
:width: 700 px
|
||||
:header-rows: 1
|
||||
|
||||
* - Removed/Deprecated items
|
||||
|
@ -233,15 +233,15 @@ LEDC
|
|||
- Remarks
|
||||
* - ``bit_num`` in :cpp:type:`ledc_timer_config_t`
|
||||
- :cpp:member:`ledc_timer_config_t::duty_resolution`
|
||||
- Set resolution of the duty cycle.
|
||||
- Set resolution of the duty cycle.
|
||||
|
||||
.. only:: SOC_PCNT_SUPPORTED
|
||||
|
||||
Pulse Counter Driver
|
||||
--------------------
|
||||
|
||||
Pulse counter driver has been redesigned (see :doc:`PCNT <../../api-reference/peripherals/pcnt>`), which aims to unify and simplify the usage of PCNT peripheral.
|
||||
|
||||
Pulse counter driver has been redesigned (see :doc:`PCNT <../../api-reference/peripherals/pcnt>`), which aims to unify and simplify the usage of PCNT peripheral.
|
||||
|
||||
Although it's recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/pcnt.h``. However, including ``driver/pcnt.h`` will trigger the build warning below by default. The warning can be suppressed by the Kconfig option :ref:`CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN`.
|
||||
|
||||
.. code-block:: text
|
||||
|
@ -261,7 +261,7 @@ LEDC
|
|||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Previously, the PCNT unit configuration and channel configuration were combined into a single function: ``pcnt_unit_config``. They are now split into the two factory APIs: :cpp:func:`pcnt_new_unit` and :cpp:func:`pcnt_new_channel` respectively.
|
||||
|
||||
|
||||
- Only the count range is necessary for initializing a PCNT unit. GPIO number assignment has been moved to :cpp:func:`pcnt_new_channel`.
|
||||
- High/Low control mode and positive/negative edge count mode are set by stand-alone functions: :cpp:func:`pcnt_channel_set_edge_action` and :cpp:func:`pcnt_channel_set_level_action`.
|
||||
|
||||
|
@ -301,8 +301,8 @@ LEDC
|
|||
RMT Driver
|
||||
----------
|
||||
|
||||
RMT driver has been redesigned (see :doc:`RMT transceiver <../../api-reference/peripherals/rmt>`), which aims to unify and extend the usage of RMT peripheral.
|
||||
|
||||
RMT driver has been redesigned (see :doc:`RMT transceiver <../../api-reference/peripherals/rmt>`), which aims to unify and extend the usage of RMT peripheral.
|
||||
|
||||
Although it's recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/rmt.h``. However, including ``driver/rmt.h`` will trigger the build warning below by default. The warning can be suppressed by the Kconfig option :ref:`CONFIG_RMT_SUPPRESS_DEPRECATE_WARN`.
|
||||
|
||||
.. code-block:: text
|
||||
|
@ -376,10 +376,10 @@ LCD
|
|||
MCPWM
|
||||
-----
|
||||
|
||||
MCPWM driver was redesigned (see :doc:`MCPWM <../../api-reference/peripherals/mcpwm>`), meanwhile, the legacy driver is deprecated.
|
||||
|
||||
The new driver's aim is to make each MCPWM submodule independent to each other, and give the freedom of resource connection back to users.
|
||||
|
||||
MCPWM driver was redesigned (see :doc:`MCPWM <../../api-reference/peripherals/mcpwm>`), meanwhile, the legacy driver is deprecated.
|
||||
|
||||
The new driver's aim is to make each MCPWM submodule independent to each other, and give the freedom of resource connection back to users.
|
||||
|
||||
Although it's recommended to use the new driver APIs, the legacy driver is still available in the previous include path ``driver/mcpwm.h``. However, using legacy driver will rigger the build warning below by default. This warning can be suppressed by the Kconfig option :ref:`CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN`.
|
||||
|
||||
.. code-block:: text
|
||||
|
@ -454,10 +454,10 @@ LCD
|
|||
I2S driver
|
||||
----------
|
||||
|
||||
The I2S driver has been redesigned (see :doc:`I2S Driver <../../api-reference/peripherals/i2s>`), which aims to rectify the shortcomings of the driver that were exposed when supporting all the new features of ESP32-C3 & ESP32-S3. The new driver's APIs are available by including corresponding I2S mode's header files :component_file:`driver/include/driver/i2s_std.h`, :component_file:`driver/include/driver/i2s_pdm.h`, or :component_file:`driver/include/driver/i2s_tdm.h`.
|
||||
|
||||
Meanwhile, the old driver's APIs in :component_file:`driver/deprecated/driver/i2s.h` are still supported for backward compatibility. But there will be warnings if users keep using the old APIs in their projects, these warnings can be suppressed by the Kconfig option :ref:`CONFIG_I2S_SUPPRESS_DEPRECATE_WARN`.
|
||||
|
||||
The I2S driver has been redesigned (see :doc:`I2S Driver <../../api-reference/peripherals/i2s>`), which aims to rectify the shortcomings of the driver that were exposed when supporting all the new features of ESP32-C3 & ESP32-S3. The new driver's APIs are available by including corresponding I2S mode's header files :component_file:`driver/include/driver/i2s_std.h`, :component_file:`driver/include/driver/i2s_pdm.h`, or :component_file:`driver/include/driver/i2s_tdm.h`.
|
||||
|
||||
Meanwhile, the old driver's APIs in :component_file:`driver/deprecated/driver/i2s.h` are still supported for backward compatibility. But there will be warnings if users keep using the old APIs in their projects, these warnings can be suppressed by the Kconfig option :ref:`CONFIG_I2S_SUPPRESS_DEPRECATE_WARN`.
|
||||
|
||||
Here is the general overview of the current I2S files:
|
||||
|
||||
.. figure:: ../../../_static/diagrams/i2s/i2s_file_structure.png
|
||||
|
@ -499,7 +499,7 @@ LCD
|
|||
- Calling :cpp:func:`i2s_channel_reconfig_std_slot`, :cpp:func:`i2s_channel_reconfig_pdm_rx_slot`, :cpp:func:`i2s_channel_reconfig_pdm_tx_slot`, or :cpp:func:`i2s_channel_reconfig_tdm_slot` can change the slot configurations after initialization.
|
||||
- Calling :cpp:func:`i2s_channel_reconfig_std_clock`, :cpp:func:`i2s_channel_reconfig_pdm_rx_clock`, :cpp:func:`i2s_channel_reconfig_pdm_tx_clock`, or :cpp:func:`i2s_channel_reconfig_tdm_clock` can change the clock configurations after initialization.
|
||||
- Calling :cpp:func:`i2s_channel_reconfig_std_gpio`, :cpp:func:`i2s_channel_reconfig_pdm_rx_gpio`, :cpp:func:`i2s_channel_reconfig_pdm_tx_gpio`, or :cpp:func:`i2s_channel_reconfig_tdm_gpio` can change the GPIO configurations after initialization.
|
||||
|
||||
|
||||
Misc
|
||||
""""
|
||||
|
||||
|
@ -520,6 +520,13 @@ LCD
|
|||
7. Call :cpp:func:`i2s_channel_disable` to stop the hardware of I2S channel.
|
||||
8. Call :cpp:func:`i2s_del_channel` to delete and release the resources of the channel if it is not needed any more, but the channel must be disabled before deleting it.
|
||||
|
||||
.. only:: SOC_TWAI_SUPPORTED
|
||||
|
||||
TWAI Driver
|
||||
-----------
|
||||
|
||||
The deprecated ``CAN`` peripheral driver is removed. Please use ``TWAI`` driver instead (i.e. include ``driver/twai.h`` in your application).
|
||||
|
||||
Register Access Macros
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -691,8 +691,6 @@ components/hal/aes_hal.c
|
|||
components/hal/dac_hal.c
|
||||
components/hal/ds_hal.c
|
||||
components/hal/esp32/include/hal/aes_ll.h
|
||||
components/hal/esp32/include/hal/can_hal.h
|
||||
components/hal/esp32/include/hal/can_types.h
|
||||
components/hal/esp32/include/hal/mpu_ll.h
|
||||
components/hal/esp32/include/hal/rwdt_ll.h
|
||||
components/hal/esp32/include/hal/spi_flash_encrypted_ll.h
|
||||
|
@ -933,8 +931,6 @@ components/soc/esp32/include/soc/apb_ctrl_reg.h
|
|||
components/soc/esp32/include/soc/apb_ctrl_struct.h
|
||||
components/soc/esp32/include/soc/bb_reg.h
|
||||
components/soc/esp32/include/soc/boot_mode.h
|
||||
components/soc/esp32/include/soc/can_periph.h
|
||||
components/soc/esp32/include/soc/can_struct.h
|
||||
components/soc/esp32/include/soc/dac_channel.h
|
||||
components/soc/esp32/include/soc/emac_dma_struct.h
|
||||
components/soc/esp32/include/soc/emac_ext_struct.h
|
||||
|
|
|
@ -108,6 +108,9 @@
|
|||
re_variables: ['esp_panic.h']
|
||||
hint_variables: ['esp_panic.h', 'use functionalities provided in esp_debug_helpers.h']
|
||||
|
||||
- re_variables: ['driver/can.h']
|
||||
hint_variables: ['driver/can.h', 'driver/twai.h']
|
||||
|
||||
-
|
||||
re: "error: implicit declaration of function 'esp_int_wdt_\\w+'"
|
||||
hint: 'The Interrupt Watchdog API has been made private, it shall not be used anymore. You can still force its inclusion with #include "esp_private/esp_int_wdt.h" (not recommended)'
|
||||
|
|
Ładowanie…
Reference in New Issue