/* Destroy the PIS mode according to the specified parameters in the pis_init_t and create the associated handle.  */
ald_status_t ald_pis_destroy(ald_pis_handle_t *hperh)
/* Destroy the PIS mode according to the specified parameters in the pis_init_t and create the associated handle.  */
ald_status_t ald_pis_destroy(ald_pis_handle_t *hperh)
{
    assert_param(IS_PIS(hperh->perh));
    if (hperh->check_info != hperh->perh->CH_CON[hperh->consumer_ch])
        return ALD_ERROR;
    __LOCK(hperh);
    CLEAR_BIT(PIS->CH_OER, (1U << (uint32_t)hperh->consumer_ch));
    WRITE_REG(hperh->perh->CH_CON[hperh->consumer_ch], 0x0);
    switch (hperh->consumer_con) {
    case ALD_PIS_CON_0:
        PIS->TAR_CON0 &= ~(hperh->consumer_pos);
        break;
    case ALD_PIS_CON_1:
        PIS->TAR_CON1 &= ~(hperh->consumer_pos);
        break;
    default:
        break;
    }
    hperh->state = ALD_PIS_STATE_RESET;
    __UNLOCK(hperh);
    return ALD_OK;
}