mirror of https://github.com/ARMmbed/mbed-os.git
commit
c225f8f1e7
|
@ -51,7 +51,7 @@ void analogout_write_u16(dac_t *obj, uint16_t value)
|
|||
|
||||
float analogout_read(dac_t *obj)
|
||||
{
|
||||
return analogout_read_u16(obj) / UINT16_MAX;
|
||||
return analogout_read_u16(obj) * (1.0f / UINT16_MAX);
|
||||
}
|
||||
|
||||
uint16_t analogout_read_u16(dac_t *obj)
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
# PSoC 6 CSP
|
||||
|
||||
## Overview
|
||||
|
||||
TBD: high-level overview
|
||||
|
||||
## Features
|
||||
|
||||
TBD: list of the functionality included
|
||||
|
||||
## API Reference Manual
|
||||
|
||||
The PSoC 6 Chip Support Package provides a set of APIs to configure, initialize and use the PSoC 6 MCU resources.
|
||||
|
||||
See the [PSoC 6 CSP API Reference Manual][api] for the complete list of the provided interfaces.
|
||||
|
||||
## More information
|
||||
* [PSoC 6 CSP API Reference Manual][api]
|
||||
* [Cypress Semiconductor](http://www.cypress.com)
|
||||
|
||||
[api]: modules.html
|
||||
|
||||
---
|
||||
© Cypress Semiconductor Corporation, 2019.
|
|
@ -1,30 +0,0 @@
|
|||
/***************************************************************************//**
|
||||
* \file cyabs_chip.h
|
||||
*
|
||||
* \brief
|
||||
* Basic abstraction layer for dealing with chips containing a Cypress MCU. This
|
||||
* API provides convenience methods for initializing and manipulating different
|
||||
* hardware peripherals. Depending on the specific chip being used, not all
|
||||
* features may be supported.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cyhal.h"
|
|
@ -1,116 +0,0 @@
|
|||
/***************************************************************************//**
|
||||
* \file cyabs_fs.h
|
||||
*
|
||||
* \brief
|
||||
* Basic file system abstraction layer. This API provides convenience methods
|
||||
* for reading and writing values.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_fs File system abstraction
|
||||
* \ingroup group_abstraction
|
||||
* \{
|
||||
* Basic file system abstraction layer. This API provides convenience methods
|
||||
* for reading and writing values.
|
||||
*
|
||||
* \defgroup group_abstraction_fs_macros Macros
|
||||
* \defgroup group_abstraction_fs_data_structures Data Structures
|
||||
* \defgroup group_abstraction_fs_functions Functions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "cy_result.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_fs_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define CY_O_RDONLY (1 << 0) /**< TODO */
|
||||
#define CY_O_WRONLY (1 << 1) /**< TODO */
|
||||
#define CY_O_RDWR (1 << 2) /**< TODO */
|
||||
#define CY_O_APPEND (1 << 3) /**< TODO */
|
||||
#define CY_O_CREAT (1 << 4) /**< TODO */
|
||||
|
||||
/** \} group_abstraction_fs_macros */
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_fs_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
typedef uint32_t cy_handle_t; /**< Resource handle */
|
||||
|
||||
/** \} group_abstraction_fs_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_fs_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief open or create a file and return a handle
|
||||
* \param path the path name of the file to open
|
||||
* \param oflag the mode to use when opening the file
|
||||
* \param handle pointer to location re receive handle
|
||||
* \returns CY_RSLT_SUCCESS if successful, otherwise error code
|
||||
*/
|
||||
cy_rslt_t cy_fs_open(const char *path, uint32_t oflag, cy_handle_t *handle) ;
|
||||
|
||||
/**
|
||||
* \brief close an open file
|
||||
* \param handle a file handle to an open file
|
||||
* \returns CY_RSLT_SUCCESS if successful, otherwise error code
|
||||
*/
|
||||
cy_rslt_t cy_fs_close(cy_handle_t handle) ;
|
||||
|
||||
/**
|
||||
* \brief read data from a file
|
||||
* \param handle a file handle open for reading or read/write
|
||||
* \param buf the buffer for the read data
|
||||
* \param nbyte the size of the buffer in bytes, the number of bytes read on return
|
||||
* \returns CY_RSLT_SUCCESS if successful, otherwise error code
|
||||
*/
|
||||
cy_rslt_t cy_fs_read(cy_handle_t handle, void *buf, size_t *nbyte) ;
|
||||
|
||||
/**
|
||||
* \brief write data to a file
|
||||
* \param handle a file handle open for writing or read/write
|
||||
* \param buf the buffer for the data to write
|
||||
* \param nbyte the size of the buffer in bytes, the number of bytes written on return
|
||||
* \returns CY_RSLT_SUCCESS if successful, otherwise error code
|
||||
*/
|
||||
cy_rslt_t cy_fs_write(cy_handle_t handle, const void *buf, size_t *nbyte) ;
|
||||
|
||||
/** \} group_abstraction_fs_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} group_abstraction_fs */
|
|
@ -22,18 +22,6 @@
|
|||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_resource Resource abstraction
|
||||
* \ingroup group_abstraction
|
||||
* \{
|
||||
* Basic abstraction layer for dealing with resources.
|
||||
*
|
||||
* \defgroup group_abstraction_resource_macros Macros
|
||||
* \defgroup group_abstraction_resource_enums Enums
|
||||
* \defgroup group_abstraction_resource_data_structures Data Structures
|
||||
* \defgroup group_abstraction_resource_functions Functions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -45,9 +33,11 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_resource_macros
|
||||
* \{
|
||||
*/
|
||||
* \addtogroup group_abstraction_resource Resource Abstraction
|
||||
* \{
|
||||
*
|
||||
* Basic abstraction layer for dealing with resources.
|
||||
*/
|
||||
|
||||
/** Error code for when the specified resource operation is not valid. */
|
||||
#define CY_RSLT_RSC_ERROR_UNSUPPORTED (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_RESOURCE, 0))
|
||||
|
@ -62,13 +52,6 @@ extern "C" {
|
|||
/** Error code for when the specified resource can not be read. */
|
||||
#define CY_RSLT_RSC_ERROR_READ (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_RESOURCE, 5))
|
||||
|
||||
/** \} group_abstraction_resource_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_resource_enums
|
||||
* \{
|
||||
*/
|
||||
/** Different types of memory that the resources can be stored in. */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -77,14 +60,6 @@ typedef enum
|
|||
CY_RESOURCE_IN_EXTERNAL_STORAGE /**< resource location in external storage */
|
||||
} cy_resource_location_t;
|
||||
|
||||
/** \} group_abstraction_resource_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_resource_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Filesystem handle */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -99,19 +74,12 @@ typedef struct
|
|||
unsigned long size; /**< resource size */
|
||||
union
|
||||
{
|
||||
cy_filesystem_resource_handle_t fs; /** < filesystem resource handle */
|
||||
const uint8_t* mem_data; /** < memory resource handle */
|
||||
void* external_storage_context; /** < external storage context */
|
||||
} val;
|
||||
cy_filesystem_resource_handle_t fs; /**< handle for resource in filesystem */
|
||||
const uint8_t* mem_data; /**< handle for resource in internal memory */
|
||||
void* external_storage_context; /**< handle for resource in external storage */
|
||||
} val; /**< low-level handle (type varies depending on resource storage location) */
|
||||
} cy_resource_handle_t;
|
||||
|
||||
/** \} group_abstraction_resource_data_structures */
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_resource_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief return the block size for the resource
|
||||
* \param handle handle to a resource
|
||||
|
@ -147,7 +115,8 @@ cy_rslt_t cy_resource_get_block_count(const cy_resource_handle_t *handle, uint32
|
|||
cy_rslt_t cy_resource_read(const cy_resource_handle_t *handle, uint32_t blockno, uint8_t **buffer, uint32_t *size);
|
||||
|
||||
/**
|
||||
* \brief optimized version of read for resources stored in memory (\see CY_RESOURCE_IN_MEMORY)
|
||||
* \brief optimized version of read for resources stored in memory
|
||||
* \see CY_RESOURCE_IN_MEMORY
|
||||
* \param handle the handle to the resource
|
||||
* \param buffer pointer to receive buffer address from resource. This does NOT need to be freed.
|
||||
* \param size location to receive the size of the block read
|
||||
|
@ -155,8 +124,6 @@ cy_rslt_t cy_resource_read(const cy_resource_handle_t *handle, uint32_t blockno,
|
|||
*/
|
||||
cy_rslt_t cy_resource_readonly_memory(const cy_resource_handle_t *handle, const uint8_t **buffer, uint32_t *size);
|
||||
|
||||
/** \} group_abstraction_resource_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
|
@ -33,50 +33,14 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*
|
||||
* Note, cyabs_rtos_impl.h above is included and is the implementation of some basic
|
||||
* types for the abstraction layer. The types expected to be defined are.
|
||||
*
|
||||
* cy_thread_t : typedef from underlying RTOS thread type
|
||||
* cy_thread_arg_t : typedef from the RTOS type that is passed to the
|
||||
* entry function of a thread.
|
||||
* cy_mutex_t : typedef from the underlying RTOS mutex type
|
||||
* cy_event_t : typedef from the underlying RTOS event type
|
||||
* cy_queue_t : typedef from the underlying RTOS queue type
|
||||
* cy_timer_callback_arg_t : typedef from the RTOS type that is passed
|
||||
* : to the timer callback function
|
||||
* cy_timer_t : typedef from the underlying RTOS timer type
|
||||
* cy_time_t : count of time in milliseconds
|
||||
* cy_rtos_error_t : typedef from the underlying RTOS error type
|
||||
*
|
||||
* The enum cy_thread_priority_t needs to have the following priority values defined
|
||||
* and mapped to RTOS specific values:
|
||||
* CY_RTOS_PRIORITY_MIN
|
||||
* CY_RTOS_PRIORITY_LOW
|
||||
* CY_RTOS_PRIORITY_BELOWNORMAL
|
||||
* CY_RTOS_PRIORITY_NORMAL
|
||||
* CY_RTOS_PRIORITY_ABOVENORMAL
|
||||
* CY_RTOS_PRIORITY_HIGH
|
||||
* CY_RTOS_PRIORITY_REALTIME
|
||||
* CY_RTOS_PRIORITY_MAX
|
||||
*
|
||||
* Finally, the following macros need to be defined for memory allocations:
|
||||
* CY_RTOS_MIN_STACK_SIZE
|
||||
* CY_RTOS_ALIGNMENT
|
||||
* CY_RTOS_ALIGNMENT_MASK
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_rtos RTOS abstraction
|
||||
* \ingroup group_abstraction
|
||||
* \{
|
||||
* Basic abstraction layer for dealing with RTOSes.
|
||||
*
|
||||
* \defgroup group_abstraction_rtos_macros Macros
|
||||
* \defgroup group_abstraction_rtos_enums Enums
|
||||
* \defgroup group_abstraction_rtos_data_structures Data Structures
|
||||
* \defgroup group_abstraction_rtos_functions Functions
|
||||
* \defgroup group_abstraction_rtos_common Common
|
||||
* \defgroup group_abstraction_rtos_mutex Mutex
|
||||
* \defgroup group_abstraction_rtos_queue Queue
|
||||
* \defgroup group_abstraction_rtos_semaphore Semaphore
|
||||
* \defgroup group_abstraction_rtos_threads Threading
|
||||
* \defgroup group_abstraction_rtos_time Time
|
||||
* \defgroup group_abstraction_rtos_timer Timer
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -87,9 +51,9 @@ extern "C"
|
|||
/*********************************************** CONSTANTS **********************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_rtos_macros
|
||||
* \{
|
||||
*/
|
||||
* \ingroup group_abstraction_rtos_common
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Used with RTOS calls that require a timeout. This implies the call will never timeout. */
|
||||
#define CY_RTOS_NEVER_TIMEOUT ( (uint32_t)0xffffffffUL )
|
||||
|
@ -100,31 +64,35 @@ extern "C"
|
|||
// underlying errors to these. If the errors are special cases, the the error CY_RTOS_GENERAL_ERROR can be
|
||||
// returns and cy_rtos_last_error() used to retrieve the RTOS specific error message.
|
||||
//
|
||||
/** Requested operationd did not complete in the specified time */
|
||||
/** Requested operation did not complete in the specified time */
|
||||
#define CY_RTOS_TIMEOUT CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 0)
|
||||
/** The RTOS could not allocate memory for the specified operation */
|
||||
#define CY_RTOS_NO_MEMORY CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 1)
|
||||
/** An error occured in the RTOS */
|
||||
#define CY_RTOS_GENERAL_ERROR CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 2)
|
||||
/** A bad argument was passed into the APIs */
|
||||
#define CY_RTOS_BAD_PARAM CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 5)
|
||||
|
||||
/** \} group_abstraction_rtos_common */
|
||||
|
||||
/**
|
||||
* \ingroup group_abstraction_rtos_queue
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** The Queue is already full and can't accept any more items at this time */
|
||||
#define CY_RTOS_QUEUE_FULL CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 3)
|
||||
/** The Queue is empty and has nothing to remove */
|
||||
#define CY_RTOS_QUEUE_EMPTY CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 4)
|
||||
/** A bad argument was passed into the APIs */
|
||||
#define CY_RTOS_BAD_PARAM CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 5)
|
||||
|
||||
/** \} group_abstraction_rtos_macros */
|
||||
|
||||
/** \} group_abstraction_rtos_queue */
|
||||
|
||||
/*********************************************** TYPES **********************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_rtos_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The state a thread can be in
|
||||
*
|
||||
* \ingroup group_abstraction_rtos_threads
|
||||
*/
|
||||
typedef enum cy_thread_state
|
||||
{
|
||||
|
@ -138,6 +106,8 @@ typedef enum cy_thread_state
|
|||
|
||||
/**
|
||||
* The type of timer
|
||||
*
|
||||
* \ingroup group_abstraction_rtos_timer
|
||||
*/
|
||||
typedef enum cy_timer_trigger_type
|
||||
{
|
||||
|
@ -147,34 +117,22 @@ typedef enum cy_timer_trigger_type
|
|||
cy_timer_type_once = CY_TIMER_TYPE_ONCE, /**< \deprecated replaced by CY_TIMER_TYPE_ONCE */
|
||||
} cy_timer_trigger_type_t ;
|
||||
|
||||
/** \} group_abstraction_rtos_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_rtos_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The type of a function that is the entry point for a thread
|
||||
*
|
||||
* @param[in] arg the argument passed from the thread create call to the entry function
|
||||
*
|
||||
* \ingroup group_abstraction_rtos_threads
|
||||
*/
|
||||
typedef void (*cy_thread_entry_fn_t)(cy_thread_arg_t arg) ;
|
||||
|
||||
/**
|
||||
* The callback function to be called by a timeer
|
||||
* The callback function to be called by a timer
|
||||
*
|
||||
* \ingroup group_abstraction_rtos_timer
|
||||
*/
|
||||
typedef void (*cy_timer_callback_t)(cy_timer_callback_arg_t arg);
|
||||
|
||||
/** \} group_abstraction_rtos_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_abstraction_rtos_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return the last error from the RTOS.
|
||||
*
|
||||
|
@ -185,11 +143,18 @@ typedef void (*cy_timer_callback_t)(cy_timer_callback_arg_t arg);
|
|||
* from the last RTOS abstraction layer that returned CY_RTOS_GENERAL_ERROR.
|
||||
*
|
||||
* @return RTOS specific error code.
|
||||
*
|
||||
* \ingroup group_abstraction_rtos_common
|
||||
*/
|
||||
extern cy_rtos_error_t cy_rtos_last_error();
|
||||
|
||||
/*********************************************** Threads **********************************************/
|
||||
|
||||
/*
|
||||
*
|
||||
* \ingroup group_abstraction_rtos_threads
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Create a thread with specific thread argument.
|
||||
*
|
||||
|
@ -281,8 +246,15 @@ extern cy_rslt_t cy_rtos_get_thread_state(cy_thread_t *thread, cy_thread_state_t
|
|||
*/
|
||||
extern cy_rslt_t cy_rtos_join_thread(cy_thread_t *thread);
|
||||
|
||||
/** \} group_abstraction_rtos_threads */
|
||||
|
||||
/*********************************************** Mutexes **********************************************/
|
||||
|
||||
/**
|
||||
* \ingroup group_abstraction_rtos_mutex
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Create a mutex.
|
||||
*
|
||||
* This is basically a binary mutex which can be used to synchronize between threads
|
||||
|
@ -334,8 +306,15 @@ extern cy_rslt_t cy_rtos_set_mutex(cy_mutex_t *mutex);
|
|||
*/
|
||||
extern cy_rslt_t cy_rtos_deinit_mutex(cy_mutex_t *mutex);
|
||||
|
||||
/** \} group_abstraction_rtos_mutex */
|
||||
|
||||
/*********************************************** Semaphores **********************************************/
|
||||
|
||||
/**
|
||||
* \ingroup group_abstraction_rtos_semaphore
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a semaphore
|
||||
*
|
||||
|
@ -388,8 +367,15 @@ extern cy_rslt_t cy_rtos_set_semaphore(cy_semaphore_t *semaphore, bool in_isr);
|
|||
*/
|
||||
extern cy_rslt_t cy_rtos_deinit_semaphore(cy_semaphore_t *semaphore);
|
||||
|
||||
/** \} group_abstraction_rtos_semaphore */
|
||||
|
||||
/*********************************************** Events **********************************************/
|
||||
|
||||
/**
|
||||
* \ingroup group_abstraction_rtos_event
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Create an event.
|
||||
*
|
||||
* This is an event which can be used to signal a set of threads
|
||||
|
@ -467,8 +453,15 @@ extern cy_rslt_t cy_rtos_waitbits_event(cy_event_t *event, uint32_t *bits, bool
|
|||
*/
|
||||
extern cy_rslt_t cy_rtos_deinit_event(cy_event_t *event);
|
||||
|
||||
/** \} group_abstraction_rtos_event */
|
||||
|
||||
/*********************************************** Queues **********************************************/
|
||||
|
||||
/**
|
||||
* \ingroup group_abstraction_rtos_queue
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Create a queue.
|
||||
*
|
||||
* This is a queue of data where entries are placed on the back of the queue
|
||||
|
@ -561,8 +554,15 @@ extern cy_rslt_t cy_rtos_reset_queue(cy_queue_t *queue);
|
|||
*/
|
||||
extern cy_rslt_t cy_rtos_deinit_queue(cy_queue_t *queue);
|
||||
|
||||
/** \} group_abstraction_rtos_queue */
|
||||
|
||||
/*********************************************** Timers **********************************************/
|
||||
|
||||
/**
|
||||
* \ingroup group_abstraction_rtos_timer
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Create a new timer.
|
||||
*
|
||||
* This function intializes a timer object. @note The timer is
|
||||
|
@ -617,8 +617,15 @@ extern cy_rslt_t cy_rtos_is_running_timer(cy_timer_t *timer, bool *state);
|
|||
*/
|
||||
extern cy_rslt_t cy_rtos_deinit_timer(cy_timer_t *timer);
|
||||
|
||||
/** \} group_abstraction_rtos_timer */
|
||||
|
||||
/*********************************************** Time **********************************************/
|
||||
|
||||
/**
|
||||
* \ingroup group_abstraction_rtos_time
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Gets time in milliseconds since RTOS start.
|
||||
*
|
||||
* @note Since this is only 32 bits, it will roll over every 49 days, 17 hours, 2 mins, 47.296 seconds
|
||||
|
@ -642,9 +649,7 @@ extern cy_rslt_t cy_rtos_get_time(cy_time_t *tval);
|
|||
*/
|
||||
extern cy_rslt_t cy_rtos_delay_milliseconds(cy_time_t num_ms);
|
||||
|
||||
/** \} group_abstraction_rtos_functions */
|
||||
|
||||
/** @} */
|
||||
/** \} group_abstraction_rtos_timer */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
|
@ -32,7 +32,9 @@
|
|||
* information about whether something succeeded or details about any issues
|
||||
* that were detected.
|
||||
*
|
||||
* \defgroup group_result_macros Macros
|
||||
* \defgroup group_result_fields Fields
|
||||
* \defgroup group_result_modules Modules
|
||||
* \defgroup group_result_severity Severity
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -43,11 +45,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_result_macros
|
||||
* \{
|
||||
*/
|
||||
/** Provides the result of an operation as a structured bitfield */
|
||||
typedef uint32_t cy_rslt_t;
|
||||
|
||||
/** Result value indicating success */
|
||||
#define CY_RSLT_SUCCESS ((cy_rslt_t)0x00000000U)
|
||||
|
||||
/** \cond INTERNAL */
|
||||
/** Mask for the bit at position "x" */
|
||||
#define CY_BIT_MASK(x) ((1U << (x)) - 1U)
|
||||
|
||||
|
@ -71,14 +75,13 @@ extern "C" {
|
|||
/** Mask for the result type */
|
||||
#define CY_RSLT_TYPE_MASK CY_BIT_MASK(CY_RSLT_TYPE_WIDTH)
|
||||
|
||||
/** Informational-only result status */
|
||||
#define CY_RSLT_TYPE_INFO (0U)
|
||||
/** Warning result */
|
||||
#define CY_RSLT_TYPE_WARNING (1U)
|
||||
/** Error result */
|
||||
#define CY_RSLT_TYPE_ERROR (2U)
|
||||
/** Fatal error result */
|
||||
#define CY_RSLT_TYPE_FATAL (3U)
|
||||
/** \endcond */
|
||||
|
||||
/**
|
||||
* \addtogroup group_result_fields
|
||||
* \{
|
||||
* Utlity macros for constructing result values and extracting individual fields from existing results.
|
||||
*/
|
||||
|
||||
/** Get the value of the result code field */
|
||||
#define CY_RSLT_GET_CODE(x) (((x) >> CY_RSLT_CODE_POSITION) & CY_RSLT_CODE_MASK)
|
||||
|
@ -87,45 +90,60 @@ extern "C" {
|
|||
/** Get the value of the module identifier field */
|
||||
#define CY_RSLT_GET_MODULE(x) (((x) >> CY_RSLT_MODULE_POSITION) & CY_RSLT_MODULE_MASK)
|
||||
|
||||
|
||||
/**** DRIVER Module codes: 0x0000 - 0x00FF ****/
|
||||
/** Base identifier for peripheral driver library */
|
||||
#define CY_RSLT_MODULE_DRIVERS_PDL_BASE (0x0000U)
|
||||
/** Base identifier for peripheral driver library */
|
||||
#define CY_RSLT_MODULE_DRIVERS_WHD_BASE (0x0080U)
|
||||
|
||||
/**** ABSTRACTION Module codes: 0x0100 - 0x01FF ****/
|
||||
/** Base identifier for chip support modules */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_HAL_BASE (0x0100U)
|
||||
/** Base identifier for board support modules */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_BSP (0x0180U)
|
||||
/** Base identifier for file system modules */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_FS (0x0181U)
|
||||
/** Base identifier for resource abstraction modules */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_RESOURCE (0x0182U)
|
||||
/** Base identifier for rtos abstraction modules */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_OS (0x0183U)
|
||||
/** Base identifier for environment abstraction modules */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_ENV (0x0184U)
|
||||
|
||||
/** Middleware Module codes: 0x0200 - 0x02FF */
|
||||
#define CY_RSLT_MODULE_MIDDLEWARE_BASE (0x0200U)
|
||||
|
||||
|
||||
|
||||
/** Provides the result of an operation as a structured bitfield */
|
||||
typedef uint32_t cy_rslt_t;
|
||||
|
||||
/** Result value indicating success */
|
||||
#define CY_RSLT_SUCCESS ((cy_rslt_t)0x00000000U)
|
||||
|
||||
/** Create a result value from the specified type, module, and result code */
|
||||
#define CY_RSLT_CREATE(type, module, code) \
|
||||
((((module) & CY_RSLT_MODULE_MASK) << CY_RSLT_MODULE_POSITION) | \
|
||||
(((code) & CY_RSLT_CODE_MASK) << CY_RSLT_CODE_POSITION) | \
|
||||
(((type) & CY_RSLT_TYPE_MASK) << CY_RSLT_TYPE_POSITION))
|
||||
|
||||
/** \} group_result_macros */
|
||||
/** \} group_result_fields */
|
||||
|
||||
/**
|
||||
* \addtogroup group_result_severity
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Informational-only result */
|
||||
#define CY_RSLT_TYPE_INFO (0U)
|
||||
/** Warning result */
|
||||
#define CY_RSLT_TYPE_WARNING (1U)
|
||||
/** Error result */
|
||||
#define CY_RSLT_TYPE_ERROR (2U)
|
||||
/** Fatal error result */
|
||||
#define CY_RSLT_TYPE_FATAL (3U)
|
||||
|
||||
/** \} group_result_severity */
|
||||
|
||||
/**
|
||||
* \addtogroup group_result_modules
|
||||
* \{
|
||||
* Defines codes to identify the module from which an error originated.
|
||||
* For some large libraries, a range of module codes is defined here;
|
||||
* see the library documentation for values corresonding to individual modules.
|
||||
*/
|
||||
/**** DRIVER Module codes: 0x0000 - 0x00FF ****/
|
||||
/** Base identifier for peripheral driver library modules (0x0000 - 0x007F) */
|
||||
#define CY_RSLT_MODULE_DRIVERS_PDL_BASE (0x0000U)
|
||||
/** Base identifier for wireless host driver library modules (0x0080 - 0x00FF) */
|
||||
#define CY_RSLT_MODULE_DRIVERS_WHD_BASE (0x0080U)
|
||||
|
||||
/** Base identifier for HAL modules (0x0100 - 0x017F) */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_HAL_BASE (0x0100U)
|
||||
/** Module identifier for board support package */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_BSP (0x0180U)
|
||||
/** Module identifier for file system abstraction */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_FS (0x0181U)
|
||||
/** Module identifier for resource abstraction */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_RESOURCE (0x0182U)
|
||||
/** Module identifier for rtos abstraction */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_OS (0x0183U)
|
||||
/** Base identifier for environment abstraction modules (0x0184 - 0x01FF) */
|
||||
#define CY_RSLT_MODULE_ABSTRACTION_ENV (0x0184U)
|
||||
|
||||
/** Base identifier for Middleware module codes (0x0200 - 0x02FF) */
|
||||
#define CY_RSLT_MODULE_MIDDLEWARE_BASE (0x0200U)
|
||||
|
||||
/** \} group_result_modules */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -35,11 +35,7 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal
|
||||
* \{
|
||||
* TODO: high-level HAL description
|
||||
* update hal/include/cyhal.h to change this text
|
||||
* \} group_hal
|
||||
* \defgroup group_hal HAL Drivers
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -68,6 +64,3 @@
|
|||
#include "cyhal_uart.h"
|
||||
#include "cyhal_usb_dev.h"
|
||||
#include "cyhal_wdt.h"
|
||||
|
||||
/** \} group_hal */
|
||||
|
||||
|
|
|
@ -31,11 +31,8 @@
|
|||
* \{
|
||||
* High level interface for interacting with the Cypress ADC.
|
||||
*
|
||||
* \defgroup group_hal_adc_macros Macros
|
||||
* \defgroup group_hal_adc_functions ADC Functions
|
||||
* \defgroup group_hal_adc_channel_functions ADC Channel Functions
|
||||
* \defgroup group_hal_adc_data_structures Data Structures
|
||||
* \defgroup group_hal_adc_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -50,11 +47,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_adc_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Maximum value that the ADC can return */
|
||||
#define CYHAL_ADC_MAX_VALUE 0xFFFF
|
||||
|
||||
|
@ -67,8 +59,6 @@ extern "C" {
|
|||
/** No channels available */
|
||||
#define CYHAL_ADC_RSLT_NO_CHANNELS (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_ADC, 3))
|
||||
|
||||
/** \} group_hal_adc_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_adc_functions
|
||||
|
|
|
@ -1,158 +0,0 @@
|
|||
/***************************************************************************//**
|
||||
* \file cyhal_comp.h
|
||||
*
|
||||
* Provides a high level interface for interacting with the Cypress Comparator.
|
||||
* This interface abstracts out the chip specific details.
|
||||
* If any chip specific functionality is necessary, or performance is critical,
|
||||
* the low level functions can be used directly.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_comp COMP (Comparator)
|
||||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress Comparator.
|
||||
*
|
||||
* \defgroup group_hal_comp_macros Macros
|
||||
* \defgroup group_hal_comp_functions Functions
|
||||
* \defgroup group_hal_comp_data_structures Data Structures
|
||||
* \defgroup group_hal_comp_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "cy_result.h"
|
||||
#include "cyhal_hw_types.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_comp_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Comparator interrupt triggers */
|
||||
typedef enum {
|
||||
CYHAL_COMP_IRQ_NONE, //!< Interrupts disabled
|
||||
CYHAL_COMP_IRQ_RISE, //!< Rising edge
|
||||
CYHAL_COMP_IRQ_FALL, //!< Falling edge
|
||||
} cyhal_comp_irq_event_t;
|
||||
|
||||
/** Comparator power options */
|
||||
typedef enum {
|
||||
CYHAL_COMP_POWER_OFF, //!< Block is turned off
|
||||
CYHAL_COMP_POWER_LOW, //!< Block runs in low power/speed mode
|
||||
CYHAL_COMP_POWER_MEDIUM, //!< Block runs in medium power/speed mode
|
||||
CYHAL_COMP_POWER_HIGH, //!< Block runs in high power/speed mode
|
||||
} cyhal_comp_power_t;
|
||||
|
||||
/** Comparator output modes */
|
||||
typedef enum {
|
||||
CYHAL_COMP_OUTPUT_PULSE, //!< Pulse output
|
||||
CYHAL_COMP_OUTPUT_DIRECT, //!< Level output directly
|
||||
CYHAL_COMP_OUTPUT_SYNC, //!< Level output after synchronous edge detection
|
||||
} cyhal_comp_output_t;
|
||||
|
||||
/** \} group_hal_comp_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_comp_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Configuration options for the comparator */
|
||||
typedef struct
|
||||
{
|
||||
cyhal_comp_power_t power; //!< Power mode to operate in (0=off, 1=low, 2=medium, 3=high)
|
||||
cyhal_comp_output_t output; //!< Output configuration (0=pulse, 1=direct, 2=sync)
|
||||
bool hysteresis; //!< Should this use hysteresis
|
||||
bool deepsleep; //!< Does this need to operate in deepsleep
|
||||
} cyhal_comp_config_t;
|
||||
|
||||
/** Handler for comparator interrupts */
|
||||
typedef void (*cyhal_comp_irq_handler_t)(void *handler_arg, cyhal_comp_irq_event_t event);
|
||||
|
||||
/** \} group_hal_comp_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_comp_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the comparator peripheral.
|
||||
*
|
||||
* @param[out] obj The comparator object
|
||||
* @param[in] vinp The vplus pin
|
||||
* @param[in] vinm The vminus pin
|
||||
* @param[in] vout The vout pin
|
||||
* @return The status of the init request
|
||||
*/
|
||||
cy_rslt_t cyhal_comp_init(cyhal_comp_t *obj, cyhal_gpio_t vinp, cyhal_gpio_t vinm, cyhal_gpio_t vout);
|
||||
|
||||
/** Release the comparator peripheral.
|
||||
*
|
||||
* @param[in,out] obj The comparator object
|
||||
*/
|
||||
void cyhal_comp_free(cyhal_comp_t *obj);
|
||||
|
||||
/** Reconfigure the comparator object
|
||||
*
|
||||
* @param[in,out] obj The comparator object
|
||||
* @param[in] cfg Configuration to apply to the comparator
|
||||
* @return The status of the power request
|
||||
*/
|
||||
cy_rslt_t cyhal_comp_configure(cyhal_comp_t *obj, const cyhal_comp_config_t cfg);
|
||||
|
||||
/** Gets the result of the comparator object
|
||||
*
|
||||
* @param[in] obj The comparator object
|
||||
* @return The comparator output state
|
||||
*/
|
||||
bool cyhal_comp_output(cyhal_comp_t *obj);
|
||||
|
||||
/** Register/clear an interrupt handler for the comparator toggle IRQ event
|
||||
*
|
||||
* @param[in] obj The comparator object
|
||||
* @param[in] handler The function to call when the specified event happens
|
||||
* @param[in] handler_arg Generic argument that will be provided to the handler when called
|
||||
*/
|
||||
void cyhal_comp_register_irq(cyhal_comp_t *obj, cyhal_comp_irq_handler_t handler, void *handler_arg);
|
||||
|
||||
/** Enable or Disable the comparator IRQ
|
||||
*
|
||||
* @param[in] obj The comparator object
|
||||
* @param[in] event The comparator IRQ event
|
||||
* @param[in] enable True to turn on interrupts, False to turn off
|
||||
*/
|
||||
void cyhal_cyhal_comp_irq_enable(cyhal_comp_t *obj, cyhal_comp_irq_event_t event, bool enable);
|
||||
|
||||
/** \} group_hal_comp_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} group_hal_comp */
|
|
@ -31,10 +31,6 @@
|
|||
* \{
|
||||
* High level interface for interacting with the Cypress CRC.
|
||||
*
|
||||
* \defgroup group_hal_crc_macros Macros
|
||||
* \defgroup group_hal_crc_functions Functions
|
||||
* \defgroup group_hal_crc_data_structures Data Structures
|
||||
* \defgroup group_hal_crc_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -49,23 +45,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_crc_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Invalid argument */
|
||||
#define CYHAL_CRC_RSLT_ERR_BAD_ARGUMENT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_CRC, 0))
|
||||
|
||||
/** \} group_hal_crc_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_crc_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** CRC algorithm parameters */
|
||||
/** @brief CRC algorithm parameters */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t width; //!< Bit width of the CRC
|
||||
|
@ -82,14 +65,6 @@ typedef struct
|
|||
bool remReverse; //!< If 1, the remainder is reversed. If 0, it is not.
|
||||
} crc_algorithm_t;
|
||||
|
||||
/** \} group_hal_crc_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_crc_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the CRC generator. This function reserves the CRYPTO block for CRC calculations.
|
||||
*
|
||||
* @param[out] obj The CRC generator object
|
||||
|
@ -131,8 +106,6 @@ cy_rslt_t cyhal_crc_compute(const cyhal_crc_t *obj, const uint8_t *data, size_t
|
|||
*/
|
||||
cy_rslt_t cyhal_crc_finish(const cyhal_crc_t *obj, uint32_t *crc);
|
||||
|
||||
/** \} group_hal_crc_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
* \{
|
||||
* High level interface for interacting with the Cypress DAC.
|
||||
*
|
||||
* \defgroup group_hal_dac_macros Macros
|
||||
* \defgroup group_hal_dac_functions Functions
|
||||
* \defgroup group_hal_dac_data_structures Data Structures
|
||||
* \defgroup group_hal_dac_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -49,24 +45,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_dac_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Bad argument */
|
||||
#define CYHAL_DAC_RSLT_BAD_ARGUMENT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_DAC, 0))
|
||||
/** Failed to initialize DAC */
|
||||
#define CYHAL_DAC_RSLT_FAILED_INIT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_DAC, 1))
|
||||
|
||||
/** \} group_hal_adc_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_dac_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the DAC peripheral
|
||||
*
|
||||
* Configures the pin used by dac.
|
||||
|
@ -102,8 +85,6 @@ void cyhal_dac_write(const cyhal_dac_t *obj, uint16_t value);
|
|||
*/
|
||||
uint16_t cyhal_dac_read(cyhal_dac_t *obj);
|
||||
|
||||
/** \} group_hal_dac_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,162 +0,0 @@
|
|||
/***************************************************************************//**
|
||||
* \file cyhal_dma.h
|
||||
*
|
||||
* \brief
|
||||
* Provides a high level interface for interacting with the Cypress DMA.
|
||||
* This interface abstracts out the chip specific details. If any chip specific
|
||||
* functionality is necessary, or performance is critical the low level functions
|
||||
* can be used directly.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_dma DMA (Direct Memory Access)
|
||||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress DMA.
|
||||
*
|
||||
* \defgroup group_hal_dma_macros Macros
|
||||
* \defgroup group_hal_dma_functions Functions
|
||||
* \defgroup group_hal_dma_data_structures Data Structures
|
||||
* \defgroup group_hal_dma_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "cy_result.h"
|
||||
#include "cyhal_hw_types.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_dma_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Direction for DMA transfers */
|
||||
typedef enum
|
||||
{
|
||||
CYHAL_DMA_DIRECTION_MEM2MEM, //!< Memory to memory
|
||||
CYHAL_DMA_DIRECTION_MEM2PERIPH, //!< Memory to peripheral
|
||||
CYHAL_DMA_DIRECTION_PERIPH2MEM, //!< Peripheral to memory
|
||||
} cyhal_dma_direction_t;
|
||||
|
||||
/** DMA interrupt triggers */
|
||||
typedef enum {
|
||||
/** TODO: Fill in */
|
||||
CYHAL_DMA_TBD,
|
||||
} cyhal_dma_irq_event_t;
|
||||
|
||||
/** \} group_hal_dma_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_dma_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initial configuration of a DMA channel */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t src_addr; //!< source address
|
||||
int8_t src_increment; //!< source address auto increment amount
|
||||
uint32_t dst_addr; //!< destination address
|
||||
int8_t dst_increment; //!< destination address auto increment amount
|
||||
uint32_t length; //!< length of data to be transferred
|
||||
uint8_t beat_size; //!< beat size to be set (8, 16, 32)
|
||||
//cyhal_source_t trigger_source; //!< Source signal for initiating the DMA transfer
|
||||
} cyhal_dma_cfg_t;
|
||||
|
||||
/** Handler for DMA interrupts */
|
||||
typedef void (*cyhal_dma_irq_handler_t)(void *handler_arg, cyhal_dma_irq_event_t event);
|
||||
|
||||
/** \} group_hal_dma_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_dma_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the DMA peripheral
|
||||
*
|
||||
* @param[out] obj The DMA object to initialize
|
||||
* @param[in] priority The priority of this DMA operation relative to others
|
||||
* @param[in] direction The direction memory is copied
|
||||
* @return The status of the init request
|
||||
*/
|
||||
cy_rslt_t cyhal_dma_init(cyhal_dma_t *obj, uint8_t priority, cyhal_dma_direction_t direction);
|
||||
|
||||
/** Release the DMA object
|
||||
*
|
||||
* @param[in,out] obj The DMA object
|
||||
*/
|
||||
void cyhal_dma_free(cyhal_dma_t *obj);
|
||||
|
||||
/** Setup a DMA descriptor for specified resource
|
||||
*
|
||||
* @param[in] obj The DMA object
|
||||
* @param[in] cfg Configuration prameters for the transfer
|
||||
* @return The status of the setup_transfer request
|
||||
*/
|
||||
cy_rslt_t cyhal_dma_setup_transfer(cyhal_dma_t *obj, const cyhal_dma_cfg_t *cfg);
|
||||
|
||||
/** Start DMA transfer
|
||||
*
|
||||
* Kick starts transfer in DMA channel with specified channel id
|
||||
* @param[in] obj The DMA object
|
||||
* @return The status of the start_transfer request
|
||||
*/
|
||||
cy_rslt_t cyhal_dma_start_transfer(cyhal_dma_t *obj);
|
||||
|
||||
/** DMA channel busy check
|
||||
*
|
||||
* To check whether DMA channel is busy with a job or not
|
||||
* @param[in] obj The DMA object
|
||||
* @return Is the DMA object being used
|
||||
*/
|
||||
bool cyhal_dma_busy(cyhal_dma_t *obj);
|
||||
|
||||
/** The DMA interrupt handler registration
|
||||
*
|
||||
* @param[in] obj The DMA object
|
||||
* @param[in] handler The callback handler which will be invoked when the interrupt fires
|
||||
* @param[in] handler_arg Generic argument that will be provided to the handler when called
|
||||
*/
|
||||
void cyhal_dma_register_irq(cyhal_dma_t *obj, cyhal_dma_irq_handler_t handler, void *handler_arg);
|
||||
|
||||
/** Configure DMA interrupt enablement.
|
||||
*
|
||||
* @param[in] obj The DMA object
|
||||
* @param[in] event The DMA IRQ type
|
||||
* @param[in] enable True to turn on interrupts, False to turn off
|
||||
*/
|
||||
void cyhal_dma_irq_enable(cyhal_dma_t *obj, cyhal_dma_irq_event_t event, bool enable);
|
||||
|
||||
/** \} group_hal_dma_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} group_hal_dma */
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* Flash HAL high-level description
|
||||
*
|
||||
* \defgroup group_hal_flash_macros Macros
|
||||
* \defgroup group_hal_flash_functions Functions
|
||||
* \defgroup group_hal_flash_data_structures Data Structures
|
||||
* \defgroup group_hal_flash_enums Enumerated Types
|
||||
*/
|
||||
|
||||
|
||||
|
@ -50,22 +45,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_flash_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Invalid argument */
|
||||
#define CYHAL_FLASH_RSLT_ERR_ADDRESS (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_FLASH, 0))
|
||||
|
||||
/** \} group_hal_flash_macros */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_flash_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Information about a single block of flash memory */
|
||||
/** @brief Information about a single block of flash memory */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t start_address; //!< Start address of the memory
|
||||
|
@ -75,25 +58,17 @@ typedef struct
|
|||
uint8_t erase_value; //!< The flash erase value
|
||||
} cyhal_flash_block_info_t;
|
||||
|
||||
/** Information about all of the blocks of flash memory */
|
||||
/** @brief Information about all of the blocks of flash memory */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t block_count; //!< The number of distinct flash blocks
|
||||
const cyhal_flash_block_info_t *blocks; //!< Array of the distinct flash blocks
|
||||
} cyhal_flash_info_t;
|
||||
|
||||
/** \} group_hal_flash_data_structures */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Functions
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_flash_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the flash_t object for access to flash through the HAL
|
||||
*
|
||||
* @param[out] obj The flash object
|
||||
|
@ -215,10 +190,6 @@ cy_rslt_t cyhal_flash_start_program(cyhal_flash_t *obj, uint32_t address, const
|
|||
*/
|
||||
bool cyhal_flash_is_operation_complete(cyhal_flash_t *obj);
|
||||
|
||||
/** \} group_hal_flash_functions */
|
||||
|
||||
/** \} group_hal_flash_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress GPIO.
|
||||
*
|
||||
* \defgroup group_hal_gpio_macros Macros
|
||||
* \defgroup group_hal_gpio_functions Functions
|
||||
* \defgroup group_hal_gpio_data_structures Data Structures
|
||||
* \defgroup group_hal_gpio_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -52,22 +47,9 @@ extern "C" {
|
|||
* Defines
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_gpio_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Integer representation of no connect pin (required to exist in all BSPs) */
|
||||
#define CYHAL_NC_PIN_VALUE ((cyhal_gpio_t)0xFFFFFFFF)
|
||||
|
||||
/** \} group_hal_gpio_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_gpio_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Enumerations
|
||||
*******************************************************************************/
|
||||
|
@ -99,25 +81,9 @@ typedef enum {
|
|||
CYHAL_GPIO_DRIVE_PULLUPDOWN, /**< Pull-up and pull-down resistors */
|
||||
} cyhal_gpio_drive_mode_t;
|
||||
|
||||
/** \} group_hal_gpio_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_gpio_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** GPIO callback function type */
|
||||
typedef void (*cyhal_gpio_event_callback_t)(void *callback_arg, cyhal_gpio_event_t event);
|
||||
|
||||
/** \} group_hal_gpio_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_gpio_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Functions
|
||||
*******************************************************************************/
|
||||
|
@ -186,8 +152,6 @@ void cyhal_gpio_register_callback(cyhal_gpio_t pin, cyhal_gpio_event_callback_t
|
|||
*/
|
||||
void cyhal_gpio_enable_event(cyhal_gpio_t pin, cyhal_gpio_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_gpio_functions */
|
||||
|
||||
/*******************************************************************************
|
||||
* Backward compatibility macro. The following code is DEPRECATED and must
|
||||
* not be used in new projects
|
||||
|
|
|
@ -23,15 +23,9 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_hw_resources PSoC 6 Hardware Resources
|
||||
* \addtogroup group_hal_psoc6_hw_types
|
||||
* \ingroup group_hal_psoc6
|
||||
* \{
|
||||
* Struct definitions for configuration resources in the PDL.
|
||||
*
|
||||
* \defgroup group_hal_hw_resources_macros Macros
|
||||
* \defgroup group_hal_hw_resources_functions Functions
|
||||
* \defgroup group_hal_hw_resources_data_structures Data Structures
|
||||
* \defgroup group_hal_hw_resources_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -40,11 +34,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_hw_resources_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/* NOTE: Any changes made to this enum must also be made to the hardware manager resource tracking */
|
||||
/** Resource types that the hardware manager supports */
|
||||
typedef enum
|
||||
|
@ -74,15 +63,9 @@ typedef enum
|
|||
CYHAL_RSC_INVALID, /*!< Placeholder for invalid type */
|
||||
} cyhal_resource_t;
|
||||
|
||||
/** \} group_hal_hw_resources_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_hw_resources_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Represents a particular instance of a resource on the chip */
|
||||
* @brief Represents a particular instance of a resource on the chip
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
cyhal_resource_t type; //!< The resource block type
|
||||
|
@ -93,10 +76,8 @@ typedef struct
|
|||
uint8_t channel_num;
|
||||
} cyhal_resource_inst_t;
|
||||
|
||||
/** \} group_hal_hw_resources_data_structures */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** \} group_hal_hw_resources */
|
||||
/** \} group_hal_psoc6_hw_types */
|
||||
|
|
|
@ -23,13 +23,11 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_hw_types PSoC 6 Hardware Types
|
||||
* \addtogroup group_hal_psoc6_hw_types Implementation-defined types
|
||||
* \ingroup group_hal_psoc6
|
||||
* \{
|
||||
* Struct definitions for configuration resources in the PDL.
|
||||
*
|
||||
* \defgroup group_hal_hw_types_macros Macros
|
||||
* \defgroup group_hal_hw_types_data_structures Data Structures
|
||||
* Aliases for types which are part of the public HAL interface but whose representations are
|
||||
* need to vary per HAL implementation
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -47,16 +45,16 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_hw_types_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Default priority for interrupts */
|
||||
#ifndef CYHAL_ISR_PRIORITY_DEFAULT
|
||||
/** Default priority for interrupts */
|
||||
#define CYHAL_ISR_PRIORITY_DEFAULT (7)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \cond INTERNAL
|
||||
*/
|
||||
|
||||
#define CYHAL_CRC_IMPL_HEADER "cyhal_crc_impl.h" //!< Implementation specific header for CRC
|
||||
#define CYHAL_GPIO_IMPL_HEADER "cyhal_gpio_impl.h" //!< Implementation specific header for GPIO
|
||||
#define CYHAL_PWM_IMPL_HEADER "cyhal_pwm_impl.h" //!< Implementation specific header for PWM
|
||||
|
@ -64,33 +62,50 @@ extern "C" {
|
|||
#define CYHAL_TIMER_IMPL_HEADER "cyhal_timer_impl.h" //!< Implementation specific header for Timer
|
||||
#define CYHAL_TRNG_IMPL_HEADER "cyhal_trng_impl.h" //!< Implementation specific header for TRNG
|
||||
|
||||
/** \} group_hal_hw_types_macros */
|
||||
/** \endcond */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_hw_types_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
typedef uint32_t cyhal_source_t; //!< Routable signal source
|
||||
typedef uint32_t cyhal_dest_t; //!< Routable signal destination
|
||||
|
||||
/** Callbacks for Sleep and Deepsleep APIs */
|
||||
#define cyhal_system_callback_t cy_stc_syspm_callback_t
|
||||
|
||||
/** Available clock divider types */
|
||||
typedef cy_en_divider_types_t cyhal_clock_divider_types_t;
|
||||
|
||||
/** Clock divider object */
|
||||
/** Divider for CM4, CM0 and Peri clock. Supports values between [1, 256] */
|
||||
typedef uint16_t cyhal_system_divider_t;
|
||||
|
||||
/** Enum for clock type to configure. HFCLKs are configured using different APIs and does not using this enum */
|
||||
typedef enum
|
||||
{
|
||||
CYHAL_SYSTEM_CLOCK_CM4,
|
||||
CYHAL_SYSTEM_CLOCK_CM0,
|
||||
CYHAL_SYSTEM_CLOCK_PERI,
|
||||
} cyhal_system_clock_t;
|
||||
|
||||
/** @brief Clock divider object */
|
||||
typedef struct {
|
||||
cyhal_clock_divider_types_t div_type;
|
||||
uint8_t div_num;
|
||||
} cyhal_clock_divider_t;
|
||||
|
||||
/** Event callback data object */
|
||||
/** @brief Event callback data object */
|
||||
typedef struct {
|
||||
cy_israddress callback;
|
||||
void* callback_arg;
|
||||
} cyhal_event_callback_data_t;
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_psoc6_hw_types_handle Instance Handles
|
||||
* \{
|
||||
* Structs which retain data which needs to persist across HAL API calls. From the perspective of the
|
||||
* generic HAL interface, these are opaque; the contents are specific to this implementation.
|
||||
*/
|
||||
|
||||
/** ADC object */
|
||||
/** @brief ADC object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXS40PASS_SAR
|
||||
SAR_Type* base;
|
||||
|
@ -105,7 +120,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_adc_t;
|
||||
|
||||
/** ADC channel object */
|
||||
/** @brief ADC channel object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXS40PASS_SAR
|
||||
cyhal_adc_t* adc;
|
||||
|
@ -116,7 +131,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_adc_channel_t;
|
||||
|
||||
/** Comparator object */
|
||||
/** @brief Comparator object */
|
||||
typedef struct {
|
||||
#if defined(CY_IP_MXLPCOMP_INSTANCES) || defined(PASS_NR_CTBS)
|
||||
/* TODO: define */
|
||||
|
@ -126,7 +141,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_comp_t;
|
||||
|
||||
/** CRC object */
|
||||
/** @brief CRC object */
|
||||
typedef struct {
|
||||
#if defined(CY_IP_MXCRYPTO_INSTANCES) || defined(CPUSS_CRYPTO_PRESENT)
|
||||
CRYPTO_Type* base;
|
||||
|
@ -135,7 +150,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_crc_t;
|
||||
|
||||
/** DAC object */
|
||||
/** @brief DAC object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXS40PASS_CTDAC
|
||||
CTDAC_Type* base;
|
||||
|
@ -146,7 +161,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_dac_t;
|
||||
|
||||
/** DMA object */
|
||||
/** @brief DMA object */
|
||||
typedef struct {
|
||||
#if defined(CY_IP_M4CPUSS_DMAC_INSTANCES) || defined(CY_IP_M4CPUSS_DMA_INSTANCES)
|
||||
cyhal_resource_inst_t resource;
|
||||
|
@ -155,12 +170,12 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_dma_t;
|
||||
|
||||
/** Flash object */
|
||||
/** @brief Flash object */
|
||||
typedef struct {
|
||||
void *empty;
|
||||
} cyhal_flash_t;
|
||||
|
||||
/** I2C object */
|
||||
/** @brief I2C object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXSCB
|
||||
CySCB_Type* base;
|
||||
|
@ -184,7 +199,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_i2c_t;
|
||||
|
||||
/** I2S object */
|
||||
/** @brief I2S object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXAUDIOSS_INSTANCES
|
||||
/* TODO: define */
|
||||
|
@ -194,7 +209,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_i2s_t;
|
||||
|
||||
/** LPTIMER object */
|
||||
/** @brief LPTIMER object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXS40SRSS_MCWDT_INSTANCES
|
||||
MCWDT_STRUCT_Type *base;
|
||||
|
@ -205,7 +220,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_lptimer_t;
|
||||
|
||||
/** OpAmp object */
|
||||
/** @brief OpAmp object */
|
||||
typedef struct {
|
||||
#ifdef PASS_NR_CTBS
|
||||
/* TODO: define */
|
||||
|
@ -215,7 +230,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_opamp_t;
|
||||
|
||||
/** PDM-PCM object */
|
||||
/** @brief PDM-PCM object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXAUDIOSS_INSTANCES
|
||||
/* TODO: define */
|
||||
|
@ -225,7 +240,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_pdm_pcm_t;
|
||||
|
||||
/** PWM object */
|
||||
/** @brief PWM object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXTCPWM
|
||||
TCPWM_Type* base;
|
||||
|
@ -240,7 +255,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_pwm_t;
|
||||
|
||||
/** SMIF object */
|
||||
/** @brief SMIF object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXSMIF
|
||||
SMIF_Type* base;
|
||||
|
@ -260,7 +275,7 @@ typedef struct {
|
|||
#endif /* ifdef CY_IP_MXSMIF */
|
||||
} cyhal_qspi_t;
|
||||
|
||||
/** RNG object */
|
||||
/** @brief RNG object */
|
||||
typedef struct {
|
||||
#if defined(CY_IP_MXCRYPTO_INSTANCES) || defined(CPUSS_CRYPTO_PRESENT)
|
||||
CRYPTO_Type* base;
|
||||
|
@ -268,12 +283,12 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_trng_t;
|
||||
|
||||
/** RTC object */
|
||||
/** @brief RTC object */
|
||||
typedef struct {
|
||||
uint8_t placeholder;
|
||||
} cyhal_rtc_t;
|
||||
|
||||
/** SDHC object */
|
||||
/** @brief SDHC object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXSDHC
|
||||
SDHC_Type* base;
|
||||
|
@ -298,7 +313,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_sdhc_t;
|
||||
|
||||
/** SDIO object */
|
||||
/** @brief SDIO object */
|
||||
typedef struct {
|
||||
#if defined(CY_IP_MXSDHC)
|
||||
SDHC_Type* base;
|
||||
|
@ -346,7 +361,7 @@ typedef struct {
|
|||
#endif /* defined(CY_IP_MXSDHC) */
|
||||
} cyhal_sdio_t;
|
||||
|
||||
/** SPI object */
|
||||
/** @brief SPI object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXSCB
|
||||
CySCB_Type* base;
|
||||
|
@ -377,21 +392,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_spi_t;
|
||||
|
||||
/** Callbacks for Sleep and Deepsleep APIs */
|
||||
#define cyhal_system_callback_t cy_stc_syspm_callback_t
|
||||
|
||||
/** Enum for clock type to configure. HFCLKs are configured using different APIs and does not using this enum */
|
||||
typedef enum
|
||||
{
|
||||
CYHAL_SYSTEM_CLOCK_CM4,
|
||||
CYHAL_SYSTEM_CLOCK_CM0,
|
||||
CYHAL_SYSTEM_CLOCK_PERI,
|
||||
} cyhal_system_clock_t;
|
||||
|
||||
/** Divider for CM4, CM0 and Peri clock. Supports values between [1, 256] */
|
||||
typedef uint16_t cyhal_system_divider_t;
|
||||
|
||||
/** Timer object */
|
||||
/** @brief Timer object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXTCPWM
|
||||
TCPWM_Type* base;
|
||||
|
@ -409,7 +410,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_timer_t;
|
||||
|
||||
/** UART object */
|
||||
/** @brief UART object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXSCB
|
||||
CySCB_Type* base;
|
||||
|
@ -433,7 +434,7 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_uart_t;
|
||||
|
||||
/** USB Device object */
|
||||
/** @brief USB Device object */
|
||||
typedef struct {
|
||||
#ifdef CY_IP_MXUSBFS
|
||||
USBFS_Type* base;
|
||||
|
@ -451,15 +452,15 @@ typedef struct {
|
|||
#endif
|
||||
} cyhal_usb_dev_t;
|
||||
|
||||
/** WDT object */
|
||||
/** @brief WDT object */
|
||||
typedef struct {
|
||||
uint8_t placeholder;
|
||||
} cyhal_wdt_t;
|
||||
|
||||
/** \} group_hal_hw_types_data_structures */
|
||||
/** \} group_hal_psoc6_hw_types_handles */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** \} group_hal_hw_types */
|
||||
/** \} group_hal_psoc6_hw_types */
|
||||
|
|
|
@ -29,10 +29,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress Hardware Manager.
|
||||
*
|
||||
* \defgroup group_hal_hwmgr_macros Macros
|
||||
* \defgroup group_hal_hwmgr_functions Functions
|
||||
* \defgroup group_hal_hwmgr_data_structures Data Structures
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -47,11 +43,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_hwmgr_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** The requested resource type is invalid */
|
||||
#define CYHAL_HWMGR_RSLT_ERR_INVALID (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_CHIP_HWMGR, 0))
|
||||
/** The requested resource is already in use */
|
||||
|
@ -62,14 +53,6 @@ extern "C" {
|
|||
/** Attempt to free a resource that was not used */
|
||||
#define CYHAL_HWMGR_RSLT_WARN_UNUSED (CY_RSLT_CREATE(CY_RSLT_TYPE_WARNING, CYHAL_RSLT_MODULE_CHIP_HWMGR, 50))
|
||||
|
||||
/** \} group_hal_hwmgr_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_hwmgr_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initializes the hardware manager to keep track of what resources are being used.
|
||||
*
|
||||
* @return The status of the init request
|
||||
|
@ -119,8 +102,6 @@ cy_rslt_t cyhal_hwmgr_allocate_clock(cyhal_clock_divider_t* obj, cyhal_clock_div
|
|||
*/
|
||||
void cyhal_hwmgr_free_clock(cyhal_clock_divider_t* obj);
|
||||
|
||||
/** \} group_hal_hwmgr_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,10 +31,8 @@
|
|||
* \{
|
||||
* High level interface for interacting with the Cypress I2C.
|
||||
*
|
||||
* \defgroup group_hal_i2c_macros Macros
|
||||
* \defgroup group_hal_i2c_functions Functions
|
||||
* \defgroup group_hal_i2c_data_structures Data Structures
|
||||
* \defgroup group_hal_i2c_enums Enumerated Types
|
||||
* \defgroup group_hal_i2c_master Master
|
||||
* \defgroup group_hal_i2c_slave Slave
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -49,11 +47,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2c_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** The requested resource type is invalid */
|
||||
#define CYHAL_I2C_RSLT_ERR_INVALID_PIN (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_I2C, 0))
|
||||
/** Can not reach desired data rate */
|
||||
|
@ -61,14 +54,6 @@ extern "C" {
|
|||
/** Address size is not correct, should be 1 or two */
|
||||
#define CYHAL_I2C_RSLT_ERR_INVALID_ADDRESS_SIZE (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_I2C, 2))
|
||||
|
||||
/** \} group_hal_i2c_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2c_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Enum to enable/disable/report interrupt cause flags. */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -86,18 +71,10 @@ typedef enum
|
|||
CYHAL_I2C_MASTER_ERR_EVENT = 1 << 20, /* Indicates the I2C hardware has detected an error. */
|
||||
} cyhal_i2c_event_t;
|
||||
|
||||
/** \} group_hal_i2c_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2c_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Handler for I2C events */
|
||||
typedef void (*cyhal_i2c_event_callback_t)(void *callback_arg, cyhal_i2c_event_t event);
|
||||
|
||||
/** Initial I2C configuration */
|
||||
/** @brief Initial I2C configuration */
|
||||
typedef struct
|
||||
{
|
||||
bool is_slave; /* I2C mode, is the device a master or slave */
|
||||
|
@ -105,14 +82,6 @@ typedef struct
|
|||
uint32_t frequencyhal_hz; /* Frequency that the I2C bus runs at */
|
||||
} cyhal_i2c_cfg_t;
|
||||
|
||||
/** \} group_hal_i2c_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2c_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the I2C peripheral, and configures its specifieds pins. By default
|
||||
* it is setup as a Master running at 400kHz. This can be changed by calling
|
||||
* cyhal_i2c_configure().
|
||||
|
@ -141,6 +110,11 @@ void cyhal_i2c_free(cyhal_i2c_t *obj);
|
|||
*/
|
||||
cy_rslt_t cyhal_i2c_configure(cyhal_i2c_t *obj, const cyhal_i2c_cfg_t *cfg);
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2c_master
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* I2C master write
|
||||
*
|
||||
|
@ -169,6 +143,13 @@ cy_rslt_t cyhal_i2c_master_write(cyhal_i2c_t *obj, uint16_t dev_addr, const uint
|
|||
*/
|
||||
cy_rslt_t cyhal_i2c_master_read(cyhal_i2c_t *obj, uint16_t dev_addr, uint8_t *data, uint16_t size, uint32_t timeout, bool send_stop);
|
||||
|
||||
/** \} group_hal_i2c_master */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2c_slave
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* I2C slave config write buffer
|
||||
* The user needs to setup a new buffer every time (i.e. call slave_send and slave_recv every time the buffer has been used up)
|
||||
|
@ -193,6 +174,13 @@ cy_rslt_t cyhal_i2c_slave_config_write_buff(cyhal_i2c_t *obj, const uint8_t *dat
|
|||
*/
|
||||
cy_rslt_t cyhal_i2c_slave_config_read_buff(cyhal_i2c_t *obj, uint8_t *data, uint16_t size);
|
||||
|
||||
/** \} group_hal_i2c_slave */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2c_master
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Perform an i2c write using a block of data stored at the specified memory location
|
||||
*
|
||||
* @param[in] obj The I2C object
|
||||
|
@ -231,6 +219,8 @@ cy_rslt_t cyhal_i2c_master_mem_read(cyhal_i2c_t *obj, uint16_t address, uint16_t
|
|||
*/
|
||||
cy_rslt_t cyhal_i2c_master_transfer_async(cyhal_i2c_t *obj, uint16_t address, const void *tx, size_t tx_size, void *rx, size_t rx_size);
|
||||
|
||||
/** \} group_hal_i2c_master */
|
||||
|
||||
/** Abort asynchronous transfer
|
||||
*
|
||||
* This function does not perform any check - that should happen in upper layers.
|
||||
|
@ -256,8 +246,6 @@ void cyhal_i2c_register_callback(cyhal_i2c_t *obj, cyhal_i2c_event_callback_t ca
|
|||
*/
|
||||
void cyhal_i2c_enable_event(cyhal_i2c_t *obj, cyhal_i2c_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_i2c_functions */
|
||||
|
||||
/*******************************************************************************
|
||||
* Backward compatibility macro. The following code is DEPRECATED and must
|
||||
* not be used in new projects
|
||||
|
|
|
@ -1,176 +0,0 @@
|
|||
/***************************************************************************//**
|
||||
* \file cyhal_i2s.h
|
||||
*
|
||||
* \brief
|
||||
* Provides a high level interface for interacting with the Cypress I2S.
|
||||
* This interface abstracts out the chip specific details. If any chip specific
|
||||
* functionality is necessary, or performance is critical the low level functions
|
||||
* can be used directly.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2s I2S (Inter-IC Sound)
|
||||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress I2S.
|
||||
*
|
||||
* \defgroup group_hal_i2s_macros Macros
|
||||
* \defgroup group_hal_i2s_functions Functions
|
||||
* \defgroup group_hal_i2s_data_structures Data Structures
|
||||
* \defgroup group_hal_i2s_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "cy_result.h"
|
||||
#include "cyhal_hw_types.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2s_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** I2S interrupt triggers */
|
||||
typedef enum {
|
||||
/** TODO: Fill in */
|
||||
CYHAL_I2S_TBD,
|
||||
} cyhal_i2s_irq_t;
|
||||
|
||||
/** \} group_hal_i2s_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2s_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Handler for SPI interrupts */
|
||||
typedef void (*cyhal_i2s_irq_handler_t)(void *handler_arg, cyhal_i2s_irq_t event);
|
||||
|
||||
/** \} group_hal_i2s_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_i2s_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the I2S peripheral. It sets the default parameters for I2S
|
||||
* peripheral, and configures its specifieds pins.
|
||||
*
|
||||
* @param[out] obj The I2S object
|
||||
* @param[in] tx_sck The transmit clock pin
|
||||
* @param[in] tx_ws The transmit word select pin
|
||||
* @param[in] tx_sdo The data out pin
|
||||
* @param[in] rx_sck The receive clock pin
|
||||
* @param[in] rx_ws The receive word select pin
|
||||
* @param[in] rx_sdi The data in pin
|
||||
* @return The status of the init request
|
||||
*/
|
||||
cy_rslt_t cyhal_i2s_init(cyhal_i2s_t *obj, cyhal_gpio_t tx_sck, cyhal_gpio_t tx_ws, cyhal_gpio_t tx_sdo, cyhal_gpio_t rx_sck, cyhal_gpio_t rx_ws, cyhal_gpio_t rx_sdi);
|
||||
|
||||
/** Deinitialize the i2s object
|
||||
*
|
||||
* @param[in,out] obj The i2s object
|
||||
*/
|
||||
void cyhal_i2s_free(cyhal_i2s_t *obj);
|
||||
|
||||
/** Configure the I2S frequency
|
||||
*
|
||||
* @param[in] obj The I2S object
|
||||
* @param[in] hz Frequency in Hz
|
||||
* @return The status of the frequency request
|
||||
*/
|
||||
cy_rslt_t cyhal_i2s_frequency(cyhal_i2s_t *obj, int hz);
|
||||
|
||||
/** Configure I2S as slave or master.
|
||||
* @param[in] obj The I2S object
|
||||
* @param[in] is_slave Enable hardware as a slave (true) or master (false)
|
||||
* @return The status of the mode request
|
||||
*/
|
||||
cy_rslt_t cyhal_i2s_mode(cyhal_i2s_t *obj, int is_slave);
|
||||
|
||||
/** Blocking reading data
|
||||
*
|
||||
* @param[in] obj The I2S object
|
||||
* @param[out] data The buffer for receiving
|
||||
* @param[in,out] length in - Number of bytes to read, out - number of bytes read
|
||||
* @return The status of the read request
|
||||
*/
|
||||
cy_rslt_t cyhal_i2s_read(cyhal_i2s_t *obj, uint8_t *data, size_t *length);
|
||||
|
||||
/** Blocking sending data
|
||||
*
|
||||
* @param[in] obj The I2S object
|
||||
* @param[in] data The buffer for sending
|
||||
* @param[in] length Number of bytes to write
|
||||
* @param[in] stop Stop to be generated after the transfer is done
|
||||
* @return The status of the write request
|
||||
*/
|
||||
cy_rslt_t cyhal_i2s_write(cyhal_i2s_t *obj, const uint8_t *data, size_t length, bool stop);
|
||||
|
||||
/** Start I2S asynchronous transfer
|
||||
*
|
||||
* @param[in] obj The I2S object
|
||||
* @param[in] tx The transmit buffer
|
||||
* @param[in,out] tx_length in - The number of bytes to transmit, out - The number of bytes actually transmitted
|
||||
* @param[out] rx The receive buffer
|
||||
* @param[in,out] rx_length in - The number of bytes to receive, out - The number of bytes actually received
|
||||
* @return The status of the transfer_async request
|
||||
*/
|
||||
cy_rslt_t cyhal_i2s_transfer_async(cyhal_i2s_t *obj, const void *tx, size_t *tx_length, void *rx, size_t *rx_length);
|
||||
|
||||
/** Abort I2S asynchronous transfer
|
||||
*
|
||||
* This function does not perform any check - that should happen in upper layers.
|
||||
* @param[in] obj The I2S object
|
||||
* @return The status of the abort_async request
|
||||
*/
|
||||
cy_rslt_t cyhal_i2s_abort_async(cyhal_i2s_t *obj);
|
||||
|
||||
/** The I2S interrupt handler registration
|
||||
*
|
||||
* @param[in] obj The I2S object
|
||||
* @param[in] handler The callback handler which will be invoked when the interrupt fires
|
||||
* @param[in] handler_arg Generic argument that will be provided to the handler when called
|
||||
*/
|
||||
void cyhal_i2s_register_irq(cyhal_i2s_t *obj, cyhal_i2s_irq_handler_t handler, void *handler_arg);
|
||||
|
||||
/** Configure I2S interrupt. This function is used for word-approach
|
||||
*
|
||||
* @param[in] obj The I2S object
|
||||
* @param[in] event The I2S IRQ type
|
||||
* @param[in] enable True to turn on interrupts, False to turn off
|
||||
*/
|
||||
void cyhal_i2s_irq_enable(cyhal_i2s_t *obj, cyhal_i2s_irq_t event, bool enable);
|
||||
|
||||
/** \} group_hal_i2s_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} group_hal_i2s */
|
|
@ -1,45 +0,0 @@
|
|||
/***************************************************************************//**
|
||||
* \file cyhal_implementation.h
|
||||
*
|
||||
* \brief
|
||||
* Provides references for the PSoC 6 specific implementation of the HAL drivers.
|
||||
* This includes references to implementation specific header files and any
|
||||
* supporting data types. This file should not be used directly. It should only
|
||||
* be referenced by HAL drivers to pull in the implementation specific code.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_psoc6 PSoC 6 HAL Implementation
|
||||
* \{
|
||||
* PSoC 6 specific implementation of the HAL drivers
|
||||
* \} group_hal_psoc6
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cy_pdl.h"
|
||||
#include "cyhal.h"
|
||||
#include "cyhal_hw_types.h"
|
||||
#include "cyhal_crc_impl.h"
|
||||
#include "cyhal_gpio_impl.h"
|
||||
#include "cyhal_scb_common.h"
|
||||
#include "cyhal_utils.h"
|
||||
#include "cyhal_system_impl.h"
|
||||
#include "cyhal_trng_impl.h"
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress digital routing.
|
||||
*
|
||||
* \defgroup group_hal_interconnect_macros Macros
|
||||
* \defgroup group_hal_interconnect_functions Functions
|
||||
* \defgroup group_hal_interconnect_data_structures Data Structures
|
||||
* \defgroup group_hal_interconnect_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -49,11 +44,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_interconnect_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** No connection is available */
|
||||
#define CYHAL_CONNECT_RSLT_NO_CONNECTION (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_INTERCONNECT, 0))
|
||||
/** The connections source and destination are already connected */
|
||||
|
@ -64,14 +54,6 @@ extern "C" {
|
|||
/** Indicates that a mux output does not continue to another mux */
|
||||
#define CYHAL_INTERCONNECT_MUX_NOT_CONTINUATION 0xFF
|
||||
|
||||
/** \} group_hal_interconnect_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_interconnect_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Connect a pin to a peripheral terminal. This will route a direct connect from the pin to the peripheral.
|
||||
* Any previous direct connection from the pin will be overriden.
|
||||
* @param[in] pin_connection Details about the pin and its target connection
|
||||
|
@ -95,8 +77,6 @@ cy_rslt_t cyhal_disconnect_pin(cyhal_gpio_t pin);
|
|||
*/
|
||||
cy_rslt_t cyhal_connect_trigger(cyhal_source_t source, cyhal_dest_t dest);
|
||||
|
||||
/** \} group_hal_interconnect_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress LPTIMER.
|
||||
*
|
||||
* \defgroup group_hal_lptimer_macros Macros
|
||||
* \defgroup group_hal_lptimer_functions Functions
|
||||
* \defgroup group_hal_lptimer_data_structures Data Structures
|
||||
* \defgroup group_hal_lptimer_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -48,35 +43,14 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_lptimer_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** LPTIMER interrupt triggers */
|
||||
typedef enum {
|
||||
CYHAL_LPTIMER_COMPARE_MATCH,
|
||||
} cyhal_lptimer_event_t;
|
||||
|
||||
/** \} group_hal_lptimer_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_lptimer_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Handler for LPTIMER interrupts */
|
||||
typedef void (*cyhal_lptimer_event_callback_t)(void *callback_arg, cyhal_lptimer_event_t event);
|
||||
|
||||
/** \} group_hal_lptimer_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_lptimer_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the LPTIMER
|
||||
*
|
||||
* Initialize or re-initialize the LPTIMER. This resets all the
|
||||
|
@ -168,8 +142,6 @@ void cyhal_lptimer_enable_event(cyhal_lptimer_t *obj, cyhal_lptimer_event_t even
|
|||
*/
|
||||
void cyhal_lptimer_irq_trigger(cyhal_lptimer_t *obj);
|
||||
|
||||
/** \} group_hal_lptimer_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -24,12 +24,8 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_modules Driver Modules
|
||||
* \ingroup group_hal
|
||||
* \{
|
||||
* Enum definition for all HAL resource modules.
|
||||
*
|
||||
* \defgroup group_hal_modules_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -40,12 +36,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_modules_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Enum to in indicate which module an errors occurred in. */
|
||||
enum cyhal_rslt_module_chip
|
||||
{
|
||||
|
@ -76,10 +66,8 @@ enum cyhal_rslt_module_chip
|
|||
CYHAL_RSLT_MODULE_WDT, //!< An error occurred in WDT module
|
||||
};
|
||||
|
||||
/** \} group_hal_modules_enums */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** \} group_hal_modules */
|
||||
/** \} group_hal */
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
/***************************************************************************//**
|
||||
* \file cyhal_opamp.h
|
||||
*
|
||||
* \brief
|
||||
* Provides a high level interface for interacting with the Cypress OpAmp.
|
||||
* This interface abstracts out the chip specific details. If any chip specific
|
||||
* functionality is necessary, or performance is critical the low level functions
|
||||
* can be used directly.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_opamp OPAMP (Operational Amplifier)
|
||||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress OpAmp.
|
||||
*
|
||||
* \defgroup group_hal_opamp_macros Macros
|
||||
* \defgroup group_hal_opamp_functions Functions
|
||||
* \defgroup group_hal_opamp_data_structures Data Structures
|
||||
* \defgroup group_hal_opamp_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "cy_result.h"
|
||||
#include "cyhal_hw_types.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_opamp_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the opamp peripheral.
|
||||
* If vinp is NULL, it will initialize in follower mode.
|
||||
*
|
||||
* @param[out] obj The opamp object
|
||||
* @param[in] vinp The vplus pin
|
||||
* @param[in] vinm The vminus pin
|
||||
* @param[in] vout The vout pin
|
||||
* @return The status of the init request
|
||||
*/
|
||||
cy_rslt_t cyhal_opamp_init(cyhal_opamp_t *obj, cyhal_gpio_t vinp, cyhal_gpio_t vinm, cyhal_gpio_t vout);
|
||||
|
||||
/** Release the opamp peripheral.
|
||||
*
|
||||
* @param[in,out] obj The opamp object
|
||||
*/
|
||||
void cyhal_opamp_free(cyhal_opamp_t *obj);
|
||||
|
||||
/** Reconfigure the opamp object
|
||||
*
|
||||
* @param[in,out] obj The opamp object
|
||||
* @param[in] power Power mode to operate in (0=off, 1=low, 2=medium, 3=high)
|
||||
* @param[in] deepsleep Does this need to operate in deepsleep
|
||||
* @return The status of the power request
|
||||
*/
|
||||
cy_rslt_t cyhal_opamp_power(cyhal_opamp_t *obj, uint8_t power, bool deepsleep);
|
||||
|
||||
/** \} group_hal_opamp_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} group_hal_opamp */
|
|
@ -1,173 +0,0 @@
|
|||
/***************************************************************************//**
|
||||
* \file cyhal_pdmpcm.h
|
||||
*
|
||||
* \brief
|
||||
* Provides a high level interface for interacting with the Cypress PDM/PCM.
|
||||
* This interface abstracts out the chip specific details. If any chip specific
|
||||
* functionality is necessary, or performance is critical the low level functions
|
||||
* can be used directly.
|
||||
*
|
||||
********************************************************************************
|
||||
* \copyright
|
||||
* Copyright 2018-2019 Cypress Semiconductor Corporation
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pdmpcm PDM/PCM (PDM-PCM Converter)
|
||||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress PDM/PCM.
|
||||
*
|
||||
* \defgroup group_hal_pdmpcm_macros Macros
|
||||
* \defgroup group_hal_pdmpcm_functions Functions
|
||||
* \defgroup group_hal_pdmpcm_data_structures Data Structures
|
||||
* \defgroup group_hal_pdmpcm_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "cy_result.h"
|
||||
#include "cyhal_hw_types.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pdmpcm_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** PDM/PCM interrupt triggers */
|
||||
typedef enum {
|
||||
/** TODO: Fill in */
|
||||
CY_PDM_PCM_TBD,
|
||||
} cyhal_pdm_pcm_irq_event_t;
|
||||
|
||||
/** \} group_hal_pdmpcm_enums */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pdmpcm_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Describes the current configuration of a PDM/PCM */
|
||||
typedef struct
|
||||
{
|
||||
/** TODO: define */
|
||||
void * cfg;
|
||||
} cyhal_pdm_pcm_cfg_t;
|
||||
|
||||
/** Handler for PDM/PCM interrupts */
|
||||
typedef void (*cyhal_pdm_pcm_irq_handler_t)(void *handler_arg, cyhal_pdm_pcm_irq_event_t event);
|
||||
|
||||
/** \} group_hal_pdmpcm_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pdmpcm_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the PDM/PCM peripheral
|
||||
*
|
||||
* Configures the pins used by PDM/PCM converter, sets a default format and frequency, and enables the peripheral
|
||||
* @param[out] obj The PDM/PCM object to initialize
|
||||
* @param[in] in The pin to use for PDM input
|
||||
* @param[in] clk The pin to use for PDM clock output
|
||||
* @return The status of the init request
|
||||
*/
|
||||
cy_rslt_t cyhal_pdm_pcm_init(cyhal_pdm_pcm_t *obj, cyhal_gpio_t in, cyhal_gpio_t clk);
|
||||
|
||||
/** Release a PDM/PCM object
|
||||
*
|
||||
* Return the peripheral, pins and clock owned by the PDM/PCM object to their reset state
|
||||
* @param[in,out] obj The PDM/PCM object to deinitialize
|
||||
*/
|
||||
void cyhal_pdm_pcm_free(cyhal_pdm_pcm_t *obj);
|
||||
|
||||
/** Updates the configuration of the PDM/PCM object
|
||||
*
|
||||
* @param[inout] obj The PDM/PCM object to configure
|
||||
* @param[in] cfg The configuration of the PDM/PCM
|
||||
* @return The status of the format request
|
||||
*/
|
||||
cy_rslt_t cyhal_pdm_pcm_config(cyhal_pdm_pcm_t *obj, const cyhal_pdm_pcm_cfg_t *cfg);
|
||||
|
||||
/** Clears the FIFO
|
||||
*
|
||||
* @param[in] obj The PDM/PCM peripheral to use for sending
|
||||
* @return The status of the clear request
|
||||
*/
|
||||
cy_rslt_t cyhal_pdm_pcm_clear(cyhal_pdm_pcm_t *obj);
|
||||
|
||||
/** Reads a block out of the FIFO
|
||||
*
|
||||
* @param[in] obj The PDM/PCM peripheral to use for sending
|
||||
* @param[out] data Pointer to the byte-array of data to read from the device
|
||||
* @param[in,out] length Number of bytes to read, updated with the number actually read
|
||||
* @return The status of the read request
|
||||
*/
|
||||
cy_rslt_t cyhal_pdm_pcm_read(cyhal_pdm_pcm_t *obj, uint8_t *data, uint32_t *length);
|
||||
|
||||
/** Begin the PDM/PCM transfer
|
||||
*
|
||||
* @param[in] obj The PDM/PCM object that holds the transfer information
|
||||
* @param[out] data The receive buffer
|
||||
* @param[in,out] length Number of bytes to read, updated with the number actually read
|
||||
* @return The status of the read_async request
|
||||
*/
|
||||
cy_rslt_t cyhal_pdm_pcm_read_async(cyhal_pdm_pcm_t *obj, void *data, size_t length);
|
||||
|
||||
/** Checks if the specified PDM/PCM peripheral is in use
|
||||
*
|
||||
* @param[in] obj The PDM/PCM peripheral to check
|
||||
* @return Indication of whether the PDM/PCM is still transmitting
|
||||
*/
|
||||
bool cyhal_pdm_pcm_is_busy(cyhal_pdm_pcm_t *obj);
|
||||
|
||||
/** Abort an PDM/PCM transfer
|
||||
*
|
||||
* @param[in] obj The PDM/PCM peripheral to stop
|
||||
* @return The status of the abort_async request
|
||||
*/
|
||||
cy_rslt_t cyhal_pdm_pcm_abort_async(cyhal_pdm_pcm_t *obj);
|
||||
|
||||
/** The PDM/PCM interrupt handler registration
|
||||
*
|
||||
* @param[in] obj The PDM/PCM object
|
||||
* @param[in] handler The callback handler which will be invoked when the interrupt fires
|
||||
* @param[in] handler_arg Generic argument that will be provided to the handler when called
|
||||
*/
|
||||
void cyhal_pdm_pcm_register_irq(cyhal_pdm_pcm_t *obj, cyhal_pdm_pcm_irq_handler_t handler, void *handler_arg);
|
||||
|
||||
/** Configure PDM/PCM interrupt enablement.
|
||||
*
|
||||
* @param[in] obj The PDM/PCM object
|
||||
* @param[in] event The PDM/PCM IRQ type
|
||||
* @param[in] enable True to turn on interrupts, False to turn off
|
||||
*/
|
||||
void cyhal_pdm_pcm_irq_enable(cyhal_pdm_pcm_t *obj, cyhal_pdm_pcm_irq_event_t event, bool enable);
|
||||
|
||||
/** \} group_hal_pdmpcm_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} group_hal_pdmpcm */
|
|
@ -23,15 +23,10 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pin_package PSoC 6 Pin Packages
|
||||
* \addtogroup group_hal_psoc6_pin_package Pins
|
||||
* \ingroup group_hal_psoc6
|
||||
* \{
|
||||
* Definitions for the pinout for each supported device
|
||||
*
|
||||
* \defgroup group_hal_pin_package_macros Macros
|
||||
* \defgroup group_hal_pin_package_functions Functions
|
||||
* \defgroup group_hal_pin_package_data_structures Data Structures
|
||||
* \defgroup group_hal_pin_package_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -42,11 +37,6 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pin_package_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Port names */
|
||||
typedef enum {
|
||||
CYHAL_PORT_0 = 0x0,
|
||||
|
@ -67,25 +57,19 @@ typedef enum {
|
|||
CYHAL_PORT_15 = 0xF,
|
||||
} cyhal_port_t;
|
||||
|
||||
/** \} group_hal_pin_package_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pin_package_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** GPIO pin configuration object */
|
||||
/** Bitfield representing the configuration of a GPIO (hsiom selection and mode).
|
||||
* Use the CY_GPIO_CFG_GET_MODE and CY_GPIO_CFG_GET_HSIOM to extract the
|
||||
* individual field values.
|
||||
*/
|
||||
typedef uint16_t cyhal_gpio_mapping_cfg_t; // 8bit hsiom, 8bit mode
|
||||
|
||||
/** \} group_hal_pin_package_data_structures */
|
||||
|
||||
/** Extract the GPIO mode setting from a cyhal_gpio_mapping_cfg_t */
|
||||
#define CY_GPIO_CFG_GET_MODE(x) ((uint8_t)((x) & 0xFF))
|
||||
/** Extract the HSIOM selection from a cyhal_gpio_mapping_cfg_t */
|
||||
#define CY_GPIO_CFG_GET_HSIOM(x) ((en_hsiom_sel_t)(((x) >> 8) & 0xFF))
|
||||
|
||||
/** \cond INTERNAL */
|
||||
|
||||
#define CY_GPIO_CFG_CREATE(hsiom, mode) ((cyhal_gpio_mapping_cfg_t)(((hsiom) << 8) + (mode)))
|
||||
#define CY_GPIO_CFG_GET_MODE(x) ((uint8_t)((x) & 0xFF))
|
||||
#define CY_GPIO_CFG_GET_HSIOM(x) ((en_hsiom_sel_t)(((x) >> 8) & 0xFF))
|
||||
|
||||
#define CYHAL_PIN_OUT_FUNCTION(hsiom) CY_GPIO_CFG_CREATE(hsiom, CY_GPIO_DM_STRONG_IN_OFF)
|
||||
#define CYHAL_PIN_OUT_BUF_FUNCTION(hsiom) CY_GPIO_CFG_CREATE(hsiom, CY_GPIO_DM_STRONG)
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress PWM.
|
||||
*
|
||||
* \defgroup group_hal_pwm_macros Macros
|
||||
* \defgroup group_hal_pwm_functions Functions
|
||||
* \defgroup group_hal_pwm_data_structures Data Structures
|
||||
* \defgroup group_hal_pwm_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -48,11 +43,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pwm_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Bad argument */
|
||||
#define CYHAL_PWM_RSLT_BAD_ARGUMENT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_PWM, 0))
|
||||
/** Failed to initialize PWM clock */
|
||||
|
@ -60,14 +50,6 @@ extern "C" {
|
|||
/** Failed to initialize PWM */
|
||||
#define CYHAL_PWM_RSLT_FAILED_INIT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_PWM, 2))
|
||||
|
||||
/** \} group_hal_pwm_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pwm_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** PWM interrupt triggers */
|
||||
typedef enum {
|
||||
CYHAL_PWM_IRQ_NONE = 0,
|
||||
|
@ -76,25 +58,9 @@ typedef enum {
|
|||
CYHAL_PWM_IRQ_ALL = (1 << 2) - 1,
|
||||
} cyhal_pwm_event_t;
|
||||
|
||||
/** \} group_hal_pwm_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pwm_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Handler for PWM interrupts */
|
||||
typedef void(*cyhal_pwm_event_callback_t)(void *callback_arg, cyhal_pwm_event_t event);
|
||||
|
||||
/** \} group_hal_pwm_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_pwm_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the PWM out peripheral and configure the pin
|
||||
*
|
||||
* @param[out] obj The PWM object to initialize
|
||||
|
@ -159,8 +125,6 @@ void cyhal_pwm_register_callback(cyhal_pwm_t *obj, cyhal_pwm_event_callback_t ca
|
|||
*/
|
||||
void cyhal_pwm_enable_event(cyhal_pwm_t *obj, cyhal_pwm_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_pwm_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress Quad-SPI.
|
||||
*
|
||||
* \defgroup group_hal_qspi_macros Macros
|
||||
* \defgroup group_hal_qspi_functions Functions
|
||||
* \defgroup group_hal_qspi_data_structures Data Structures
|
||||
* \defgroup group_hal_qspi_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -49,11 +44,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_qspi_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** QSPI Bus width
|
||||
*
|
||||
* Some parts of commands provide variable bus width
|
||||
|
@ -80,27 +70,12 @@ typedef enum {
|
|||
CYHAL_QSPI_IRQ_RECEIVE_DONE = 1 << 1, /**< Async receive done. >*/
|
||||
} cyhal_qspi_event_t;
|
||||
|
||||
/** \} group_hal_qspi_enums */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_qspi_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define CYHAL_QSPI_RSLT_ERR_BUS_WIDTH (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_QSPI, 0)) /**< Bus width Error. >*/
|
||||
#define CYHAL_QSPI_RSLT_ERR_PIN (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_QSPI, 1)) /**< Pin related Error. >*/
|
||||
#define CYHAL_QSPI_RSLT_ERR_DATA_SEL (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_QSPI, 2)) /**< Data select Error. >*/
|
||||
#define CYHAL_QSPI_RSLT_ERR_INSTANCE (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_QSPI, 3)) /**< QSPI instance related Error. >*/
|
||||
|
||||
/** \} group_hal_qspi_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_qspi_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** QSPI command settings */
|
||||
/** @brief QSPI command settings */
|
||||
typedef struct cyhal_qspi_command {
|
||||
struct {
|
||||
cyhal_qspi_bus_width_t bus_width; /**< Bus width for the instruction >*/
|
||||
|
@ -128,14 +103,6 @@ typedef struct cyhal_qspi_command {
|
|||
/** Handler for QSPI callbacks */
|
||||
typedef void (*cyhal_qspi_event_callback_t)(void *callback_arg, cyhal_qspi_event_t event);
|
||||
|
||||
/** \} group_hal_qspi_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_qspi_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize QSPI peripheral.
|
||||
*
|
||||
* It should initialize QSPI pins (io0-io7, sclk and ssel), set frequency, clock polarity and phase mode.
|
||||
|
@ -256,8 +223,6 @@ void cyhal_qspi_register_callback(cyhal_qspi_t *obj, cyhal_qspi_event_callback_t
|
|||
*/
|
||||
void cyhal_qspi_enable_event(cyhal_qspi_t *obj, cyhal_qspi_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_qspi_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress RTC.
|
||||
*
|
||||
* \defgroup group_hal_rtc_macros Macros
|
||||
* \defgroup group_hal_rtc_functions Functions
|
||||
* \defgroup group_hal_rtc_data_structures Data Structures
|
||||
* \defgroup group_hal_rtc_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -53,25 +48,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_rtc_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** RTC interrupt triggers */
|
||||
typedef enum {
|
||||
CYHAL_RTC_ALARM,
|
||||
} cyhal_rtc_event_t;
|
||||
|
||||
/** \} group_hal_rtc_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_rtc_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Defines which fields should be active for the alarm. */
|
||||
/** @brief Defines which fields should be active for the alarm. */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t en_sec : 1; /** !< Enable match of seconds */
|
||||
|
@ -85,14 +67,6 @@ typedef struct
|
|||
/** Handler for RTC events */
|
||||
typedef void (*cyhal_rtc_event_callback_t)(void *callback_arg, cyhal_rtc_event_t event);
|
||||
|
||||
/** \} group_hal_rtc_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_rtc_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the RTC peripheral
|
||||
*
|
||||
* Powerup the RTC in preparation for access. This function must be called
|
||||
|
@ -167,8 +141,6 @@ void cyhal_rtc_register_callback(cyhal_rtc_t *obj, cyhal_rtc_event_callback_t ca
|
|||
*/
|
||||
void cyhal_rtc_enable_event(cyhal_rtc_t *obj, cyhal_rtc_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_rtc_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,16 +23,10 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_scb_common PSoC 6 SCB Common Functionality
|
||||
* \addtogroup group_hal_psoc6_scb_common SCB Common Functionality
|
||||
* \ingroup group_hal_psoc6
|
||||
* \{
|
||||
* Code shared between the SCB resources (UART, I2C, and SPI).
|
||||
*
|
||||
* \defgroup group_hal_scb_common_macros Macros
|
||||
* \defgroup group_hal_scb_common_constants Constants
|
||||
* \defgroup group_hal_scb_common_functions Functions
|
||||
* \defgroup group_hal_scb_common_data_structures Data Structures
|
||||
* \defgroup group_hal_scb_common_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -45,26 +39,14 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_scb_common_constants
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** The start address of the SCB blocks */
|
||||
extern CySCB_Type* CYHAL_SCB_BASE_ADDRESSES[CY_IP_MXSCB_INSTANCES];
|
||||
extern CySCB_Type* const CYHAL_SCB_BASE_ADDRESSES[CY_IP_MXSCB_INSTANCES];
|
||||
/** The interrupt number of the SCB blocks. */
|
||||
extern IRQn_Type CYHAL_SCB_IRQ_N[CY_IP_MXSCB_INSTANCES];
|
||||
extern const IRQn_Type CYHAL_SCB_IRQ_N[CY_IP_MXSCB_INSTANCES];
|
||||
|
||||
/** The configuration structs for the resource in use on each SCB block (e.g. cyhal_i2c_t) */
|
||||
extern void *cyhal_scb_config_structs[CY_IP_MXSCB_INSTANCES];
|
||||
|
||||
/** \} group_hal_scb_common_constants */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_scb_common_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Get the SCB block corresponding to an IRQn.
|
||||
*
|
||||
|
@ -84,10 +66,8 @@ __STATIC_INLINE void *cyhal_scb_get_irq_obj(void)
|
|||
return cyhal_scb_config_structs[block];
|
||||
}
|
||||
|
||||
/** \} group_hal_scb_common_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} group_hal_scb_common */
|
||||
/** \} group_hal_psoc6_scb_common */
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress SDHC.
|
||||
*
|
||||
* \defgroup group_hal_sdhc_macros Macros
|
||||
* \defgroup group_hal_sdhc_functions Functions
|
||||
* \defgroup group_hal_sdhc_data_structures Data Structures
|
||||
* \defgroup group_hal_sdhc_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -48,21 +43,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdhc_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define CYHAL_SDHC_RSLT_ERR_PIN (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SDHC, 0)) /**< Pin related Error. >*/
|
||||
|
||||
/** \} group_hal_sdhc_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdhc_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Card types */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -95,28 +77,12 @@ typedef enum {
|
|||
CYHAL_SDHC_ALL_INTERRUPTS = 0xFFFF, //!> Is used to enable/disable all interrupts
|
||||
} cyhal_sdhc_event_t;
|
||||
|
||||
/** \} group_hal_sdhc_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdhc_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define CYHAL_SDHC_RSLT_ERR_PIN (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SDHC, 0)) /**< Pin related Error. >*/
|
||||
|
||||
/** \} group_hal_sdhc_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdhc_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Handler for SDHC interrupts */
|
||||
typedef void (*cyhal_sdhc_event_callback_t)(void *callback_arg, cyhal_sdhc_event_t event);
|
||||
|
||||
/** Defines configuration options for the SDHC block */
|
||||
/** @brief Defines configuration options for the SDHC block */
|
||||
typedef struct
|
||||
{
|
||||
bool enableLedControl; //!< Drive one IO to indicate when the card is being accessed
|
||||
|
@ -125,14 +91,6 @@ typedef struct
|
|||
uint8_t busWidth; //!< The desired bus width
|
||||
} cyhal_sdhc_config_t;
|
||||
|
||||
/** \} group_hal_sdhc_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdhc_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the SDHC peripheral
|
||||
*
|
||||
* @param[out] obj The SDHC object
|
||||
|
@ -261,8 +219,6 @@ void cyhal_sdhc_register_callback(cyhal_sdhc_t *obj, cyhal_sdhc_event_callback_t
|
|||
*/
|
||||
void cyhal_sdhc_enable_event(cyhal_sdhc_t *obj, cyhal_sdhc_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_sdhc_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
* \{
|
||||
* High level interface for interacting with the Cypress SDIO interface.
|
||||
*
|
||||
* \defgroup group_hal_sdio_macros Macros
|
||||
* \defgroup group_hal_sdio_functions Functions
|
||||
* \defgroup group_hal_sdio_data_structures Data Structures
|
||||
* \defgroup group_hal_sdio_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -48,11 +44,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdio_macros
|
||||
* \{
|
||||
*/
|
||||
* \addtogroup group_hal_sdio_errors Error Codes
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define CYHAL_SDIO_RET_NO_ERRORS (0x00) /**< No error*/
|
||||
#define CYHAL_SDIO_RET_NO_SP_ERRORS (0x01) /**< Non-specific error code*/
|
||||
|
@ -96,12 +91,7 @@ extern "C" {
|
|||
CYHAL_RSLT_MODULE_SDIO, \
|
||||
CYHAL_SDIO_CANCELED)
|
||||
|
||||
/** \} group_hal_sdio_macros */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdio_enums
|
||||
* \{
|
||||
*/
|
||||
/** \} group_hal_sdio_errors */
|
||||
|
||||
/** Commands that can be issued */
|
||||
typedef enum
|
||||
|
@ -149,15 +139,7 @@ typedef enum {
|
|||
CYHAL_SDIO_ALL_INTERRUPTS = 0x0E1FF, //!> Is used to enable/disable all interrupts events
|
||||
} cyhal_sdio_event_t;
|
||||
|
||||
/** \} group_hal_sdio_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdio_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** SDIO controller initial configuration */
|
||||
/** @brief SDIO controller initial configuration */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t frequencyhal_hz; //!< Clock frequency, in hertz
|
||||
|
@ -167,14 +149,6 @@ typedef struct
|
|||
/** Callback for SDIO events */
|
||||
typedef void (*cyhal_sdio_event_callback_t)(void *callback_arg, cyhal_sdio_event_t event);
|
||||
|
||||
/** \} group_hal_sdio_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_sdio_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the SDIO peripheral
|
||||
*
|
||||
* @param[out] obj The SDIO object
|
||||
|
@ -270,8 +244,6 @@ void cyhal_sdio_register_callback(cyhal_sdio_t *obj, cyhal_sdio_event_callback_t
|
|||
*/
|
||||
void cyhal_sdio_enable_event(cyhal_sdio_t *obj, cyhal_sdio_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_sdio_functions */
|
||||
|
||||
/*******************************************************************************
|
||||
* Backward compatibility macro. The following code is DEPRECATED and must
|
||||
* not be used in new projects
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress SPI.
|
||||
*
|
||||
* \defgroup group_hal_spi_macros Macros
|
||||
* \defgroup group_hal_spi_functions Functions
|
||||
* \defgroup group_hal_spi_data_structures Data Structures
|
||||
* \defgroup group_hal_spi_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -50,11 +45,6 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_spi_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Bad argument */
|
||||
#define CYHAL_SPI_RSLT_BAD_ARGUMENT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SPI, 0))
|
||||
/** Failed to initialize SPI clock */
|
||||
|
@ -70,8 +60,6 @@ extern "C" {
|
|||
/** The requested resource type is invalid */
|
||||
#define CYHAL_SPI_RSLT_ERR_INVALID_PIN (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SPI, 7))
|
||||
|
||||
/** \} group_hal_spi_macros */
|
||||
|
||||
/** Compatibility define for cyhal_spi_set_frequency. */
|
||||
#define cyhal_spi_frequency cyhal_spi_set_frequency
|
||||
|
||||
|
@ -109,7 +97,7 @@ typedef enum
|
|||
CYHAL_SPI_MODE_11_LSB,
|
||||
} cyhal_spi_mode_t;
|
||||
|
||||
/** Initial SPI configuration. */
|
||||
/** @brief Initial SPI configuration. */
|
||||
typedef struct
|
||||
{
|
||||
cyhal_spi_mode_t mode; //!< The operating mode
|
||||
|
@ -251,8 +239,6 @@ void cyhal_spi_enable_event(cyhal_spi_t *obj, cyhal_spi_event_t event, uint8_t i
|
|||
typedef cyhal_spi_event_t cyhal_spi_irq_event_t;
|
||||
/** \endcond */
|
||||
|
||||
/** \} group_hal_spi_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,11 +31,6 @@
|
|||
* \{
|
||||
* High level interface for interacting with the Cypress power management
|
||||
* and system clock configuration.
|
||||
*
|
||||
* \defgroup group_hal_system_macros Macros
|
||||
* \defgroup group_hal_system_functions Functions
|
||||
* \defgroup group_hal_system_data_structures Data Structures
|
||||
* \defgroup group_hal_system_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -50,11 +45,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_system_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** An error occurred in System module */
|
||||
#define CYHAL_SYSTEM_RSLT_ERROR (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SYSTEM , 0))
|
||||
/** An error occurred in System module */
|
||||
|
@ -66,14 +56,6 @@ extern "C" {
|
|||
/** An error occurred in System module */
|
||||
#define CYHAL_SYSTEM_RSLT_NO_VALID_DIVIDER (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_SYSTEM , 4))
|
||||
|
||||
/** \} group_hal_system_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_system_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Enter a critical section
|
||||
*
|
||||
* Disables interrupts and returns a value indicating whether the interrupts were previously
|
||||
|
@ -156,8 +138,6 @@ cy_rslt_t cyhal_system_clock_set_frequency(uint8_t clock, uint32_t frequency_hz)
|
|||
*/
|
||||
cy_rslt_t cyhal_system_clock_set_divider(cyhal_system_clock_t clock, cyhal_system_divider_t divider);
|
||||
|
||||
/** \} group_hal_system_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,16 +23,10 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_tcpwm_common PSoC 6 TCPWM Common Functionality
|
||||
* \addtogroup group_hal_psoc6_tcpwm_common TCPWM Common Functionality
|
||||
* \ingroup group_hal_psoc6
|
||||
* \{
|
||||
* Code shared between the Cypress Timer / Counter and PWM.
|
||||
*
|
||||
* \defgroup group_hal_tcpwm_common_macros Macros
|
||||
* \defgroup group_hal_tcpwm_common_constants Constants
|
||||
* \defgroup group_hal_tcpwm_common_functions Functions
|
||||
* \defgroup group_hal_tcpwm_common_data_structures Data Structures
|
||||
* \defgroup group_hal_tcpwm_common_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -41,11 +35,6 @@
|
|||
#include <stdbool.h>
|
||||
#include "cyhal_hw_types.h"
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_tcpwm_common_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Handler for TCPWM interrupts */
|
||||
typedef void(*cyhal_tcpwm_event_callback_t)(void *callback_arg, int event);
|
||||
|
||||
|
@ -59,25 +48,9 @@ typedef struct {
|
|||
uint8_t isr_offset; //!< TCPWM base IRQn (channel 0 IRQn)
|
||||
} cyhal_tcpwm_data_t;
|
||||
|
||||
/** \} group_hal_tcpwm_common_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_tcpwm_common_constants
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Contains data about all of the TCPWMs */
|
||||
extern const cyhal_tcpwm_data_t CYHAL_TCPWM_DATA[CY_IP_MXTCPWM_INSTANCES];
|
||||
|
||||
/** \} group_hal_tcpwm_common_constants */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_tcpwm_common_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize a timer/counter or PWM object's callback data.
|
||||
*
|
||||
* @param[in] resource The timer/counter or PWM resource
|
||||
|
@ -103,6 +76,4 @@ void cyhal_tcpwm_register_callback(cyhal_resource_inst_t *resource, cy_israddres
|
|||
*/
|
||||
void cyhal_tcpwm_enable_event(TCPWM_Type *type, cyhal_resource_inst_t *resource, uint32_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_tcpwm_common_functions */
|
||||
|
||||
/** \} group_hal_tcpwm_common */
|
||||
/** \} group_hal_psoc6_tcpwm_common */
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress Timer.
|
||||
*
|
||||
* \defgroup group_hal_timer_macros Macros
|
||||
* \defgroup group_hal_timer_functions Functions
|
||||
* \defgroup group_hal_timer_data_structures Data Structures
|
||||
* \defgroup group_hal_timer_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -49,11 +44,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_timer_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Timer directions */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -70,15 +60,7 @@ typedef enum {
|
|||
CYHAL_TIMER_IRQ_ALL = (1 << 2) - 1,
|
||||
} cyhal_timer_event_t;
|
||||
|
||||
/** \} group_hal_timer_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_timer_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Describes the current configuration of a timer/counter */
|
||||
/** @brief Describes the current configuration of a timer/counter */
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
|
@ -97,14 +79,6 @@ typedef struct
|
|||
/** Handler for timer events */
|
||||
typedef void(*cyhal_timer_event_callback_t)(void *callback_arg, cyhal_timer_event_t event);
|
||||
|
||||
/** \} group_hal_timer_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_timer_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Bad argument. eg: null pointer */
|
||||
#define CYHAL_TIMER_RSLT_ERR_BAD_ARGUMENT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_TIMER, 0))
|
||||
/** Failed to initialize Timer clock */
|
||||
|
@ -117,14 +91,6 @@ typedef void(*cyhal_timer_event_callback_t)(void *callback_arg, cyhal_timer_even
|
|||
/** Default timer frequency, used when an existing clock divider is not provided to init */
|
||||
#define CYHAL_TIMER_DEFAULT_FREQ (1000000u)
|
||||
|
||||
/** \} group_hal_timer_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_timer_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the timer/counter peripheral and configure the pin.
|
||||
*
|
||||
* @param[out] obj The timer/counter object to initialize
|
||||
|
@ -189,8 +155,6 @@ void cyhal_timer_register_callback(cyhal_timer_t *obj, cyhal_timer_event_callbac
|
|||
*/
|
||||
void cyhal_timer_enable_event(cyhal_timer_t *obj, cyhal_timer_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_timer_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress TRNG.
|
||||
*
|
||||
* \defgroup group_hal_trng_macros Macros
|
||||
* \defgroup group_hal_trng_functions Functions
|
||||
* \defgroup group_hal_trng_data_structures Data Structures
|
||||
* \defgroup group_hal_trng_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -56,11 +51,6 @@ extern "C" {
|
|||
*/
|
||||
#define CYHAL_TRNG_RSLT_ERR_HW (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_TRNG, 1))
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_trng_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the random number generator.
|
||||
*
|
||||
* @param[out] obj The random number generator object
|
||||
|
@ -81,8 +71,6 @@ void cyhal_trng_free(cyhal_trng_t *obj);
|
|||
*/
|
||||
uint32_t cyhal_trng_generate(const cyhal_trng_t *obj);
|
||||
|
||||
/** \} group_hal_trng_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress UART.
|
||||
*
|
||||
* \defgroup group_hal_uart_macros Macros
|
||||
* \defgroup group_hal_uart_functions Functions
|
||||
* \defgroup group_hal_uart_data_structures Data Structures
|
||||
* \defgroup group_hal_uart_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -49,11 +44,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_uart_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** The requested resource type is invalid */
|
||||
#define CYHAL_UART_RSLT_ERR_INVALID_PIN (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_UART, 0))
|
||||
/** Failed to configure power management callback */
|
||||
|
@ -66,13 +56,6 @@ extern "C" {
|
|||
#define CYHAL_UART_DEFAULT_BAUD 115200
|
||||
/** The maximum allowable difference between baud requested and actual baud **/
|
||||
#define CYHAL_UART_MAX_BAUD_PERCENT_DIFFERENCE 10
|
||||
/** \} group_hal_uart_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_uart_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** UART Parity */
|
||||
typedef enum
|
||||
|
@ -96,15 +79,7 @@ typedef enum
|
|||
CYHAL_UART_IRQ_TX_EMPTY = 1 << 8, //!< The tx hardware buffer is empty
|
||||
} cyhal_uart_event_t;
|
||||
|
||||
/** \} group_hal_uart_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_uart_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initial UART configuration */
|
||||
/** @brief Initial UART configuration */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t data_bits; //!< The number of start bits
|
||||
|
@ -117,14 +92,6 @@ typedef struct
|
|||
/** UART callback function type */
|
||||
typedef void (*cyhal_uart_event_callback_t)(void *callback_arg, cyhal_uart_event_t event);
|
||||
|
||||
/** \} group_hal_uart_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_uart_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize the uart peripheral. It sets the default parameters for uart
|
||||
* peripheral, and configures its specifieds pins.
|
||||
*
|
||||
|
@ -305,9 +272,6 @@ void cyhal_uart_register_callback(cyhal_uart_t *obj, cyhal_uart_event_callback_t
|
|||
*/
|
||||
void cyhal_uart_enable_event(cyhal_uart_t *obj, cyhal_uart_event_t event, uint8_t intrPriority, bool enable);
|
||||
|
||||
/** \} group_hal_uart_functions */
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
* \{
|
||||
* High level interface for interacting with the Cypress USB Device.
|
||||
*
|
||||
* \defgroup group_hal_usb_dev_macros Macros
|
||||
* \defgroup group_hal_usb_dev_functions Functions
|
||||
* \defgroup group_hal_usb_dev_data_structures Data Structures
|
||||
* \defgroup group_hal_usb_dev_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -49,11 +45,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_usb_dev_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** The usb error */
|
||||
#define CYHAL_USB_DEV_RSLT_ERR (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_USB, 0))
|
||||
|
||||
|
@ -63,6 +54,11 @@ extern "C" {
|
|||
/** The configuration of USB clock failed */
|
||||
#define CYHAL_USB_DEV_RSLT_ERR_CLK_CFG (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_USB, 2))
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_usb_dev_endpoint Endpoint
|
||||
* \{
|
||||
* APIs relating to endpoint management
|
||||
*/
|
||||
/** Returns true if endpoint direction is IN */
|
||||
#define CYHAL_USB_DEV_IS_IN_EP(endpoint) (0U != (0x80U & (uint32_t) (endpoint)))
|
||||
|
||||
|
@ -72,14 +68,6 @@ extern "C" {
|
|||
/** Returns endpoint index (type uint32_t) */
|
||||
#define CYHAL_USB_DEV_GET_EP_IDX(endpoint) (CYHAL_USB_DEV_GET_EP_NUM(endpoint) - 1U)
|
||||
|
||||
/** \} group_hal_usb_dev_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_usb_dev_enums
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** USB Device Endpoints types */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -89,6 +77,8 @@ typedef enum
|
|||
CYHAL_USB_DEV_EP_TYPE_INT = 3
|
||||
} cyhal_usb_dev_ep_type_t;
|
||||
|
||||
/** \} group_hal_usb_dev_endpoint */
|
||||
|
||||
/** Service Callback Events */
|
||||
typedef enum
|
||||
{
|
||||
|
@ -98,21 +88,21 @@ typedef enum
|
|||
CYHAL_USB_DEV_EVENT_EP0_OUT, /**< Callback hooked to endpoint 0 OUT packet interrupt */
|
||||
} cyhal_usb_dev_event_t;
|
||||
|
||||
/** \} group_hal_usb_dev_enums */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_usb_dev_data_structures
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** USB endpoint address (it consists from endpoint number and direction) */
|
||||
* USB endpoint address (consists from endpoint number and direction)
|
||||
*
|
||||
* \ingroup group_hal_usb_dev_endpoint
|
||||
*/
|
||||
typedef uint8_t cyhal_usb_dev_ep_t;
|
||||
|
||||
/** Callback handler for USB Device interrupt */
|
||||
typedef void (*cyhal_usb_dev_irq_callback_t)(void);
|
||||
|
||||
/** Callback handler for the transfer completion event for data endpoints (not applicable for endpoint 0)*/
|
||||
/**
|
||||
* Callback handler for the transfer completion event for data endpoints (not applicable for endpoint 0)
|
||||
*
|
||||
* \ingroup group_hal_usb_dev_endpoint
|
||||
*/
|
||||
typedef void (* cyhal_usb_dev_endpoint_callback_t)(cyhal_usb_dev_ep_t endpoint);
|
||||
|
||||
/** Callback handler for the events for USB Device */
|
||||
|
@ -121,14 +111,6 @@ typedef void (*cyhal_usb_dev_event_callback_t)(void);
|
|||
/** Callback handler for the events for USB Device */
|
||||
typedef void (*cyhal_usb_dev_sof_callback_t)(uint32_t frame_number);
|
||||
|
||||
/** \} group_hal_usb_dev_data_structures */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_usb_dev_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize this USBPhy instance.
|
||||
*
|
||||
|
@ -208,6 +190,12 @@ typedef void (*cyhal_usb_dev_sof_callback_t)(uint32_t frame_number);
|
|||
*/
|
||||
void cyhal_usb_dev_set_address(cyhal_usb_dev_t *obj, uint8_t address);
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_usb_dev_ep0 EP0
|
||||
* \{
|
||||
* APIs relating specifically to management of endpoint zero
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get wMaxPacketSize of endpoint 0.
|
||||
* The endpoint 0 has dedicated buffer.
|
||||
|
@ -266,6 +254,13 @@ uint32_t cyhal_usb_dev_ep0_get_max_packet(cyhal_usb_dev_t *obj);
|
|||
*/
|
||||
void cyhal_usb_dev_ep0_stall(cyhal_usb_dev_t *obj);
|
||||
|
||||
/** \} group_hal_usb_dev_ep0 */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_usb_dev_endpoint
|
||||
* \{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configure an endpoint.
|
||||
*
|
||||
|
@ -385,6 +380,8 @@ cy_rslt_t cyhal_usb_dev_endpoint_add(cyhal_usb_dev_t *obj, bool alloc, bool enab
|
|||
*/
|
||||
cy_rslt_t cyhal_usb_dev_endpoint_abort(cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint);
|
||||
|
||||
/** \} group_hal_usb_dev_endpoint */
|
||||
|
||||
/** The USB Device callback handler registration
|
||||
*
|
||||
* @param[in,out] obj The usb device object
|
||||
|
@ -415,6 +412,8 @@ void cyhal_usb_dev_process_irq(cyhal_usb_dev_t *obj);
|
|||
* @param[in,out] obj The usb device object
|
||||
* @param[in] endpoint Endpoint to registers handler
|
||||
* @param[in] callback The callback handler which will be invoked when the endpoint comp
|
||||
*
|
||||
* \ingroup group_hal_usb_dev_endpoint
|
||||
*/
|
||||
void cyhal_usb_dev_register_endpoint_callback(cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint, cyhal_usb_dev_endpoint_callback_t callback);
|
||||
|
||||
|
@ -435,8 +434,6 @@ void cyhal_usb_dev_register_event_callback(cyhal_usb_dev_t *obj, cyhal_usb_dev_e
|
|||
*/
|
||||
void cyhal_usb_dev_register_sof_callback( cyhal_usb_dev_t *obj, cyhal_usb_dev_sof_callback_t callback);
|
||||
|
||||
/** \} group_hal_usb_dev_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,15 +23,8 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_utils PSoC 6 Utility Functions
|
||||
* \ingroup group_hal_psoc6
|
||||
* \addtogroup group_hal_psoc6 PSoC 6 Implementation
|
||||
* \{
|
||||
* Utility functions for working with the PSoC 6 HAL implementation.
|
||||
*
|
||||
* \defgroup group_hal_utils_macros Macros
|
||||
* \defgroup group_hal_utils_functions Functions
|
||||
* \defgroup group_hal_utils_data_structures Data Structures
|
||||
* \defgroup group_hal_utils_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -43,17 +36,25 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_utils_macros
|
||||
* \addtogroup group_hal_psoc6_interrupts Interrupts
|
||||
* \{
|
||||
*/
|
||||
#define CYHAL_IRQN_OFFSET 16 /**< Offset for implementation-defined ISR type numbers (IRQ0 = 16) */
|
||||
#define CYHAL_GET_CURRENT_IRQN() ((IRQn_Type) (__get_IPSR() - CYHAL_IRQN_OFFSET)) /**< Macro to get the IRQn of the current ISR */
|
||||
|
||||
/** \} group_hal_psoc6_interrupts */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_psoc6_pin_package
|
||||
* \{
|
||||
*/
|
||||
|
||||
#define CYHAL_GET_PIN(pin) ((uint8_t)(pin & 0xFFFFUL)) /**< Macro to extract the pin number */
|
||||
#define CYHAL_GET_PORT(pin) ((uint8_t)((uint32_t)(pin >> 16) & 0xFFUL)) /**< Macro to extract the port number */
|
||||
|
||||
#define CYHAL_IRQN_OFFSET 16 /**< Offset for implementation-defined ISR type numbers (IRQ0 = 16) */
|
||||
#define CYHAL_GET_CURRENT_IRQN() ((IRQn_Type) (__get_IPSR() - CYHAL_IRQN_OFFSET)) /**< Macro to get the IRQn of the current ISR */
|
||||
|
||||
/** Looks up the resource block that connects to the specified pins from the provided resource pin mapping table.
|
||||
* This is a convinience utility for cyhal_utils_get_resource() if the mappings is an array of known size.
|
||||
*
|
||||
|
@ -63,25 +64,6 @@ extern "C" {
|
|||
*/
|
||||
#define CY_UTILS_GET_RESOURCE(pin, mappings) cyhal_utils_get_resource(pin, mappings, sizeof(mappings)/sizeof(cyhal_resource_pin_mapping_t))
|
||||
|
||||
/** \} group_hal_utils_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_utils_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Calculate the peri clock divider value that need to be set to reach frequency closest to the input frequency
|
||||
*
|
||||
* @param[in] frequency The desired frequency
|
||||
* @param[in] frac_bits The number of fractional bits that the divider has
|
||||
* @return The calculate divider value to set, NOTE a divider value of x divide the frequency by (x+1)
|
||||
*/
|
||||
static inline uint32_t cyhal_divider_value(uint32_t frequency, uint32_t frac_bits)
|
||||
{
|
||||
return ((cy_PeriClkFreqHz * (1 << frac_bits)) + (frequency / 2)) / frequency - 1;
|
||||
}
|
||||
|
||||
/** Converts the provided gpio pin to a resource instance object
|
||||
*
|
||||
* @param[in] pin The pin to get a resource object for
|
||||
|
@ -108,10 +90,29 @@ const cyhal_resource_pin_mapping_t *cyhal_utils_get_resource(cyhal_gpio_t pin, c
|
|||
*/
|
||||
void cyhal_utils_disconnect_and_free(cyhal_gpio_t pin);
|
||||
|
||||
/** \} group_hal_utils_functions */
|
||||
/** \} group_hal_psoc6_pin_package */
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_psoc6_clocks Clocks
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Calculate the peri clock divider value that need to be set to reach frequency closest to the input frequency
|
||||
*
|
||||
* @param[in] frequency The desired frequency
|
||||
* @param[in] frac_bits The number of fractional bits that the divider has
|
||||
* @return The calculate divider value to set, NOTE a divider value of x divide the frequency by (x+1)
|
||||
*/
|
||||
static inline uint32_t cyhal_divider_value(uint32_t frequency, uint32_t frac_bits)
|
||||
{
|
||||
return ((Cy_SysClk_ClkPeriGetFrequency() * (1 << frac_bits)) + (frequency / 2)) / frequency - 1;
|
||||
}
|
||||
|
||||
/** \} group_hal_psoc6_clocks */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/** \} group_hal_utils */
|
||||
/** \} group_hal_psoc6_utils */
|
||||
/** \} group_hal_psoc6 */
|
||||
|
|
|
@ -30,11 +30,6 @@
|
|||
* \ingroup group_hal
|
||||
* \{
|
||||
* High level interface for interacting with the Cypress WDT.
|
||||
*
|
||||
* \defgroup group_hal_wdt_macros Macros
|
||||
* \defgroup group_hal_wdt_functions Functions
|
||||
* \defgroup group_hal_wdt_data_structures Data Structures
|
||||
* \defgroup group_hal_wdt_enums Enumerated Types
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@ -46,24 +41,11 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_wdt_macros
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** WDT timeout out of range */
|
||||
#define CY_RSLT_WDT_INVALID_TIMEOUT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_WDT, 0))
|
||||
/** WDT already initialized */
|
||||
#define CY_RSLT_WDT_ALREADY_INITIALIZED (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CYHAL_RSLT_MODULE_WDT, 1))
|
||||
|
||||
/** \} group_hal_wdt_macros */
|
||||
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_wdt_functions
|
||||
* \{
|
||||
*/
|
||||
|
||||
/** Initialize and start the WDT
|
||||
*
|
||||
* Initialize or re-initialize the WDT.
|
||||
|
@ -130,8 +112,6 @@ uint32_t cyhal_wdt_get_timeout_ms(cyhal_wdt_t *obj);
|
|||
*/
|
||||
uint32_t cyhal_wdt_get_max_timeout_ms(void);
|
||||
|
||||
/** \} group_hal_wdt_functions */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -237,7 +237,7 @@ cy_rslt_t cyhal_adc_init(cyhal_adc_t *obj, cyhal_gpio_t pin, const cyhal_clock_d
|
|||
{
|
||||
if(obj->dedicated_clock)
|
||||
{
|
||||
uint32_t div = cy_PeriClkFreqHz / DESIRED_DIVIDER;
|
||||
uint32_t div = Cy_SysClk_ClkPeriGetFrequency() / DESIRED_DIVIDER;
|
||||
if (0 == div ||
|
||||
CY_SYSCLK_SUCCESS != Cy_SysClk_PeriphSetDivider(obj->clock.div_type, obj->clock.div_num, div - 1) ||
|
||||
CY_SYSCLK_SUCCESS != Cy_SysClk_PeriphEnableDivider(obj->clock.div_type, obj->clock.div_num))
|
||||
|
|
|
@ -33,7 +33,7 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
|
||||
static CRYPTO_Type* CYHAL_CRYPTO_BASE_ADDRESSES[CYHAL_CRYPTO_INST_COUNT] =
|
||||
static CRYPTO_Type* const CYHAL_CRYPTO_BASE_ADDRESSES[CYHAL_CRYPTO_INST_COUNT] =
|
||||
{
|
||||
#ifdef CRYPTO
|
||||
CRYPTO,
|
||||
|
|
|
@ -56,25 +56,25 @@ static CTDAC_Type *const cyhal_ctdac_base[] = {
|
|||
#endif
|
||||
};
|
||||
|
||||
const cy_stc_ctdac_config_t CYHAL_CTDAC_DEFAULT_CONFIG =
|
||||
{
|
||||
.refSource = CY_CTDAC_REFSOURCE_VDDA,
|
||||
.formatMode = CY_CTDAC_FORMAT_UNSIGNED,
|
||||
.updateMode = CY_CTDAC_UPDATE_DIRECT_WRITE,
|
||||
.deglitchMode = CY_CTDAC_DEGLITCHMODE_UNBUFFERED,
|
||||
.outputMode = CY_CTDAC_OUTPUT_VALUE,
|
||||
.outputBuffer = CY_CTDAC_OUTPUT_UNBUFFERED,
|
||||
.deepSleep = CY_CTDAC_DEEPSLEEP_DISABLE,
|
||||
.deglitchCycles = 0,
|
||||
.value = 0,
|
||||
.nextValue = 0,
|
||||
.enableInterrupt = true,
|
||||
.configClock = false,
|
||||
// The following values are simply placeholders because configClock is false
|
||||
.dividerType = CY_SYSCLK_DIV_8_BIT,
|
||||
.dividerNum = 0,
|
||||
.dividerIntValue = 0,
|
||||
.dividerFracValue = 0,
|
||||
static const cy_stc_ctdac_config_t CYHAL_CTDAC_DEFAULT_CONFIG =
|
||||
{
|
||||
.refSource = CY_CTDAC_REFSOURCE_VDDA,
|
||||
.formatMode = CY_CTDAC_FORMAT_UNSIGNED,
|
||||
.updateMode = CY_CTDAC_UPDATE_DIRECT_WRITE,
|
||||
.deglitchMode = CY_CTDAC_DEGLITCHMODE_UNBUFFERED,
|
||||
.outputMode = CY_CTDAC_OUTPUT_VALUE,
|
||||
.outputBuffer = CY_CTDAC_OUTPUT_UNBUFFERED,
|
||||
.deepSleep = CY_CTDAC_DEEPSLEEP_DISABLE,
|
||||
.deglitchCycles = 0,
|
||||
.value = 0,
|
||||
.nextValue = 0,
|
||||
.enableInterrupt = true,
|
||||
.configClock = false,
|
||||
// The following values are simply placeholders because configClock is false
|
||||
.dividerType = CY_SYSCLK_DIV_8_BIT,
|
||||
.dividerNum = 0,
|
||||
.dividerIntValue = 0,
|
||||
.dividerFracValue = 0,
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -624,6 +624,7 @@ void cyhal_hwmgr_free(const cyhal_resource_inst_t* obj)
|
|||
uint32_t state = cyhal_system_critical_section_enter();
|
||||
cy_rslt_t rslt = cyhal_clear_bit(cyhal_used, obj->type, obj->block_num, obj->channel_num);
|
||||
CY_ASSERT(CY_RSLT_SUCCESS == rslt);
|
||||
(void)rslt; //Avoid warning about unused variable in Release builds
|
||||
cyhal_system_critical_section_exit(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ static void cyhal_i2c_irq_handler(void)
|
|||
|
||||
if (obj->async)
|
||||
{
|
||||
/* This code is part of cyhal_i2c_master_transfer_async() API functionality */
|
||||
/* cyhal_i2c_master_transfer_async() API uses this interrupt handler for RX Transfer */
|
||||
if (0 == (Cy_SCB_I2C_MasterGetStatus(obj->base, &obj->context) & CY_SCB_I2C_MASTER_BUSY))
|
||||
{
|
||||
if (obj->tx_config.bufferSize)
|
||||
|
|
|
@ -90,7 +90,7 @@ cy_rslt_t cyhal_pwm_init(cyhal_pwm_t *obj, cyhal_gpio_t pin, const cyhal_clock_d
|
|||
en_clk_dst_t pclk = (en_clk_dst_t)(CYHAL_TCPWM_DATA[obj->resource.block_num].clock_dst + obj->resource.channel_num);
|
||||
if (NULL != clk)
|
||||
{
|
||||
obj->clock_hz = cy_PeriClkFreqHz / (1 + Cy_SysClk_PeriphGetDivider(clk->div_type, clk->div_num));
|
||||
obj->clock_hz = Cy_SysClk_ClkPeriGetFrequency() / (1 + Cy_SysClk_PeriphGetDivider(clk->div_type, clk->div_num));
|
||||
if (CY_SYSCLK_SUCCESS != Cy_SysClk_PeriphAssignDivider(pclk, clk->div_type, clk->div_num))
|
||||
result = CYHAL_PWM_RSLT_FAILED_CLOCK_INIT;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ cy_rslt_t cyhal_pwm_init(cyhal_pwm_t *obj, cyhal_gpio_t pin, const cyhal_clock_d
|
|||
result = CYHAL_PWM_RSLT_FAILED_CLOCK_INIT;
|
||||
else
|
||||
{
|
||||
obj->clock_hz = cy_PeriClkFreqHz / div;
|
||||
obj->clock_hz = Cy_SysClk_ClkPeriGetFrequency() / div;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ static const cy_stc_smif_config_t default_qspi_config =
|
|||
};
|
||||
|
||||
/* List of available QSPI instances */
|
||||
SMIF_Type *smif_base_addresses[CY_IP_MXSMIF_INSTANCES] =
|
||||
static SMIF_Type *const smif_base_addresses[CY_IP_MXSMIF_INSTANCES] =
|
||||
{
|
||||
#ifdef SMIF0
|
||||
SMIF0,
|
||||
|
@ -91,7 +91,7 @@ SMIF_Type *smif_base_addresses[CY_IP_MXSMIF_INSTANCES] =
|
|||
};
|
||||
|
||||
/* List of available QSPI interrupt sources */
|
||||
IRQn_Type CYHAL_QSPI_IRQ_N[CY_IP_MXSMIF_INSTANCES] =
|
||||
static const IRQn_Type CYHAL_QSPI_IRQ_N[CY_IP_MXSMIF_INSTANCES] =
|
||||
{
|
||||
#ifdef SMIF0
|
||||
smif_interrupt_IRQn,
|
||||
|
|
|
@ -31,7 +31,7 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
|
||||
CySCB_Type* CYHAL_SCB_BASE_ADDRESSES[CY_IP_MXSCB_INSTANCES] =
|
||||
CySCB_Type* const CYHAL_SCB_BASE_ADDRESSES[CY_IP_MXSCB_INSTANCES] =
|
||||
{
|
||||
#ifdef SCB0
|
||||
SCB0,
|
||||
|
@ -83,7 +83,7 @@ CySCB_Type* CYHAL_SCB_BASE_ADDRESSES[CY_IP_MXSCB_INSTANCES] =
|
|||
#endif
|
||||
};
|
||||
|
||||
IRQn_Type CYHAL_SCB_IRQ_N[CY_IP_MXSCB_INSTANCES] =
|
||||
const IRQn_Type CYHAL_SCB_IRQ_N[CY_IP_MXSCB_INSTANCES] =
|
||||
{
|
||||
#ifdef SCB0
|
||||
scb_0_interrupt_IRQn,
|
||||
|
|
|
@ -157,7 +157,7 @@ static SDHC_Type * const CYHAL_SDHC_BASE_ADDRESSES[CY_IP_MXSDHC_INSTANCES] =
|
|||
};
|
||||
|
||||
/* List of available SDHC HF clocks */
|
||||
static uint8_t const CYHAL_SDHC_HF_CLOCKS[CY_IP_MXSDHC_INSTANCES] =
|
||||
static const uint8_t CYHAL_SDHC_HF_CLOCKS[CY_IP_MXSDHC_INSTANCES] =
|
||||
{
|
||||
#ifdef SDHC0
|
||||
4,
|
||||
|
@ -170,7 +170,7 @@ static uint8_t const CYHAL_SDHC_HF_CLOCKS[CY_IP_MXSDHC_INSTANCES] =
|
|||
|
||||
|
||||
/* List of available SDHC interrupt sources */
|
||||
static IRQn_Type const CYHAL_SDHC_IRQ_N[CY_IP_MXSDHC_INSTANCES] =
|
||||
static const IRQn_Type CYHAL_SDHC_IRQ_N[CY_IP_MXSDHC_INSTANCES] =
|
||||
{
|
||||
#ifdef SDHC0
|
||||
sdhc_0_interrupt_general_IRQn,
|
||||
|
@ -208,7 +208,7 @@ static void *cyhal_sd_config_structs[CY_IP_MXSDHC_INSTANCES];
|
|||
|
||||
|
||||
/* Structure to map SDHC events on SDHC interrupts */
|
||||
const uint32_t eventMap[SDHC_EVENTS_NUM][SDHC_EVENTS_MAP_NUM] =
|
||||
static const uint32_t eventMap[SDHC_EVENTS_NUM][SDHC_EVENTS_MAP_NUM] =
|
||||
{
|
||||
{ (uint32_t)CYHAL_SDHC_CMD_COMPLETE, (uint32_t)CY_SD_HOST_CMD_COMPLETE},
|
||||
{ (uint32_t)CYHAL_SDHC_XFER_COMPLETE, (uint32_t)CY_SD_HOST_XFER_COMPLETE },
|
||||
|
@ -1089,16 +1089,13 @@ void cyhal_sdhc_enable_event(cyhal_sdhc_t *obj, cyhal_sdhc_event_t event, uint8_
|
|||
/* Enable specific interrupt */
|
||||
if((uint32_t) event < (uint32_t) CYHAL_SDHC_ALL_INTERRUPTS)
|
||||
{
|
||||
obj->irq_cause |= event;
|
||||
uint32_t event_count = SDHC_EVENTS_NUM;
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < event_count; i++)
|
||||
for (uint8_t i = 0; i < SDHC_EVENTS_NUM; i++)
|
||||
{
|
||||
const uint32_t *map_entry = eventMap[i];
|
||||
if ((map_entry[SDHC_EVENT] & obj->irq_cause) != 0)
|
||||
if ((map_entry[SDHC_EVENT] & (uint32_t) event) != 0)
|
||||
{
|
||||
interruptMask |= map_entry[SDHC_ISR];
|
||||
interruptMask |= map_entry[SDHC_ISR];
|
||||
obj->irq_cause |= map_entry[SDHC_ISR];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1114,16 +1111,13 @@ void cyhal_sdhc_enable_event(cyhal_sdhc_t *obj, cyhal_sdhc_event_t event, uint8_
|
|||
{
|
||||
if((uint32_t) event < (uint32_t) CYHAL_SDHC_ALL_INTERRUPTS)
|
||||
{
|
||||
obj->irq_cause &= ~event;
|
||||
uint32_t event_count = SDHC_EVENTS_NUM;
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < event_count; i++)
|
||||
for (uint8_t i = 0; i < SDHC_EVENTS_NUM; i++)
|
||||
{
|
||||
const uint32_t *map_entry = eventMap[i];
|
||||
if ((map_entry[SDHC_EVENT] & obj->irq_cause) != 0)
|
||||
if ((map_entry[SDHC_EVENT] & (uint32_t) event) != 0)
|
||||
{
|
||||
interruptMask &= ~map_entry[SDHC_ISR];
|
||||
interruptMask &= ~map_entry[SDHC_ISR];
|
||||
obj->irq_cause &= ~map_entry[SDHC_ISR];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -500,17 +500,17 @@ static cy_rslt_t cyhal_int_spi_frequency(cyhal_spi_t *obj, uint32_t hz, uint8_t
|
|||
for (oversample_value = SPI_OVERSAMPLE_MIN; oversample_value <= SPI_OVERSAMPLE_MAX; oversample_value++)
|
||||
{
|
||||
oversampled_freq = hz * oversample_value;
|
||||
if ((hz * oversample_value > cy_PeriClkFreqHz) && (SPI_OVERSAMPLE_MIN == oversample_value))
|
||||
if ((hz * oversample_value > Cy_SysClk_ClkPeriGetFrequency()) && (SPI_OVERSAMPLE_MIN == oversample_value))
|
||||
{
|
||||
return CYHAL_SPI_RSLT_CLOCK_ERROR;
|
||||
}
|
||||
else if (hz * oversample_value > cy_PeriClkFreqHz)
|
||||
else if (hz * oversample_value > Cy_SysClk_ClkPeriGetFrequency())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
divider_value = cyhal_divider_value(hz * oversample_value, 0);
|
||||
divided_freq = cy_PeriClkFreqHz /(divider_value + 1);
|
||||
divided_freq = Cy_SysClk_ClkPeriGetFrequency() /(divider_value + 1);
|
||||
diff = max(oversampled_freq, divided_freq) - min(oversampled_freq, divided_freq);
|
||||
|
||||
if (diff < last_diff)
|
||||
|
@ -534,7 +534,7 @@ static cy_rslt_t cyhal_int_spi_frequency(cyhal_spi_t *obj, uint32_t hz, uint8_t
|
|||
float desired_period_us = 1 / (float)hz * 1e6;
|
||||
uint32_t required_frequency = (uint32_t)(3e6 / (0.5f * desired_period_us - 36.66f / 1e3));
|
||||
|
||||
if (required_frequency > cy_PeriClkFreqHz)
|
||||
if (required_frequency > Cy_SysClk_ClkPeriGetFrequency())
|
||||
{
|
||||
return CYHAL_SPI_RSLT_CLOCK_ERROR;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
const cy_stc_tcpwm_counter_config_t default_config =
|
||||
static const cy_stc_tcpwm_counter_config_t default_config =
|
||||
{
|
||||
.period = 32768,
|
||||
.clockPrescaler = CY_TCPWM_COUNTER_PRESCALER_DIVBY_1,
|
||||
|
@ -102,7 +102,7 @@ cy_rslt_t cyhal_timer_init(cyhal_timer_t *obj, cyhal_gpio_t pin, const cyhal_clo
|
|||
{
|
||||
obj->clock = *clk;
|
||||
obj->dedicated_clock = false;
|
||||
obj->clock_hz = cy_PeriClkFreqHz / (1 + Cy_SysClk_PeriphGetDivider(obj->clock.div_type, obj->clock.div_num));
|
||||
obj->clock_hz = Cy_SysClk_ClkPeriGetFrequency() / (1 + Cy_SysClk_PeriphGetDivider(obj->clock.div_type, obj->clock.div_num));
|
||||
if (CY_SYSCLK_SUCCESS != Cy_SysClk_PeriphAssignDivider(pclk, clk->div_type, clk->div_num))
|
||||
{
|
||||
result = CYHAL_TIMER_RSLT_ERR_CLOCK_INIT;
|
||||
|
@ -215,7 +215,7 @@ cy_rslt_t cyhal_timer_set_frequency(cyhal_timer_t *obj, uint32_t hz)
|
|||
|
||||
if(CY_RSLT_SUCCESS == result)
|
||||
{
|
||||
uint32_t div = cy_PeriClkFreqHz / hz;
|
||||
uint32_t div = Cy_SysClk_ClkPeriGetFrequency() / hz;
|
||||
if (0 == div ||
|
||||
CY_SYSCLK_SUCCESS != Cy_SysClk_PeriphSetDivider(obj->clock.div_type, obj->clock.div_num, div - 1) ||
|
||||
CY_SYSCLK_SUCCESS != Cy_SysClk_PeriphEnableDivider(obj->clock.div_type, obj->clock.div_num))
|
||||
|
@ -224,7 +224,7 @@ cy_rslt_t cyhal_timer_set_frequency(cyhal_timer_t *obj, uint32_t hz)
|
|||
}
|
||||
else
|
||||
{
|
||||
obj->clock_hz = cy_PeriClkFreqHz / div;
|
||||
obj->clock_hz = Cy_SysClk_ClkPeriGetFrequency() / div;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ void cyhal_uart_free(cyhal_uart_t *obj)
|
|||
|
||||
static uint32_t cyhal_uart_actual_baud(uint32_t divider, uint32_t oversample)
|
||||
{
|
||||
return cy_PeriClkFreqHz / ((divider + 1) * oversample);
|
||||
return Cy_SysClk_ClkPeriGetFrequency() / ((divider + 1) * oversample);
|
||||
}
|
||||
|
||||
static uint32_t cyhal_uart_baud_perdif(uint32_t desired_baud, uint32_t actual_baud)
|
||||
|
|
|
@ -74,7 +74,7 @@ static bool op_pending = false;
|
|||
/*******************************************************************************
|
||||
* (Internal) Configuration structures for SDIO pins
|
||||
*******************************************************************************/
|
||||
const cy_stc_gpio_pin_config_t pin_cmd_config =
|
||||
static const cy_stc_gpio_pin_config_t pin_cmd_config =
|
||||
{
|
||||
.outVal = 1,
|
||||
.driveMode = CY_GPIO_DM_STRONG,
|
||||
|
@ -91,7 +91,7 @@ const cy_stc_gpio_pin_config_t pin_cmd_config =
|
|||
.vohSel = 0UL,
|
||||
};
|
||||
|
||||
const cy_stc_gpio_pin_config_t pin_data_config =
|
||||
static const cy_stc_gpio_pin_config_t pin_data_config =
|
||||
{
|
||||
.outVal = 1,
|
||||
.driveMode = CY_GPIO_DM_STRONG,
|
||||
|
@ -108,7 +108,7 @@ const cy_stc_gpio_pin_config_t pin_data_config =
|
|||
.vohSel = 0UL,
|
||||
};
|
||||
|
||||
const cy_stc_gpio_pin_config_t pin_clk_config =
|
||||
static const cy_stc_gpio_pin_config_t pin_clk_config =
|
||||
{
|
||||
.outVal = 1,
|
||||
.driveMode = CY_GPIO_DM_STRONG_IN_OFF,
|
||||
|
|
|
@ -92,7 +92,7 @@ static USBFS_Type* const CYHAL_USB_DEV_BASE_ADDRESSES[CY_IP_MXUSBFS_INSTANCES] =
|
|||
#endif
|
||||
};
|
||||
|
||||
static IRQn_Type CYHAL_USBDEV_IRQ_N[CY_IP_MXUSBFS_INSTANCES] =
|
||||
static const IRQn_Type CYHAL_USBDEV_IRQ_N[CY_IP_MXUSBFS_INSTANCES] =
|
||||
{
|
||||
#ifdef USBFS0
|
||||
usb_interrupt_lo_IRQn,
|
||||
|
@ -115,7 +115,7 @@ static void cyhal_usb_0_dev_ep0_setup_callback(USBFS_Type *base, struct cy_stc_u
|
|||
static void cyhal_usb_0_dev_ep0_in_callback(USBFS_Type *base, struct cy_stc_usbfs_dev_drv_context *drvContext);
|
||||
static void cyhal_usb_0_dev_ep0_out_callback(USBFS_Type *base, struct cy_stc_usbfs_dev_drv_context *drvContext);
|
||||
static cyhal_usb_dev_event_callback_t cyhal_usb_dev_event_callback_table[CY_IP_MXUSBFS_INSTANCES][CYHAL_USB_DEV_EVENT_NUM];
|
||||
static cy_cb_usbfs_dev_drv_callback_t cyhal_usb_dev_drv_event_cb_table[CY_IP_MXUSBFS_INSTANCES][CYHAL_USB_DEV_EVENT_NUM] =
|
||||
static const cy_cb_usbfs_dev_drv_callback_t cyhal_usb_dev_drv_event_cb_table[CY_IP_MXUSBFS_INSTANCES][CYHAL_USB_DEV_EVENT_NUM] =
|
||||
{
|
||||
/* USBFS0 */
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ static cy_cb_usbfs_dev_drv_callback_t cyhal_usb_dev_drv_event_cb_table[CY_IP_MXU
|
|||
|
||||
static void cyhal_usb_0_dev_sof_callback(USBFS_Type *base, struct cy_stc_usbfs_dev_drv_context *drvContext);
|
||||
static cyhal_usb_dev_sof_callback_t cyhal_usb_dev_sof_user_callback[CY_IP_MXUSBFS_INSTANCES];
|
||||
static cy_cb_usbfs_dev_drv_callback_t cyhal_usb_dev_drv_sof_cb_table[CY_IP_MXUSBFS_INSTANCES]=
|
||||
static const cy_cb_usbfs_dev_drv_callback_t cyhal_usb_dev_drv_sof_cb_table[CY_IP_MXUSBFS_INSTANCES]=
|
||||
{
|
||||
/* USBFS0 */
|
||||
&cyhal_usb_0_dev_sof_callback,
|
||||
|
@ -136,7 +136,7 @@ static cy_cb_usbfs_dev_drv_callback_t cyhal_usb_dev_drv_sof_cb_table[CY_IP_MXUSB
|
|||
|
||||
static void cyhal_usb_0_dev_ep_callback(USBFS_Type *base, uint32_t ep_addr, uint32_t errorType, cy_stc_usbfs_dev_drv_context_t *drvContext);
|
||||
static cyhal_usb_dev_endpoint_callback_t cyhal_usb_dev_ep_handler_table[CY_IP_MXUSBFS_INSTANCES][CYHAL_USB_DEV_EP_EVENT_NUM];
|
||||
static cy_cb_usbfs_dev_drv_ep_callback_t cyhal_usb_dev_drv_ep_cb_table[CY_IP_MXUSBFS_INSTANCES] =
|
||||
static const cy_cb_usbfs_dev_drv_ep_callback_t cyhal_usb_dev_drv_ep_cb_table[CY_IP_MXUSBFS_INSTANCES] =
|
||||
{
|
||||
/* USBFS0 */
|
||||
&cyhal_usb_0_dev_ep_callback,
|
||||
|
@ -388,7 +388,7 @@ static cy_rslt_t cyhal_usb_dev_peri_clock_setup(cyhal_usb_dev_t *obj, const cyha
|
|||
if (CY_RSLT_SUCCESS == result)
|
||||
{
|
||||
/* Get divider to provide 100kHz clock or less */
|
||||
uint32_t div_value = (cy_PeriClkFreqHz / CYHAL_USB_DEV_BUS_RESET_CLOCK_HZ) - 1U;
|
||||
uint32_t div_value = (Cy_SysClk_ClkPeriGetFrequency() / CYHAL_USB_DEV_BUS_RESET_CLOCK_HZ) - 1U;
|
||||
|
||||
(void) Cy_SysClk_PeriphDisableDivider(obj->clock.div_type, obj->clock.div_num);
|
||||
status = Cy_SysClk_PeriphSetDivider(obj->clock.div_type, obj->clock.div_num, div_value);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*******************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup group_hal_psoc6_wdt PSoC 6 WDT (Watchdog Timer)
|
||||
* \addtogroup group_hal_psoc6_wdt (WDT) Watchdog Timer
|
||||
* \ingroup group_hal_psoc6
|
||||
* \{
|
||||
* The PSoC 6 WDT is only capable of supporting certain timeout ranges below its maximum timeout of 6000ms.
|
||||
|
@ -80,7 +80,7 @@
|
|||
* <td>4</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* \} group_hal_psoc6
|
||||
* \} group_hal_psoc6_wdt
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
|
|
Loading…
Reference in New Issue