mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/driver: 'const' all config calls.
Some were, some weren't. They all could/should be. Signed-off-by: Michel Pollet <buserror@gmail.com>
This commit is contained in:
parent
375b28650b
commit
349a77cb55
@ -270,7 +270,7 @@ esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t gpio_config(gpio_config_t *pGPIOConfig)
|
||||
esp_err_t gpio_config(const gpio_config_t *pGPIOConfig)
|
||||
{
|
||||
uint64_t gpio_pin_mask = (pGPIOConfig->pin_bit_mask);
|
||||
uint32_t io_reg = 0;
|
||||
|
@ -429,7 +429,7 @@ esp_err_t i2c_get_data_mode(i2c_port_t i2c_num, i2c_trans_mode_t *tx_trans_mode,
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t i2c_param_config(i2c_port_t i2c_num, i2c_config_t* i2c_conf)
|
||||
esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t* i2c_conf)
|
||||
{
|
||||
I2C_CHECK(i2c_num < I2C_NUM_MAX, I2C_NUM_ERROR_STR, ESP_ERR_INVALID_ARG);
|
||||
I2C_CHECK(i2c_conf != NULL, I2C_ADDR_ERROR_STR, ESP_ERR_INVALID_ARG);
|
||||
|
@ -221,7 +221,7 @@ typedef intr_handle_t gpio_isr_handle_t;
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*
|
||||
*/
|
||||
esp_err_t gpio_config(gpio_config_t *pGPIOConfig);
|
||||
esp_err_t gpio_config(const gpio_config_t *pGPIOConfig);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,7 @@ esp_err_t i2c_driver_delete(i2c_port_t i2c_num);
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t i2c_param_config(i2c_port_t i2c_num, i2c_config_t* i2c_conf);
|
||||
esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t* i2c_conf);
|
||||
|
||||
/**
|
||||
* @brief reset I2C tx hardware fifo
|
||||
|
@ -115,7 +115,7 @@ typedef intr_handle_t ledc_isr_handle_t;
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t ledc_channel_config(ledc_channel_config_t* ledc_conf);
|
||||
esp_err_t ledc_channel_config(const ledc_channel_config_t* ledc_conf);
|
||||
|
||||
/**
|
||||
* @brief LEDC timer configuration
|
||||
@ -128,7 +128,7 @@ esp_err_t ledc_channel_config(ledc_channel_config_t* ledc_conf);
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
* - ESP_FAIL Can not find a proper pre-divider number base on the given frequency and the current bit_num.
|
||||
*/
|
||||
esp_err_t ledc_timer_config(ledc_timer_config_t* timer_conf);
|
||||
esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf);
|
||||
|
||||
/**
|
||||
* @brief LEDC update channel parameters
|
||||
|
@ -88,7 +88,7 @@ typedef intr_handle_t pcnt_isr_handle_t;
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t pcnt_unit_config(pcnt_config_t *pcnt_config);
|
||||
esp_err_t pcnt_unit_config(const pcnt_config_t *pcnt_config);
|
||||
|
||||
/**
|
||||
* @brief Get pulse counter value
|
||||
|
@ -564,7 +564,7 @@ esp_err_t rmt_set_pin(rmt_channel_t channel, rmt_mode_t mode, gpio_num_t gpio_nu
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
* - ESP_OK Success
|
||||
*/
|
||||
esp_err_t rmt_config(rmt_config_t* rmt_param);
|
||||
esp_err_t rmt_config(const rmt_config_t* rmt_param);
|
||||
|
||||
/**
|
||||
* @brief register RMT interrupt handler, the handler is an ISR.
|
||||
|
@ -57,7 +57,7 @@ typedef struct {
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t sigmadelta_config(sigmadelta_config_t *config);
|
||||
esp_err_t sigmadelta_config(const sigmadelta_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Set Sigma-delta channel duty.
|
||||
|
@ -131,7 +131,7 @@ typedef struct spi_device_t* spi_device_handle_t; ///< Handle for a device on a
|
||||
* - ESP_ERR_NO_MEM if out of memory
|
||||
* - ESP_OK on success
|
||||
*/
|
||||
esp_err_t spi_bus_initialize(spi_host_device_t host, spi_bus_config_t *bus_config, int dma_chan);
|
||||
esp_err_t spi_bus_initialize(spi_host_device_t host, const spi_bus_config_t *bus_config, int dma_chan);
|
||||
|
||||
/**
|
||||
* @brief Free a SPI bus
|
||||
@ -235,4 +235,4 @@ esp_err_t spi_device_transmit(spi_device_handle_t handle, spi_transaction_t *tra
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -287,7 +287,7 @@ esp_err_t timer_isr_register(timer_group_t group_num, timer_idx_t timer_num, voi
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t timer_init(timer_group_t group_num, timer_idx_t timer_num, timer_config_t* config);
|
||||
esp_err_t timer_init(timer_group_t group_num, timer_idx_t timer_num, const timer_config_t* config);
|
||||
|
||||
/** @brief Get timer configure value.
|
||||
*
|
||||
|
@ -180,7 +180,7 @@ esp_err_t ledc_isr_register(void (*fn)(void*), void * arg, int intr_alloc_flags,
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t ledc_timer_config(ledc_timer_config_t* timer_conf)
|
||||
esp_err_t ledc_timer_config(const ledc_timer_config_t* timer_conf)
|
||||
{
|
||||
int freq_hz = timer_conf->freq_hz;
|
||||
int bit_num = timer_conf->bit_num;
|
||||
@ -245,7 +245,7 @@ esp_err_t ledc_set_pin(int gpio_num, ledc_mode_t speed_mode, ledc_channel_t ledc
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t ledc_channel_config(ledc_channel_config_t* ledc_conf)
|
||||
esp_err_t ledc_channel_config(const ledc_channel_config_t* ledc_conf)
|
||||
{
|
||||
uint32_t speed_mode = ledc_conf->speed_mode;
|
||||
uint32_t gpio_num = ledc_conf->gpio_num;
|
||||
|
@ -39,7 +39,7 @@ static portMUX_TYPE pcnt_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
#define PCNT_ENTER_CRITICAL_ISR(mux) portENTER_CRITICAL_ISR(mux)
|
||||
#define PCNT_EXIT_CRITICAL_ISR(mux) portEXIT_CRITICAL_ISR(mux)
|
||||
|
||||
esp_err_t pcnt_unit_config(pcnt_config_t *pcnt_config)
|
||||
esp_err_t pcnt_unit_config(const pcnt_config_t *pcnt_config)
|
||||
{
|
||||
uint8_t unit = pcnt_config->unit;
|
||||
uint8_t channel = pcnt_config->channel;
|
||||
|
@ -373,7 +373,7 @@ esp_err_t rmt_set_pin(rmt_channel_t channel, rmt_mode_t mode, gpio_num_t gpio_nu
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t rmt_config(rmt_config_t* rmt_param)
|
||||
esp_err_t rmt_config(const rmt_config_t* rmt_param)
|
||||
{
|
||||
uint8_t mode = rmt_param->rmt_mode;
|
||||
uint8_t channel = rmt_param->channel;
|
||||
|
@ -25,7 +25,7 @@ static const char* SIGMADELTA_TAG = "SIGMADELTA";
|
||||
return (ret_val); \
|
||||
}
|
||||
|
||||
esp_err_t sigmadelta_config(sigmadelta_config_t *config)
|
||||
esp_err_t sigmadelta_config(const sigmadelta_config_t *config)
|
||||
{
|
||||
SIGMADELTA_CHECK(config->channel < SIGMADELTA_CHANNEL_MAX, SIGMADELTA_CHANNEL_ERR_STR, ESP_ERR_INVALID_ARG);
|
||||
SIGMADELTA_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(config->sigmadelta_gpio), SIGMADELTA_IO_ERR_STR, ESP_ERR_INVALID_ARG);
|
||||
|
@ -191,7 +191,7 @@ static const spi_signal_conn_t io_signal[3]={
|
||||
static void spi_intr(void *arg);
|
||||
|
||||
|
||||
esp_err_t spi_bus_initialize(spi_host_device_t host, spi_bus_config_t *bus_config, int dma_chan)
|
||||
esp_err_t spi_bus_initialize(spi_host_device_t host, const spi_bus_config_t *bus_config, int dma_chan)
|
||||
{
|
||||
bool native=true;
|
||||
/* ToDo: remove this when we have flash operations cooperating with this */
|
||||
|
@ -204,7 +204,7 @@ esp_err_t timer_isr_register(timer_group_t group_num, timer_idx_t timer_num,
|
||||
return esp_intr_alloc_intrstatus(intr_source, intr_alloc_flags, status_reg, mask, fn, arg, handle);
|
||||
}
|
||||
|
||||
esp_err_t timer_init(timer_group_t group_num, timer_idx_t timer_num, timer_config_t *config)
|
||||
esp_err_t timer_init(timer_group_t group_num, timer_idx_t timer_num, const timer_config_t *config)
|
||||
{
|
||||
TIMER_CHECK(group_num < TIMER_GROUP_MAX, TIMER_GROUP_NUM_ERROR, ESP_ERR_INVALID_ARG);
|
||||
TIMER_CHECK(timer_num < TIMER_MAX, TIMER_NUM_ERROR, ESP_ERR_INVALID_ARG);
|
||||
|
Loading…
x
Reference in New Issue
Block a user