Commit Graph

77 Commits

Author SHA1 Message Date
Anton Maklakov
68e5d9d585 Remove IRAM_ATTR from any function declarations
IRAM_ATTR expands to a unique section attribute. Applying it to both
declaration and definition results in a section conflict.
2022-03-22 09:58:50 +00:00
Kevin Guilloy
1fce1616c4 i2c: fix typo in SOC_I2C_SUPPORT_SALVE
Merges: https://github.com/espressif/esp-idf/pull/8513
2022-03-07 10:40:57 +08:00
songruojing
1ceb7c8cd6 i2c: Correct hal functions iram placement and remove IRAM_ATTR for i2c_hw_fsm_reset
Closes https://github.com/espressif/esp-idf/issues/8422
2022-02-28 15:44:35 +08:00
laokaiyao
cf353c505a i2c: support esp32h2 2022-02-23 15:19:37 +08:00
laokaiyao
7da023ceae i2c: support esp32c2 2022-02-23 15:19:37 +08:00
John
bcf7608cf8 i2c: Enable I2C Slave mode with input-only pin as SCL.
Merges https://github.com/espressif/esp-idf/pull/8312

If we use I2C in slave mode, we can use input-only pin for SCL line (GPI 34-39).
But there is a problem in i2c_set_pin() which is called by i2c_param_config().
In case of using GPI as SCL the following statements are failed:
	1. gpio_set_level(scl_io_num, I2C_IO_INIT_LEVEL);
Function fails because it cannot set level for input pin. As a result a ESP_LOGE() is called.
	2. gpio_set_direction(scl_io_num, GPIO_MODE_INPUT_OUTPUT_OD);
Function fails because it accepts only GPIO pins. ESP_LOGE() is called, input mode is not enabled for the pin and as a result - no interrupts from the pin.
2022-02-21 17:32:04 +08:00
Omar Chebib
0cfa7ca20f Merge branch 'bugfix/fix_i2c_crash' into 'master'
I2C: Fix I2C Master operation with repeated start condition

Closes IDFGH-6719 and IDFGH-6724

See merge request espressif/esp-idf!17035
2022-02-10 07:05:59 +00:00
Darian Leung
57fd78f5ba freertos: Remove legacy data types
This commit removes the usage of all legacy FreeRTOS data types that
are exposed via configENABLE_BACKWARD_COMPATIBILITY. Legacy types can
still be used by enabling CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY.
2022-02-09 23:05:45 +08:00
Dmitry Koptsov
57716e3d86 I2C: Fix I2C Master operation with repeated start condition
* Closes https://github.com/espressif/esp-idf/pull/8353
2022-02-07 10:58:13 +08:00
Omar Chebib
473974c8f6 UART & I2C: remove custom ISR registration function
Breaking change for v5.0: custom UART ISR and I2C ISR cannot be installed anymore.
2022-01-25 14:46:43 +08:00
Omar Chebib
8d1fa78378 i2c: fix buffer check when SPIRAM used as a heap
* Closes https://github.com/espressif/esp-idf/issues/8173
2021-12-31 14:36:16 +08:00
paul
ef1df8d41a I2C: Fix typo in I2C_TIMING_VAL_ERR_STR macro name
* Closes https://github.com/espressif/esp-idf/pull/8012
2021-12-06 11:43:49 +08:00
morris
16677b0d3c global: make periph enable/disable APIs private
peripheral enable/disable usually should be managed by driver itself,
so make it as espressif private APIs, not recommended for user to use it
in application code.
However, if user want to re-write the driver or ports to other platform,
this is still possible by including the header in this way:
"esp_private/peripheral_ctrl.h"
2021-11-08 10:37:47 +08:00
Chen Yi Qun
fbd25c3837 I2C: add conf_update for esp32c3 i2c 2021-08-11 13:39:07 +08:00
Omar Chebib
2575c0d49f i2c: fix I2C slave clock source selection
In I2C slave mode, clock source can now be changed, according to
the flags specified in `i2c_config_t` structure. Thus, ESP32-S2
can now act as an I2C slave, even with a 400KHz master clock.
2021-07-15 12:28:57 +08:00
SalimTerryLi
f545adbceb
i2c.c, uart.c: replace xxx_CHECK with ESP_RETURN_ON_FALSE 2021-07-09 15:13:34 +08:00
Omar Chebib
e9ffe03544 i2c: the user is now allowed to call i2c_master_write even for sending a single byte 2021-07-06 12:12:16 +08:00
Omar Chebib
7dd499d1f4 i2c: commands can now be re-used without deleting and creating new cmd links
It is now possible to call `i2c_master_cmd_begin()` on the same
`i2c_cmd_handle_t` parameter. Thus, no extra allocation will be performed.
Moreover, as commands contains pointers to data, these can be modified
between two calls to `i2c_master_cmd_begin()`. This becomes very handy
for framebuffers.
2021-06-09 17:03:39 +08:00
Omar Chebib
cfcbca1271 i2c: optimize space allocated for read or write buffers
Only a single command will be allocated now when a read or write is
prepared in the command list. The size of a command's buffer is not
limited to 255 bytes anymore.
2021-06-09 15:21:20 +08:00
Omar Chebib
e1f388f114 i2c: add i2c_cmd_link_create_static() to create commands from a given buffer
Application can now provide a buffer in order to allocate commands link.
Fixed few unclear details in the documentation.
Added wrappers to simplify I2C transfers.

