Skip to content

Commit 5eec250

Browse files
committed
Adding new CEs
1 parent d5e9a66 commit 5eec250

File tree

135 files changed

+42764
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+42764
-0
lines changed
Binary file not shown.

CE220060_PSoC6_WatchdogTimer - Copy/CE225909_PSoC6_BatteryLevel_RTOS/GeneratedSource/cycfg_ble.c

Lines changed: 2099 additions & 0 deletions
Large diffs are not rendered by default.

CE220060_PSoC6_WatchdogTimer - Copy/CE225909_PSoC6_BatteryLevel_RTOS/GeneratedSource/cycfg_ble.h

Lines changed: 1191 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# This makefile is just here so that typing 'make' in this directory
3+
# works. This makefile just includes the modus.mk. The modus.mk name
4+
# is special in IDE environments and is a trigger so that the IDE knows
5+
# this is a modus compliant example that supports the IDE related targets
6+
#
7+
8+
PLATFORM ?= PSOC6_DUAL_CORE
9+
ifeq ($(PLATFORM),PSOC6_DUAL_CORE)
10+
DEVICE=CY8C6347BZI-BLD53
11+
else
12+
DEVICE=CY8C6337BZI-BLF13
13+
endif
14+
15+
include modus.mk
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
/*
2+
* FreeRTOS Kernel V10.0.1
3+
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
* this software and associated documentation files (the "Software"), to deal in
7+
* the Software without restriction, including without limitation the rights to
8+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
* the Software, and to permit persons to whom the Software is furnished to do so,
10+
* subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
* http://www.FreeRTOS.org
23+
* http://aws.amazon.com/freertos
24+
*
25+
* 1 tab == 4 spaces!
26+
*/
27+
28+
#ifndef FREERTOS_CONFIG_H
29+
#define FREERTOS_CONFIG_H
30+
31+
/*-----------------------------------------------------------
32+
* Application specific definitions.
33+
*
34+
* These definitions should be adjusted for your particular hardware and
35+
* application requirements.
36+
*
37+
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
38+
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
39+
*
40+
* See http://www.freertos.org/a00110.html.
41+
*----------------------------------------------------------*/
42+
43+
#include "cy_syslib.h"
44+
45+
#define configUSE_PREEMPTION 1
46+
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
47+
#define configUSE_TICKLESS_IDLE 0
48+
#define configCPU_CLOCK_HZ SystemCoreClock
49+
#define configTICK_RATE_HZ 1000u
50+
#define configMAX_PRIORITIES 7
51+
#define configMINIMAL_STACK_SIZE 128
52+
#define configMAX_TASK_NAME_LEN 32
53+
#define configUSE_16_BIT_TICKS 0
54+
#define configIDLE_SHOULD_YIELD 1
55+
#define configUSE_TASK_NOTIFICATIONS 1
56+
#define configUSE_MUTEXES 0
57+
#define configUSE_RECURSIVE_MUTEXES 0
58+
#define configUSE_COUNTING_SEMAPHORES 0
59+
#define configQUEUE_REGISTRY_SIZE 10
60+
#define configUSE_QUEUE_SETS 0
61+
#define configUSE_TIME_SLICING 0
62+
#define configUSE_NEWLIB_REENTRANT 0
63+
#define configENABLE_BACKWARD_COMPATIBILITY 0
64+
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5
65+
66+
/* Memory allocation related definitions. */
67+
#define configSUPPORT_STATIC_ALLOCATION 0
68+
#define configSUPPORT_DYNAMIC_ALLOCATION 1
69+
#define configTOTAL_HEAP_SIZE 10240
70+
#define configAPPLICATION_ALLOCATED_HEAP 0
71+
72+
/* Hook function related definitions. */
73+
#define configUSE_IDLE_HOOK 0
74+
#define configUSE_TICK_HOOK 0
75+
#define configCHECK_FOR_STACK_OVERFLOW 2
76+
#define configUSE_MALLOC_FAILED_HOOK 1 /* Changed to use memory
77+
allocation failed hook */
78+
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
79+
80+
/* Run time and task stats gathering related definitions. */
81+
#define configGENERATE_RUN_TIME_STATS 0
82+
#define configUSE_TRACE_FACILITY 0
83+
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
84+
85+
/* Co-routine related definitions. */
86+
#define configUSE_CO_ROUTINES 0
87+
#define configMAX_CO_ROUTINE_PRIORITIES 1
88+
89+
/* Software timer related definitions. */
90+
#define configUSE_TIMERS 1
91+
#define configTIMER_TASK_PRIORITY configMAX_PRIORITIES
92+
#define configTIMER_QUEUE_LENGTH 10
93+
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
94+
95+
/* FreeRTOS MPU specific definitions. */
96+
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
97+
98+
/*
99+
Interrupt nesting behavior configuration.
100+
This is explained here: http://www.freertos.org/a00110.html
101+
102+
Priorities are controlled by two macros:
103+
- configKERNEL_INTERRUPT_PRIORITY determines the priority of the RTOS daemon task
104+
- configMAX_API_CALL_INTERRUPT_PRIORITY dictates the priority of ISRs that make API calls
105+
106+
Notes:
107+
1. Interrupts that do not call API functions should be >= configKERNEL_INTERRUPT_PRIORITY
108+
and will nest.
109+
2. Interrupts that call API functions must have priority between KERNEL_INTERRUPT_PRIORITY
110+
and MAX_API_CALL_INTERRUPT_PRIORITY (inclusive).
111+
3. Interrupts running above MAX_API_CALL_INTERRUPT_PRIORITY are never delayed by the OS.
112+
*/
113+
/*
114+
PSoC 6 __NVIC_PRIO_BITS = 3
115+
116+
0 (high)
117+
1 MAX_API_CALL_INTERRUPT_PRIORITY 001xxxxx (0x3F)
118+
2
119+
3
120+
4
121+
5
122+
6
123+
7 (low) KERNEL_INTERRUPT_PRIORITY 111xxxxx (0xFF)
124+
125+
!!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
126+
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
127+
128+
If you call a FreeRTOS API function from an interrupt with priority higher than
129+
MAX_API_CALL_INTERRUPT_PRIORITY FreeRTOS will generate an exception. If you need
130+
to call a FreeRTOS API function from your system's highest priority interrupt
131+
you must reduce all interrupt priorities to MAX_API_CALL_INTERRUPT_PRIORITY or
132+
lower.
133+
134+
If your system pipe (IPC) interrupt priority is less than or equal to
135+
MAX_API_CALL_INTERRUPT_PRIORITY then care must be taken with code that writes to
136+
flash (including the Flash/BLE/Emulated EEPROM/Bootloader drivers from Cypress
137+
PDL). The duration of critical sections must be kept short - see the
138+
Configuration Considerations section of the flash driver in the PDL API
139+
Reference.
140+
141+
*/
142+
143+
/* Put KERNEL_INTERRUPT_PRIORITY in top __NVIC_PRIO_BITS bits of CM4 register */
144+
#define configKERNEL_INTERRUPT_PRIORITY 0xFF
145+
/*
146+
Put MAX_SYSCALL_INTERRUPT_PRIORITY in top __NVIC_PRIO_BITS bits of CM4 register
147+
NOTE For IAR compiler make sure that changes of this macro is reflected in
148+
file portable\IAR\CM4F\portasm.s in PendSV_Handler: routine
149+
*/
150+
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 0x3F
151+
/* configMAX_API_CALL_INTERRUPT_PRIORITY is a new name for configMAX_SYSCALL_INTERRUPT_PRIORITY
152+
that is used by newer ports only. The two are equivalent. */
153+
#define configMAX_API_CALL_INTERRUPT_PRIORITY configMAX_SYSCALL_INTERRUPT_PRIORITY
154+
155+
156+
/* Set the following definitions to 1 to include the API function, or zero
157+
to exclude the API function. */
158+
#define INCLUDE_vTaskPrioritySet 1
159+
#define INCLUDE_uxTaskPriorityGet 1
160+
#define INCLUDE_vTaskDelete 1
161+
#define INCLUDE_vTaskSuspend 1
162+
#define INCLUDE_xResumeFromISR 1
163+
#define INCLUDE_vTaskDelayUntil 1
164+
#define INCLUDE_vTaskDelay 1
165+
#define INCLUDE_xTaskGetSchedulerState 1
166+
#define INCLUDE_xTaskGetCurrentTaskHandle 1
167+
#define INCLUDE_uxTaskGetStackHighWaterMark 0
168+
#define INCLUDE_xTaskGetIdleTaskHandle 0
169+
#define INCLUDE_eTaskGetState 0
170+
#define INCLUDE_xEventGroupSetBitFromISR 1
171+
#define INCLUDE_xTimerPendFunctionCall 0
172+
#define INCLUDE_xTaskAbortDelay 0
173+
#define INCLUDE_xTaskGetHandle 0
174+
#define INCLUDE_xTaskResumeFromISR 1
175+
176+
/* Normal assert() semantics without relying on the provision of an assert.h
177+
header file. */
178+
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
179+
180+
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
181+
standard names - or at least those used in the unmodified vector table. */
182+
#define vPortSVCHandler SVC_Handler
183+
#define xPortPendSVHandler PendSV_Handler
184+
#define xPortSysTickHandler SysTick_Handler
185+
186+
/* Dynamic Memory Allocation Schemes */
187+
#define HEAP_ALLOCATION_TYPE1 (1) /* heap_1.c*/
188+
#define HEAP_ALLOCATION_TYPE2 (2) /* heap_2.c*/
189+
#define HEAP_ALLOCATION_TYPE3 (3) /* heap_3.c*/
190+
#define HEAP_ALLOCATION_TYPE4 (4) /* heap_4.c*/
191+
#define HEAP_ALLOCATION_TYPE5 (5) /* heap_5.c*/
192+
#define NO_HEAP_ALLOCATION (0)
193+
194+
#define configHEAP_ALLOCATION_SCHEME (HEAP_ALLOCATION_TYPE4)
195+
196+
#endif /* FREERTOS_CONFIG_H */
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/******************************************************************************
2+
* File Name: battery_task.c
3+
*
4+
* Version 1.0
5+
*
6+
* Description: This file contains the task that simulates battery level.
7+
*
8+
* Related Document: CE225909_PSoC6_BatteryLevel_RTOS.pdf
9+
*
10+
* Hardware Dependency: See CE225909_PSoC6_BatteryLevel_RTOS.pdf
11+
*
12+
*******************************************************************************
13+
* Copyright (2019), Cypress Semiconductor Corporation. All rights reserved.
14+
*******************************************************************************
15+
* This software, including source code, documentation and related materials
16+
* (“Software”), is owned by Cypress Semiconductor Corporation or one of its
17+
* subsidiaries (“Cypress”) and is protected by and subject to worldwide patent
18+
* protection (United States and foreign), United States copyright laws and
19+
* international treaty provisions. Therefore, you may use this Software only
20+
* as provided in the license agreement accompanying the software package from
21+
* which you obtained this Software (“EULA”).
22+
*
23+
* If no EULA applies, Cypress hereby grants you a personal, nonexclusive,
24+
* non-transferable license to copy, modify, and compile the Software source
25+
* code solely for use in connection with Cypress’s integrated circuit products.
26+
* Any reproduction, modification, translation, compilation, or representation
27+
* of this Software except as specified above is prohibited without the express
28+
* written permission of Cypress.
29+
*
30+
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
31+
* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
32+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
33+
* reserves the right to make changes to the Software without notice. Cypress
34+
* does not assume any liability arising out of the application or use of the
35+
* Software or any product or circuit described in the Software. Cypress does
36+
* not authorize its products for use in any products where a malfunction or
37+
* failure of the Cypress product may reasonably be expected to result in
38+
* significant property damage, injury or death (“High Risk Product”). By
39+
* including Cypress’s product in a High Risk Product, the manufacturer of such
40+
* system or application assumes all risk of such use and in doing so agrees to
41+
* indemnify Cypress against all liability.
42+
*******************************************************************************/
43+
44+
/* Header file includes */
45+
#include "battery_task.h"
46+
#include "FreeRTOS.h"
47+
#include "task.h"
48+
#include "queue.h"
49+
#include "ble_task.h"
50+
51+
#define BATTERY_LEVEL_MAX (100u)
52+
#define BATTERY_LEVEL_MIN (0u)
53+
#define BATTERY_LEVEL_INCREMENT (10u)
54+
#define BATTERY_LEVEL_INCREMENT_DELAY (pdMS_TO_TICKS(2000u)) /* 2 second */
55+
56+
/*******************************************************************************
57+
* Function Name: void Task_Battery(void* pvParameters)
58+
********************************************************************************
59+
* Summary:
60+
* Task that simulate battery level. The task increments battery level by
61+
* (BATTERY_LEVEL_INCREMENT) after (BATTERY_LEVEL_INCREMENT_DELAY)
62+
*
63+
* Parameters:
64+
* void *pvParameters : Task parameter defined during task creation (unused)
65+
*
66+
* Return:
67+
* None
68+
*
69+
*******************************************************************************/
70+
void Task_Battery(void* pvParameters)
71+
{
72+
uint8_t batteryLevel = 0;
73+
74+
/* Remove warning for unused parameter */
75+
(void)pvParameters;
76+
77+
/* Repeatedly running part of the task */
78+
for(;;)
79+
{
80+
batteryLevel = batteryLevel + BATTERY_LEVEL_INCREMENT;
81+
82+
/* Keep the value in valid range */
83+
if(batteryLevel > BATTERY_LEVEL_MAX)
84+
{
85+
batteryLevel = BATTERY_LEVEL_MIN;
86+
}
87+
88+
/* Send updated battery level value to BLE Task */
89+
ble_command_data_t bleCommandData =
90+
{
91+
.command = BATTERY_LEVEL_UPDATE,
92+
.data = (uint32_t)batteryLevel
93+
};
94+
xQueueSend(bleCommandDataQ, &bleCommandData, 0u);
95+
96+
/* Block the task for 2 second */
97+
vTaskDelay(BATTERY_LEVEL_INCREMENT_DELAY);
98+
}
99+
}
100+
101+
/* [] END OF FILE */
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/******************************************************************************
2+
* File Name: battery_task.h
3+
*
4+
* Version 1.0
5+
*
6+
* Description: This file is the public interface of battery_task.c source file
7+
*
8+
* Related Document: CE225909_PSoC6_BatteryLevel_RTOS.pdf
9+
*
10+
* Hardware Dependency: See CE225909_PSoC6_BatteryLevel_RTOS.pdf
11+
*
12+
*******************************************************************************
13+
* Copyright (2019), Cypress Semiconductor Corporation. All rights reserved.
14+
*******************************************************************************
15+
* This software, including source code, documentation and related materials
16+
* (“Software”), is owned by Cypress Semiconductor Corporation or one of its
17+
* subsidiaries (“Cypress”) and is protected by and subject to worldwide patent
18+
* protection (United States and foreign), United States copyright laws and
19+
* international treaty provisions. Therefore, you may use this Software only
20+
* as provided in the license agreement accompanying the software package from
21+
* which you obtained this Software (“EULA”).
22+
*
23+
* If no EULA applies, Cypress hereby grants you a personal, nonexclusive,
24+
* non-transferable license to copy, modify, and compile the Software source
25+
* code solely for use in connection with Cypress’s integrated circuit products.
26+
* Any reproduction, modification, translation, compilation, or representation
27+
* of this Software except as specified above is prohibited without the express
28+
* written permission of Cypress.
29+
*
30+
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
31+
* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
32+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
33+
* reserves the right to make changes to the Software without notice. Cypress
34+
* does not assume any liability arising out of the application or use of the
35+
* Software or any product or circuit described in the Software. Cypress does
36+
* not authorize its products for use in any products where a malfunction or
37+
* failure of the Cypress product may reasonably be expected to result in
38+
* significant property damage, injury or death (“High Risk Product”). By
39+
* including Cypress’s product in a High Risk Product, the manufacturer of such
40+
* system or application assumes all risk of such use and in doing so agrees to
41+
* indemnify Cypress against all liability.
42+
*******************************************************************************/
43+
44+
/* Include guard */
45+
#ifndef SOURCE_BATTERY_TASK_H_
46+
#define SOURCE_BATTERY_TASK_H_
47+
48+
void Task_Battery(void* pvParameters);
49+
50+
#endif /* SOURCE_BATTERY_TASK_H_ */
51+
52+
/* [] END OF FILE */

0 commit comments

Comments
 (0)