|
| 1 | +/* |
| 2 | + * Copyright 2020 Arduino SA |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +/** @file |
| 19 | + * Provides cyhal porting to generic mbed APIs |
| 20 | + */ |
| 21 | +#include "cyhal.h" |
| 22 | +#include "mbed_thread.h" |
| 23 | +#include "mbed_wait_api.h" |
| 24 | + |
| 25 | +static cyhal_sdio_t sdio_obj; |
| 26 | + |
| 27 | +/* Edit Pin configuration */ |
| 28 | +const pinconfig_t PinConfig[] = { |
| 29 | + |
| 30 | + [CYBSP_WIFI_WL_REG_ON] = WIFI_WL_REG_ON, |
| 31 | +#ifdef CYBSP_WIFI_32K_CLK |
| 32 | + [CYBSP_WIFI_32K_CLK] = WIFI_32K_CLK, |
| 33 | +#endif /* CYBSP_WIFI_32K_CLK */ |
| 34 | + [CYBSP_LED1 ] = BSP_LED1, |
| 35 | + [CYBSP_LED2 ] = BSP_LED2, |
| 36 | + [CYBSP_WIFI_SDIO_CMD] = WIFI_SDIO_CMD, |
| 37 | + [CYBSP_WIFI_SDIO_CLK] = WIFI_SDIO_CLK, |
| 38 | + [CYBSP_WIFI_SDIO_D0 ] = WIFI_SDIO_D0, |
| 39 | + [CYBSP_WIFI_SDIO_D1 ] = WIFI_SDIO_D1, |
| 40 | + [CYBSP_WIFI_SDIO_D2 ] = WIFI_SDIO_D2, |
| 41 | + [CYBSP_WIFI_SDIO_D3 ] = WIFI_SDIO_D3, |
| 42 | + [CYBSP_SDIO_OOB_IRQ ] = WIFI_SDIO_OOB_IRQ //VIKR |
| 43 | +}; |
| 44 | + |
| 45 | +void Cy_SysLib_Delay(uint32_t milliseconds) |
| 46 | +{ |
| 47 | + thread_sleep_for(milliseconds); |
| 48 | +} |
| 49 | + |
| 50 | +void Cy_SysLib_DelayUs(uint16_t microseconds) |
| 51 | +{ |
| 52 | + wait_us(microseconds); |
| 53 | +} |
| 54 | + |
| 55 | +void cyhal_system_delay_ms(uint32_t milliseconds) |
| 56 | +{ |
| 57 | + Cy_SysLib_Delay(milliseconds); |
| 58 | +} |
| 59 | + |
| 60 | +cyhal_sdio_t *cybsp_get_wifi_sdio_obj(void) |
| 61 | +{ |
| 62 | + return &sdio_obj; |
| 63 | +} |
0 commit comments