mirror of https://github.com/ARMmbed/mbed-os.git
Clean up common BSP implementation
parent
e64fdba7fc
commit
ced234607e
|
@ -26,7 +26,6 @@
|
|||
#include <stdlib.h>
|
||||
#include "cybsp.h"
|
||||
#include "cyhal_utils.h"
|
||||
#include "cyhal_implementation.h"
|
||||
#include "cycfg.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -54,13 +54,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "cybsp_api_core.h"
|
||||
#include "cybsp_types.h"
|
||||
#include "cybsp_core.h"
|
||||
#if defined(CYBSP_WIFI_CAPABLE)
|
||||
#include "cybsp_wifi_sdio.h"
|
||||
#endif
|
||||
#ifndef __MBED__
|
||||
#include "cybsp_retarget.h"
|
||||
#include "cybsp_serial_flash.h"
|
||||
#include "cybsp_rgb_led.h"
|
||||
#endif /* __MBED__ */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include "cybsp.h"
|
||||
#include "cyhal_implementation.h"
|
||||
#include "cycfg.h"
|
||||
#include "cycfg_system.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
|
@ -52,23 +52,18 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "cybsp_api_core.h"
|
||||
#include "cybsp_types.h"
|
||||
#include "cybsp_core.h"
|
||||
#ifndef __MBED__
|
||||
#include "cybsp_retarget.h"
|
||||
#include "cybsp_serial_flash.h"
|
||||
#include "cybsp_rgb_led.h"
|
||||
#endif /* __MBED__ */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \cond INTERNAL */
|
||||
|
||||
// HAL HW configuration data
|
||||
extern cyhal_qspi_t cybsp_qspi;
|
||||
extern cyhal_uart_t cybsp_bt_uart;
|
||||
extern cyhal_uart_t cybsp_uart;
|
||||
extern cyhal_i2c_t cybsp_i2c;
|
||||
extern cyhal_rtc_t cybsp_rtc;
|
||||
|
||||
/** \endcond */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <stdlib.h>
|
||||
#include "cybsp.h"
|
||||
#include "cyhal_utils.h"
|
||||
#include "cyhal_implementation.h"
|
||||
#include "cycfg.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -25,10 +25,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "cybsp_api_core.h"
|
||||
#include "cybsp_types.h"
|
||||
#include "cybsp_core.h"
|
||||
#if defined(CYBSP_WIFI_CAPABLE)
|
||||
#include "cybsp_wifi_sdio.h"
|
||||
#endif
|
||||
#ifndef __MBED__
|
||||
#include "cybsp_retarget.h"
|
||||
#include "cybsp_serial_flash.h"
|
||||
#include "cybsp_rgb_led.h"
|
||||
#endif /* __MBED__ */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include "cybsp.h"
|
||||
#include "cyhal_implementation.h"
|
||||
#include "cycfg.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include "cybsp.h"
|
||||
#include "cyhal_implementation.h"
|
||||
#include "cycfg.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
@ -52,11 +52,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifdef MBED
|
||||
#include "cybsp_api_wifi.h"
|
||||
#else
|
||||
#include "cybsp_api_core.h"
|
||||
#endif /* MBED */
|
||||
#include "cybsp_types.h"
|
||||
#include "cybsp_core.h"
|
||||
#if defined(CYBSP_WIFI_CAPABLE)
|
||||
#include "cybsp_wifi_sdio.h"
|
||||
#endif
|
||||
#ifndef __MBED__
|
||||
#include "cybsp_retarget.h"
|
||||
#include "cybsp_rgb_led.h"
|
||||
#endif /* __MBED__ */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************//**
|
||||
* \file cybsp_utils.c
|
||||
* \file cybsp_core.c
|
||||
*
|
||||
* \brief
|
||||
* Provides utility functions that are used by board support packages.
|
||||
|
@ -22,16 +22,13 @@
|
|||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "cybsp_api_core.h"
|
||||
#include "cybsp_core.h"
|
||||
#include "cyhal.h"
|
||||
#include "cyhal_implementation.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static void (*btn_interrupt_call_back) (void);
|
||||
|
||||
cy_rslt_t cybsp_led_init(cybsp_led_t which)
|
||||
{
|
||||
return cyhal_gpio_init((cyhal_gpio_t)which, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_OFF);
|
||||
|
@ -57,22 +54,12 @@ bool cybsp_btn_get_state(cybsp_btn_t which)
|
|||
return cyhal_gpio_read((cyhal_gpio_t)which);
|
||||
}
|
||||
|
||||
static void gpio_call_back_wrapper(void *handler_arg, cyhal_gpio_irq_event_t event)
|
||||
void cybsp_btn_set_interrupt(cybsp_btn_t which, cyhal_gpio_event_t type, cyhal_gpio_event_callback_t callback, void *callback_arg)
|
||||
{
|
||||
if (btn_interrupt_call_back != NULL)
|
||||
{
|
||||
btn_interrupt_call_back();
|
||||
}
|
||||
cyhal_gpio_register_callback((cyhal_gpio_t)which, callback, callback_arg);
|
||||
cyhal_gpio_enable_event((cyhal_gpio_t)which, type, 7, 1);
|
||||
}
|
||||
|
||||
void cybsp_btn_set_interrupt(cybsp_btn_t which, cyhal_gpio_irq_event_t type, void (*callback)(void))
|
||||
{
|
||||
btn_interrupt_call_back = callback;
|
||||
cyhal_gpio_register_irq((cyhal_gpio_t)which, 7, &gpio_call_back_wrapper, NULL);
|
||||
cyhal_gpio_irq_enable((cyhal_gpio_t)which, type, 1);
|
||||
}
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************//**
|
||||
* \file cybsp_api_core.h
|
||||
* \file cybsp_core.h
|
||||
*
|
||||
* \brief
|
||||
* Basic abstraction layer for dealing with boards containing a Cypress MCU. This
|
||||
|
@ -25,21 +25,21 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_board Board abstraction
|
||||
* \ingroup group_abstraction
|
||||
* \addtogroup group_bsp_core Core
|
||||
* \{
|
||||
* Basic abstraction layer for dealing with boards containing a Cypress MCU. This
|
||||
* API provides convenience methods for initializing and manipulating different
|
||||
* hardware found on the board.
|
||||
*
|
||||
* \defgroup group_abstraction_board_macros Macros
|
||||
* \defgroup group_abstraction_board_functions Functions
|
||||
* \defgroup group_bsp_core_macros Macros
|
||||
* \defgroup group_bsp_core_functions Functions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "cy_result.h"
|
||||
#include "cyhal_gpio.h"
|
||||
#include "cybsp_types.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
@ -125,9 +125,10 @@ bool cybsp_btn_get_state(cybsp_btn_t which);
|
|||
* \brief Sets the interrupt to trigger when the button state is changed.
|
||||
* \param which The specific button number to get state from, see BSP header file for available buttones
|
||||
* \param type The type sets level vs edge and active high vs active low
|
||||
* \param callback The function pointer to call when the button state changes
|
||||
* \param callback The function pointer to call when the button state changes. NULL to unregister.
|
||||
* \param callback_arg The optional argument to provide when the callback is executed. This can be NULL.
|
||||
*/
|
||||
void cybsp_btn_set_interrupt(cybsp_btn_t which, cyhal_gpio_irq_event_t type, void (*callback)(void));
|
||||
void cybsp_btn_set_interrupt(cybsp_btn_t which, cyhal_gpio_event_t type, cyhal_gpio_event_callback_t callback, void *callback_arg);
|
||||
|
||||
|
||||
/** \} group_abstraction_board_functions */
|
|
@ -19,7 +19,7 @@
|
|||
#include "device.h"
|
||||
#include "cycfg.h"
|
||||
#include "cyhal_hwmgr.h"
|
||||
#include "cybsp_api_core.h"
|
||||
#include "cybsp_core.h"
|
||||
#include "mbed_power_mgmt.h"
|
||||
#include "rtos_idle.h"
|
||||
|
||||
|
|
Loading…
Reference in New Issue