FUTURE_SEQUANA deep sleep fixes:

- fixed feature rename (from DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER) in all missed places
- disabled power manager callback for serial driver
pull/8905/head
Leszek Rusinowicz 2018-11-29 11:29:26 +01:00
parent 172ababc27
commit ea5dccaa92
4 changed files with 17 additions and 17 deletions

View File

@ -264,7 +264,7 @@ static int i2c_convert_status(cy_en_scb_i2c_status_t status)
/*
* Callback function to handle into and out of deep sleep state transitions.
*/
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER
static cy_en_syspm_status_t i2c_pm_callback(cy_stc_syspm_callback_params_t *callback_params)
{
cy_stc_syspm_callback_params_t params = *callback_params;
@ -273,7 +273,7 @@ static cy_en_syspm_status_t i2c_pm_callback(cy_stc_syspm_callback_params_t *call
return Cy_SCB_I2C_DeepSleepCallback(&params);
}
#endif // DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#endif // DEVICE_SLEEP && DEVICE_LPTICKER
void i2c_init(i2c_t *obj_in, PinName sda, PinName scl)
@ -300,7 +300,7 @@ void i2c_init(i2c_t *obj_in, PinName sda, PinName scl)
i2c_init_clock(obj, I2C_DEFAULT_SPEED);
i2c_init_pins(obj);
i2c_init_peripheral(obj);
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER
obj->pm_callback_handler.callback = i2c_pm_callback;
obj->pm_callback_handler.type = CY_SYSPM_DEEPSLEEP;
obj->pm_callback_handler.skipMode = 0;
@ -310,7 +310,7 @@ void i2c_init(i2c_t *obj_in, PinName sda, PinName scl)
if (!Cy_SysPm_RegisterCallback(&obj->pm_callback_handler)) {
error("PM callback registration failed!");
}
#endif // DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#endif // DEVICE_SLEEP && DEVICE_LPTICKER
} else {
error("I2C pinout mismatch. Requested pins Rx and Tx can't be used for the same I2C communication.");
}

View File

@ -86,7 +86,7 @@ struct serial_s {
bool tx_pending;
cy_israddress async_handler;
#endif // DEVICE_SERIAL_ASYNCH
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER
cy_stc_syspm_callback_params_t pm_callback_params;
cy_stc_syspm_callback_t pm_callback_handler;
#endif
@ -124,7 +124,7 @@ struct spi_s {
void *tx_buffer;
uint32_t tx_buffer_size;
#endif // DEVICE_SPI_ASYNCH
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER
cy_stc_syspm_callback_params_t pm_callback_params;
cy_stc_syspm_callback_t pm_callback_handler;
#endif
@ -160,7 +160,7 @@ struct i2c_s {
uint16_t events;
uint32_t handler;
#endif // DEVICE_I2C_ASYNCH
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER
cy_stc_syspm_callback_params_t pm_callback_params;
cy_stc_syspm_callback_t pm_callback_handler;
#endif
@ -178,7 +178,7 @@ struct pwmout_s {
uint32_t period;
uint32_t pulse_width;
uint32_t prescaler;
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER
cy_stc_syspm_callback_params_t pm_callback_params;
cy_stc_syspm_callback_t pm_callback_handler;
#endif

View File

@ -120,7 +120,7 @@ static void pwm_start(pwmout_t *obj, uint32_t new_period, uint32_t new_pulse_wid
/*
* Callback handler to restart the timer after deep sleep.
*/
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER
static cy_en_syspm_status_t pwm_pm_callback(cy_stc_syspm_callback_params_t *callback_params)
{
pwmout_t *obj = (pwmout_t *)callback_params->context;
@ -145,7 +145,7 @@ static cy_en_syspm_status_t pwm_pm_callback(cy_stc_syspm_callback_params_t *call
return CY_SYSPM_SUCCESS;
}
#endif // DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#endif // DEVICE_SLEEP && DEVICE_LPTICKER
void pwmout_init(pwmout_t *obj, PinName pin)
@ -198,17 +198,17 @@ void pwmout_init(pwmout_t *obj, PinName pin)
obj->period = 0;
obj->pulse_width = 0;
obj->prescaler = 0;
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER
obj->pm_callback_handler.callback = pwm_pm_callback;
obj->pm_callback_handler.type = CY_SYSPM_DEEPSLEEP;
obj->pm_callback_handler.skipMode = CY_SYSPM_SKIP_CHECK_READY | CY_SYSPM_SKIP_CHECK_FAIL;
obj->pm_callback_handler.skipMode = 0;
obj->pm_callback_handler.callbackParams = &obj->pm_callback_params;
obj->pm_callback_params.base = obj->base;
obj->pm_callback_params.context = obj;
if (!Cy_SysPm_RegisterCallback(&obj->pm_callback_handler)) {
error("PM callback registration failed!");
}
#endif // DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#endif // DEVICE_SLEEP && DEVICE_LPTICKER
} else {
error("PWM OUT pinout mismatch.");

View File

@ -345,7 +345,7 @@ static void serial_init_peripheral(serial_obj_t *obj)
Cy_SCB_UART_Enable(obj->base);
}
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER && SERIAL_PM_CALLBACK_ENABLED
static cy_en_syspm_status_t serial_pm_callback(cy_stc_syspm_callback_params_t *params)
{
serial_obj_t *obj = (serial_obj_t *)params->context;
@ -393,7 +393,7 @@ static cy_en_syspm_status_t serial_pm_callback(cy_stc_syspm_callback_params_t *p
}
return status;
}
#endif // DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#endif // DEVICE_SLEEP && DEVICE_LPTICKER
void serial_init(serial_t *obj_in, PinName tx, PinName rx)
{
@ -425,7 +425,7 @@ void serial_init(serial_t *obj_in, PinName tx, PinName rx)
//Cy_GPIO_Write(Cy_GPIO_PortToAddr(CY_PORT(P13_6)), CY_PIN(P13_6), 1);
serial_init_pins(obj);
//Cy_GPIO_Write(Cy_GPIO_PortToAddr(CY_PORT(P13_6)), CY_PIN(P13_6), 0);
#if DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#if DEVICE_SLEEP && DEVICE_LPTICKER && SERIAL_PM_CALLBACK_ENABLED
obj->pm_callback_handler.callback = serial_pm_callback;
obj->pm_callback_handler.type = CY_SYSPM_DEEPSLEEP;
obj->pm_callback_handler.skipMode = 0;
@ -435,7 +435,7 @@ void serial_init(serial_t *obj_in, PinName tx, PinName rx)
if (!Cy_SysPm_RegisterCallback(&obj->pm_callback_handler)) {
error("PM callback registration failed!");
}
#endif // DEVICE_SLEEP && DEVICE_LOWPOWERTIMER
#endif // DEVICE_SLEEP && DEVICE_LPTICKER
if (is_stdio) {
memcpy(&stdio_uart, obj_in, sizeof(serial_t));
stdio_uart_inited = true;