Closes https://github.com/espressif/esp-idf/issues/5108
2021-06-09 15:21:20 +08:00
Michael (XIAO Xufeng)
dd47340d0e Merge branch 'update_copyright_notice_driver_part_4' into 'master'
driver: update copyright notice, part 4

See merge request espressif/esp-idf!13652
2021-05-31 07:37:19 +00:00
Jan Brudný
690974e32f driver: update copyright notice 2021-05-25 17:43:57 +02:00
Melissa LeBlanc-Williams
33e8d1e0b0 dreiver/i2c: delete i2c cmd_mux semaphore more cleanly
Merges https://github.com/espressif/esp-idf/pull/6848
2021-05-07 18:03:38 +08:00
Omar Chebib
cd79f3907d gpio: Disable USB JTAG when setting pins 18 and 19 as GPIOs on ESP32C3
When `DIS_USB_JTAG` eFuse is NOT burned (`False`), it is not possible
to set pins 18 and 19 as GPIOs. This commit solves this by manually
disabling USB JTAG when using pins 18 or 19.
The functions shall use `gpio_hal_iomux_func_sel` instead of
`PIN_FUNC_SELELECT`.
2021-04-08 14:01:18 +08:00
Marius Vikhammer
2aead8ba57 Support ESP32S3 Beta 3 target
Update ROM API. Port changes from bringup branch.
2021-03-18 10:24:22 +08:00
Michael (XIAO Xufeng)
31955fd7ea i2c: modify internal impl to ensure the cmd will not be modified
related to: https://github.com/espressif/esp-idf/issues/5108
2021-01-27 01:31:49 +08:00
Sachin Parekh
6e1f53bce3 i2c: Acquire PM lock after acquiring mutex 2020-12-22 00:50:19 +05:30
Angus Gratton
5228d9f9ce esp32c3: Apply one-liner/small changes for ESP32-C3 2020-12-01 10:58:50 +11:00
Cao Sen Miao
31afe8109f i2c: Fix bug on i2c clk allocator 2020-11-25 14:26:37 +08:00
Cao Sen Miao
6eee601cf6 i2c: Add supports on esp32s3 2020-11-12 11:32:45 +08:00
Michael (XIAO Xufeng)
647dea9395 soc: combine xxx_caps.h into one soc_caps.h
During HAL layer refactoring and new chip bringup, we have several
caps.h for each part, to reduce the conflicts to minimum. But this is
The capabilities headers will be relataive stable once completely
written (maybe after the featues are supported by drivers).

Now ESP32 and ESP32-S2 drivers are relative stable, making it a good
time to combine all these caps.h into one soc_caps.h

This cleanup also move HAL config and pin config into separated files,
to make the responsibilities of these headers more clear. This is
helpful for the stabilities of soc_caps.h because we want to make it
public some day.
2020-10-17 16:10:15 +08:00
Chen Yi Qun
caaf62bdad driver, http_client, web_socket, tcp_transport: remove __FILE__ from log messages
__FILE__ macro in the error messages adds full paths to the production binarys, remove __FILE__ from the ESP_LOGE.

Closes https://github.com/espressif/esp-idf/issues/5637
Merges https://github.com/espressif/esp-idf/pull/5638
2020-08-03 15:21:36 +08:00
Ivan Grokhotkov
16c73edc67 Merge branch 'refactor/add_alias_name_for_ets_common_api' into 'master'
esp_rom: extract common ets apis into esp_rom_sys.h

See merge request espressif/esp-idf!9701
2020-07-28 15:04:55 +08:00
Michael (XIAO Xufeng)
1aabab0160 Merge branch 'bugfix/i2c_const_function_signature' into 'master'
I2C: add const to signature of master_write function

Closes IDFGH-3324

See merge request espressif/esp-idf!9306
2020-07-27 16:31:20 +08:00
morris
2917651478 esp_rom: extract common ets apis into esp_rom_sys.h 2020-07-27 15:27:01 +08:00
morris
a4d0033c03 esp_rom: extract common GPIO apis into esp_rom_gpio.h 2020-07-07 11:40:19 +08:00
Peter Schaefer
f08743e452 Added const for pointer in master_write method, so that a const array can be passed to this fcn.
Signed-off-by: wubowen <wubowen@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/5307

