[errno code][-RT_EINVAL] fix that use RT_EINVAL without -

This commit is contained in:
Meco Man
2023-03-16 00:44:05 -04:00
committed by Man, Jianting (Meco)
parent e4e88b2f3e
commit dfddd79b24
136 changed files with 316 additions and 324 deletions

View File

@@ -356,7 +356,7 @@ const static struct rt_pin_ops _nrf5x_pin_ops =
RT_NULL,
};
int rt_hw_pin_init(void)
rt_err_t rt_hw_pin_init(void)
{
nrfx_err_t err_code;
@@ -366,11 +366,11 @@ int rt_hw_pin_init(void)
switch(err_code)
{
case NRFX_ERROR_INVALID_STATE:
return RT_EINVAL;
return -RT_EINVAL;
case NRFX_SUCCESS:
return RT_EOK;
default:
return RT_ERROR;;
return -RT_ERROR;;
}
}

View File

@@ -35,18 +35,10 @@ struct pin_index
{
int index;
NRF_GPIO_Type *gpio;//NRF_P0 or NRF_P1
uint32_t pin;
rt_base_t pin;
};
static void nrf5x_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value);
static int nrf5x_pin_read(rt_device_t dev, rt_base_t pin);
static void nrf5x_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode);
static rt_err_t nrf5x_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
rt_uint32_t mode, void (*hdr)(void *args), void *args);
static rt_err_t nrf5x_pin_dettach_irq(struct rt_device *device, rt_int32_t pin);
static rt_err_t nrf5x_pin_irq_enable(struct rt_device *device, rt_base_t pin,
rt_uint32_t enabled);
int rt_hw_pin_init(void);
rt_err_t rt_hw_pin_init(void);
#endif /* __DRV_GPIO_H__ */

View File

@@ -212,7 +212,7 @@ static rt_err_t drv_pwm_control(struct rt_device_pwm *device, int cmd, void *arg
case PWM_CMD_GET:
return drv_pwm_get(p_mcu, configuration);
default:
return RT_EINVAL;
return -RT_EINVAL;
}
}