mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/multiple_github_prs' into 'master'
Fixes from github PRs See merge request idf/esp-idf!5040
This commit is contained in:
commit
fa36433199
@ -384,7 +384,7 @@ int i2c_slave_write_buffer(i2c_port_t i2c_num, uint8_t* data, int size, TickType
|
||||
* Only call this function in I2C slave mode
|
||||
*
|
||||
* @param i2c_num I2C port number
|
||||
* @param data data pointer to write into internal buffer
|
||||
* @param data data pointer to accept data from internal buffer
|
||||
* @param max_size Maximum data size to read
|
||||
* @param ticks_to_wait Maximum waiting ticks
|
||||
*
|
||||
|
@ -133,11 +133,11 @@ struct spi_transaction_t {
|
||||
void *user; ///< User-defined variable. Can be used to store eg transaction ID.
|
||||
union {
|
||||
const void *tx_buffer; ///< Pointer to transmit buffer, or NULL for no MOSI phase
|
||||
uint8_t tx_data[4]; ///< If SPI_USE_TXDATA is set, data set here is sent directly from this variable.
|
||||
uint8_t tx_data[4]; ///< If SPI_TRANS_USE_TXDATA is set, data set here is sent directly from this variable.
|
||||
};
|
||||
union {
|
||||
void *rx_buffer; ///< Pointer to receive buffer, or NULL for no MISO phase. Written by 4 bytes-unit if DMA is used.
|
||||
uint8_t rx_data[4]; ///< If SPI_USE_RXDATA is set, data is received directly to this variable
|
||||
uint8_t rx_data[4]; ///< If SPI_TRANS_USE_RXDATA is set, data is received directly to this variable
|
||||
};
|
||||
} ; //the rx data should start from a 32-bit aligned address to get around dma issue.
|
||||
|
||||
|
@ -330,13 +330,20 @@ menu "mbedTLS"
|
||||
help
|
||||
Disabling this option will save some code size if it is not needed.
|
||||
|
||||
config MBEDTLS_SSL_SESSION_TICKETS
|
||||
bool "TLS: Support RFC 5077 SSL session tickets"
|
||||
config MBEDTLS_CLIENT_SSL_SESSION_TICKETS
|
||||
bool "TLS: Client Support for RFC 5077 SSL session tickets"
|
||||
default y
|
||||
depends on MBEDTLS_TLS_ENABLED
|
||||
help
|
||||
Support RFC 5077 session tickets. See mbedTLS documentation for more details.
|
||||
Client support for RFC 5077 session tickets. See mbedTLS documentation for more details.
|
||||
Disabling this option will save some code size.
|
||||
|
||||
config MBEDTLS_SERVER_SSL_SESSION_TICKETS
|
||||
bool "TLS: Server Support for RFC 5077 SSL session tickets"
|
||||
default y
|
||||
depends on MBEDTLS_TLS_ENABLED
|
||||
help
|
||||
Server support for RFC 5077 session tickets. See mbedTLS documentation for more details.
|
||||
Disabling this option will save some code size.
|
||||
|
||||
menu "Symmetric Ciphers"
|
||||
|
@ -1308,7 +1308,7 @@
|
||||
*
|
||||
* Comment this macro to disable support for SSL session tickets
|
||||
*/
|
||||
#ifdef CONFIG_MBEDTLS_SSL_SESSION_TICKETS
|
||||
#ifdef CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS
|
||||
#define MBEDTLS_SSL_SESSION_TICKETS
|
||||
#endif
|
||||
|
||||
@ -2340,7 +2340,9 @@
|
||||
*
|
||||
* Requires: MBEDTLS_CIPHER_C
|
||||
*/
|
||||
#ifdef CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS
|
||||
#define MBEDTLS_SSL_TICKET_C
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def MBEDTLS_SSL_CLI_C
|
||||
|
@ -384,7 +384,7 @@ Command usage examples:
|
||||
|
||||
.. highlight:: none
|
||||
|
||||
1. Collect SystemView tracing data to files "pro-cpu.SVDat" and "pro-cpu.SVDat". The files will be saved in "openocd-esp32" directory.
|
||||
1. Collect SystemView tracing data to files "pro-cpu.SVDat" and "app-cpu.SVDat". The files will be saved in "openocd-esp32" directory.
|
||||
|
||||
::
|
||||
|
||||
|
@ -291,7 +291,7 @@ resumed. Scheduler suspension in vanilla FreeRTOS is a common protection method
|
||||
against simultaneous access of data shared between tasks, whilst still allowing
|
||||
ISRs to be serviced.
|
||||
|
||||
In ESP-IDF FreeRTOS, :cpp:func:`xTaskResumeAll` will only prevent calls of
|
||||
In ESP-IDF FreeRTOS, :cpp:func:`xTaskSuspendAll` will only prevent calls of
|
||||
``vTaskSwitchContext()`` from switching contexts on the core that called for the
|
||||
suspension. Hence if **PRO_CPU** calls :cpp:func:`vTaskSuspendAll`, **APP_CPU** will
|
||||
still be able to switch contexts. If data is shared between tasks that are
|
||||
|
@ -31,7 +31,7 @@ Configure Driver
|
||||
|
||||
The first step to establishing I2C communication is to configure the driver. This is done by setting several parameters contained in :cpp:type:`i2c_config_t` structure:
|
||||
|
||||
* I2C **operation mode** - select either slave or master from :cpp:type:`i2c_opmode_t`
|
||||
* I2C **mode** - select either slave or master from :cpp:type:`i2c_mode_t`
|
||||
* Settings of the **communication pins**:
|
||||
|
||||
* GPIO pin numbers assigned to the SDA and SCL signals
|
||||
@ -56,7 +56,7 @@ Install Driver
|
||||
Having the configuration initialized, the next step is to install the I2C driver by calling :cpp:func:`i2c_driver_install`. This function call requires the following parameters:
|
||||
|
||||
* The port number, one of the two ports available, selected from :cpp:type:`i2c_port_t`
|
||||
* The operation mode, slave or master selected from :cpp:type:`i2c_opmode_t`
|
||||
* The I2C mode, slave or master, selected from :cpp:type:`i2c_mode_t`
|
||||
* Sizes of buffers that will be allocated for sending and receiving data **in the slave mode**
|
||||
* Flags used to allocate the interrupt
|
||||
|
||||
|
@ -78,8 +78,8 @@ and/or address. This is reflected in the device configuration: when the ``comman
|
||||
fields are set to zero, no command or address phase is done.
|
||||
|
||||
Something similar is true for the read and write phase: not every transaction needs both data to be written
|
||||
as well as data to be read. When ``rx_buffer`` is NULL (and SPI_USE_RXDATA) is not set) the read phase
|
||||
is skipped. When ``tx_buffer`` is NULL (and SPI_USE_TXDATA) is not set) the write phase is skipped.
|
||||
as well as data to be read. When ``rx_buffer`` is NULL (and SPI_TRANS_USE_RXDATA) is not set) the read phase
|
||||
is skipped. When ``tx_buffer`` is NULL (and SPI_TRANS_USE_TXDATA) is not set) the write phase is skipped.
|
||||
|
||||
The driver offers two different kinds of transactions: the interrupt
|
||||
transactions and the polling transactions. Each device can choose one kind of
|
||||
@ -205,8 +205,8 @@ Tips
|
||||
1. Transactions with small amount of data:
|
||||
Sometimes, the amount of data is very small making it less than optimal allocating a separate buffer
|
||||
for it. If the data to be transferred is 32 bits or less, it can be stored in the transaction struct
|
||||
itself. For transmitted data, use the ``tx_data`` member for this and set the ``SPI_USE_TXDATA`` flag
|
||||
on the transmission. For received data, use ``rx_data`` and set ``SPI_USE_RXDATA``. In both cases, do
|
||||
itself. For transmitted data, use the ``tx_data`` member for this and set the ``SPI_TRANS_USE_TXDATA`` flag
|
||||
on the transmission. For received data, use ``rx_data`` and set ``SPI_TRANS_USE_RXDATA``. In both cases, do
|
||||
not touch the ``tx_buffer`` or ``rx_buffer`` members, because they use the same memory locations
|
||||
as ``tx_data`` and ``rx_data``.
|
||||
|
||||
|
@ -283,7 +283,7 @@ Linux and MacOS
|
||||
cd ~/esp/hello_world
|
||||
idf.py menuconfig
|
||||
|
||||
If your default version of Python is 3.x, you may need to run ``python2 idf.py`` instead.
|
||||
If your default version of Python is 3.x, you may need to run ``python2 $(which idf.py) menuconfig`` instead.
|
||||
|
||||
Windows
|
||||
~~~~~~~
|
||||
|
@ -21,7 +21,7 @@ To compile with ESP-IDF you need to get the following packages:
|
||||
|
||||
- Arch::
|
||||
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pyserial python2-cryptography python2-future python2-pyparsing python2-pyelftools cmake ninja ccache
|
||||
sudo pacman -S --needed gcc git make ncurses flex bison gperf python2-pip python2-pyserial python2-cryptography python2-future python2-pyparsing python2-pyelftools cmake ninja ccache
|
||||
|
||||
.. note::
|
||||
CMake version 3.5 or newer is required for use with ESP-IDF. Older Linux distributions may require updating, enabling of a "backports" repository, or installing of a "cmake3" package rather than "cmake".
|
||||
|
@ -53,7 +53,7 @@ static inline uint16_t big_endian_read_16(const uint8_t *buffer, uint8_t pos)
|
||||
|
||||
static inline uint32_t big_endian_read_32(const uint8_t *buffer, uint8_t pos)
|
||||
{
|
||||
return (((uint32_t)buffer[pos]) << 24) | (((uint32_t)buffer[(pos)+1]) >> 16) | (((uint32_t)buffer[(pos)+2]) >> 8) | ((uint32_t)buffer[(pos)+3]);
|
||||
return (((uint32_t)buffer[pos]) << 24) | (((uint32_t)buffer[(pos)+1]) << 16) | (((uint32_t)buffer[(pos)+2]) << 8) | ((uint32_t)buffer[(pos)+3]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -70,7 +70,7 @@ static void esp_eddystone_show_inform(const esp_eddystone_result_t* res)
|
||||
ESP_LOGI(DEMO_TAG, "battery voltage: %d mV", res->inform.tlm.battery_voltage);
|
||||
ESP_LOGI(DEMO_TAG, "beacon temperature in degrees Celsius: %6.1f", res->inform.tlm.temperature);
|
||||
ESP_LOGI(DEMO_TAG, "adv pdu count since power-up: %d", res->inform.tlm.adv_count);
|
||||
ESP_LOGI(DEMO_TAG, "time since power-up: %d s", res->inform.tlm.time);
|
||||
ESP_LOGI(DEMO_TAG, "time since power-up: %d s", (res->inform.tlm.time)/10);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -29,19 +29,10 @@
|
||||
|
||||
/**
|
||||
* Brief:
|
||||
* This test code shows how to configure gpio and how to use gpio interrupt.
|
||||
*
|
||||
* GPIO status:
|
||||
* GPIO18: output
|
||||
* GPIO19: output
|
||||
* GPIO4: input, pulled up, interrupt from rising edge and falling edge
|
||||
* GPIO5: input, pulled up, interrupt from rising edge.
|
||||
*
|
||||
* Test:
|
||||
* Connect GPIO18 with GPIO4
|
||||
* Connect GPIO19 with GPIO5
|
||||
* Generate pulses on GPIO18/19, that triggers interrupt on GPIO4/5
|
||||
*
|
||||
* This example Implemented BLE HID device profile related functions, in which the HID device
|
||||
* has 4 Reports (1 is mouse, 2 is keyboard and LED, 3 is Consumer Devices, 4 is Vendor devices).
|
||||
* Users can choose different reports according to their own application scenarios.
|
||||
* BLE HID profile inheritance and USB HID class.
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -58,15 +49,6 @@
|
||||
#define HID_DEMO_TAG "HID_DEMO"
|
||||
|
||||
|
||||
#define GPIO_OUTPUT_IO_0 18
|
||||
#define GPIO_OUTPUT_IO_1 19
|
||||
#define GPIO_OUTPUT_PIN_SEL ((1<<GPIO_OUTPUT_IO_0) | (1<<GPIO_OUTPUT_IO_1))
|
||||
#define GPIO_INPUT_IO_0 21
|
||||
#define GPIO_INPUT_IO_1 27
|
||||
#define GPIO_INPUT_PIN_SEL ((1<<GPIO_INPUT_IO_0) | (1<<GPIO_INPUT_IO_1))
|
||||
#define ESP_INTR_FLAG_DEFAULT 0
|
||||
|
||||
static xQueueHandle gpio_evt_queue = NULL;
|
||||
static uint16_t hid_conn_id = 0;
|
||||
static bool sec_conn = false;
|
||||
static bool send_volum_up = false;
|
||||
@ -108,75 +90,6 @@ static esp_ble_adv_params_t hidd_adv_params = {
|
||||
.adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
|
||||
};
|
||||
|
||||
void IRAM_ATTR gpio_isr_handler(void* arg)
|
||||
{
|
||||
uint32_t gpio_num = (uint32_t) arg;
|
||||
xQueueSendFromISR(gpio_evt_queue, &gpio_num, NULL);
|
||||
}
|
||||
|
||||
void gpio_task_example(void* arg)
|
||||
{
|
||||
static uint8_t i = 0;
|
||||
uint32_t io_num;
|
||||
for(;;) {
|
||||
if(xQueueReceive(gpio_evt_queue, &io_num, portMAX_DELAY)) {
|
||||
ESP_LOGI(HID_DEMO_TAG, "GPIO[%d] intr, val: %d\n", io_num, gpio_get_level(io_num));
|
||||
if(i == 0) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void gpio_demo_init(void)
|
||||
{
|
||||
gpio_config_t io_conf;
|
||||
//disable interrupt
|
||||
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
|
||||
//set as output mode
|
||||
io_conf.mode = GPIO_MODE_OUTPUT;
|
||||
//bit mask of the pins that you want to set,e.g.GPIO18/19
|
||||
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
|
||||
//disable pull-down mode
|
||||
io_conf.pull_down_en = 0;
|
||||
//disable pull-up mode
|
||||
io_conf.pull_up_en = 0;
|
||||
//configure GPIO with the given settings
|
||||
gpio_config(&io_conf);
|
||||
|
||||
//interrupt of rising edge
|
||||
io_conf.intr_type = GPIO_PIN_INTR_POSEDGE;
|
||||
//bit mask of the pins, use GPIO4/5 here
|
||||
io_conf.pin_bit_mask = GPIO_INPUT_PIN_SEL;
|
||||
//set as input mode
|
||||
io_conf.mode = GPIO_MODE_INPUT;
|
||||
//enable pull-up mode
|
||||
io_conf.pull_up_en = 1;
|
||||
gpio_config(&io_conf);
|
||||
|
||||
//change gpio intrrupt type for one pin
|
||||
gpio_set_intr_type(GPIO_INPUT_IO_0, GPIO_INTR_ANYEDGE);
|
||||
|
||||
//create a queue to handle gpio event from isr
|
||||
gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
|
||||
//start gpio task
|
||||
xTaskCreate(gpio_task_example, "gpio_task_example", 2048, NULL, 10, NULL);
|
||||
|
||||
//install gpio isr service
|
||||
gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
|
||||
//hook isr handler for specific gpio pin
|
||||
gpio_isr_handler_add(GPIO_INPUT_IO_0, gpio_isr_handler, (void*) GPIO_INPUT_IO_0);
|
||||
//hook isr handler for specific gpio pin
|
||||
gpio_isr_handler_add(GPIO_INPUT_IO_1, gpio_isr_handler, (void*) GPIO_INPUT_IO_1);
|
||||
|
||||
//remove isr handler for gpio number.
|
||||
gpio_isr_handler_remove(GPIO_INPUT_IO_0);
|
||||
//hook isr handler for specific gpio pin again
|
||||
gpio_isr_handler_add(GPIO_INPUT_IO_0, gpio_isr_handler, (void*) GPIO_INPUT_IO_0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void hidd_event_callback(esp_hidd_cb_event_t event, esp_hidd_cb_param_t *param)
|
||||
{
|
||||
@ -333,9 +246,6 @@ void app_main()
|
||||
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_INIT_KEY, &init_key, sizeof(uint8_t));
|
||||
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_RSP_KEY, &rsp_key, sizeof(uint8_t));
|
||||
|
||||
//init the gpio pin
|
||||
gpio_demo_init();
|
||||
xTaskCreate(&hid_demo_task, "hid_task", 2048, NULL, 5, NULL);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user