explicitly convert a const ptr to non-const because we actually don't modify it.
2020-07-06 03:37:39 +00:00
Michael (XIAO Xufeng)
661f4c430d Merge branch 'feature/esp32s2_i2c_driver' into 'master'
Feature:  Add esp32-s2 I2C driver.

Closes IDF-1278 and IDF-1026

See merge request espressif/esp-idf!7680
2020-03-26 10:20:40 +08:00
Jakob Hasse
3bcc6b48af I2C: i2c.h/i2c.c applied new code formatting 2020-02-26 15:12:03 +08:00
houwenxiang
4883733472 driver(I2C): support esp32-s2 I2C driver. 2020-02-25 21:56:00 +08:00
Jakob Hasse
d230d44e2d I2C: const correctness, checking SDA/SCL GPIOs
* const correctness in i2c_slave_write_buffer()
* i2c_set_pin() additionally checks whether
  SDA and SCL pins are the same number
2020-02-24 14:30:28 +08:00
houwenxiang
aac935ec81 bugfix(i2c): fix I2C driver breaking change issue.
1. Fixed I2C driver breaking change issue.
    2. Add I2C UT test case.
2019-12-04 15:51:36 +08:00
houwenxiang
28286183d1 feature(I2C): Add i2c hal support. 2019-11-21 20:34:07 +08:00
Angus Gratton
04ae56806c Merge branch 'master' into feature/esp32s2beta_update 2019-08-08 15:26:58 +10:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
chenjianqiang
667113cf94 feat(i2c): update i2c driver for esp32s2beta 2019-07-10 11:41:36 +08:00
Angus Gratton
2331597ed2 Merge branch 'bugfix/ticks_to_wait_for_uart_and_i2c' into 'master'
driver: Fix ticks_to_wait for uart and i2c

Closes IDFGH-964

See merge request idf/esp-idf!5021
2019-06-11 08:41:44 +08:00
Konstantin Kondrashov
22a30e2740 i2c: Fix ticks_to_wait when 0 or time expired
Closes: https://github.com/espressif/esp-idf/issues/3301

Closes: IDFGH-964
2019-06-04 11:50:54 +08:00
Konstantin Kondrashov
399d2d2605 all: Using xxx_periph.h
Using xxx_periph.h in whole IDF instead of xxx_reg.h, xxx_struct.h, xxx_channel.h ... .

Cleaned up header files from unnecessary headers (releated to soc/... headers).
2019-06-03 14:15:08 +08:00
Michael (XIAO Xufeng)
562af8f65e global: move the soc component out of the common list
This MR removes the common dependency from every IDF components to the SOC component.

Currently, in the ``idf_functions.cmake`` script, we include the header path of SOC component by default for all components.
But for better code organization (or maybe also benifits to the compiling speed), we may remove the dependency to SOC components for most components except the driver and kernel related components.

In CMAKE, we have two kinds of header visibilities (set by include path visibility):

(Assume component A --(depends on)--> B, B is the current component)

1. public (``COMPONENT_ADD_INCLUDEDIRS``): means this path is visible to other depending components (A) (visible to A and B)
2. private (``COMPONENT_PRIV_INCLUDEDIRS``): means this path is only visible to source files inside the component (visible to B only)

and we have two kinds of depending ways:

(Assume component A --(depends on)--> B --(depends on)--> C, B is the current component)

1. public (```COMPONENT_REQUIRES```): means B can access to public include path of C. All other components rely on you (A) will also be available for the public headers. (visible to A, B)
2. private (``COMPONENT_PRIV_REQUIRES``): means B can access to public include path of C, but don't propagate this relation to other components (A). (visible to B)

1. remove the common requirement in ``idf_functions.cmake``, this makes the SOC components invisible to all other components by default.
2. if a component (for example, DRIVER) really needs the dependency to SOC, add a private dependency to SOC for it.
3. some other components that don't really depends on the SOC may still meet some errors saying "can't find header soc/...", this is because it's depended component (DRIVER) incorrectly include the header of SOC in its public headers. Moving all this kind of #include into source files, or private headers
4. Fix the include requirements for some file which miss sufficient #include directives. (Previously they include some headers by the long long long header include link)

This is a breaking change. Previous code may depends on the long include chain.
You may need to include the following headers for some files after this commit:

- soc/soc.h
- soc/soc_memory_layout.h
- driver/gpio.h
- esp_sleep.h

The major broken include chain includes:

1. esp_system.h no longer includes esp_sleep.h. The latter includes driver/gpio.h and driver/touch_pad.h.
2. ets_sys.h no longer includes soc/soc.h
3. freertos/portmacro.h no longer includes soc/soc_memory_layout.h

some peripheral headers no longer includes their hw related headers, e.g. rom/gpio.h no longer includes soc/gpio_pins.h and soc/gpio_reg.h

BREAKING CHANGE
2019-04-16 13:21:15 +08:00