1 /** 2 * 3 * Copyright (c) 2019 Microchip Technology Inc. and its subsidiaries. 4 * 5 * \asf_license_start 6 * 7 * \page License 8 * 9 * SPDX-License-Identifier: Apache-2.0 10 * 11 * Licensed under the Apache License, Version 2.0 (the "License"); you may 12 * not use this file except in compliance with the License. 13 * You may obtain a copy of the Licence at 14 * 15 * http://www.apache.org/licenses/LICENSE-2.0 16 * 17 * Unless required by applicable law or agreed to in writing, software 18 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 19 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 * See the License for the specific language governing permissions and 21 * limitations under the License. 22 * 23 * \asf_license_stop 24 * 25 */ 26 27 /** @file led.h 28 *MEC1501 Breathing-Blinking LED definitions 29 */ 30 /** @defgroup MEC1501 Peripherals LED 31 */ 32 33 #ifndef _LED_H 34 #define _LED_H 35 36 #define MCHP_LED_NUM_BLOCKS 3u 37 38 #define MCHP_LED_CFG_OFS 0x00u 39 #define MCHP_LED_LIMITS_OFS 0x04u 40 #define MCHP_LED_DELAY_OFS 0x08u 41 #define MCHP_LED_UPD_STEP_OFS 0x0cu 42 #define MCHP_LED_UPD_INTRVL_OFS 0x10u 43 #define MCHP_LED_OUTPUT_DLY_OFS 0x14u 44 45 /* 46 * LED Configuration Register 47 */ 48 #define MCHP_LED_CFG_CNTL_MASK 0x0003u 49 #define MCHP_LED_CFG_CNTL_LO 0x0000u 50 #define MCHP_LED_CFG_CNTL_BREATH 0x0001u 51 #define MCHP_LED_CFG_CNTL_BLINK 0x0002u 52 #define MCHP_LED_CFG_CNTL_HI 0x0003u 53 #define MCHP_LED_CFG_CLK_SRC_MCLK 0x0002u 54 #define MCHP_LED_CFG_CLK_SRC_32K 0x0000u 55 #define MCHP_LED_CFG_SYNC 0x0008u 56 #define MCHP_LED_CFG_PWM_COUNT_WIDTH_MASK 0x0030u 57 #define MCHP_LED_CFG_COUNT_WIDTH_8 0x0000u 58 #define MCHP_LED_CFG_COUNT_WIDTH_7 0x0010u 59 #define MCHP_LED_CFG_COUNT_WIDTH_6 0x0020u 60 #define MCHP_LED_CFG_EN_UPDATE 0x0040u 61 #define MCHP_LED_CFG_RESET 0x0080u 62 #define MCHP_LED_CFG_WDT_PRELOAD_MASK 0xff00u 63 #define MCHP_LED_CFG_WDT_PRELOAD_POR 0x1400u 64 #define MCHP_LED_CFG_SYMMETRY_EN 0x10000u 65 66 /* 67 * LED Limit Register 68 */ 69 #define MCHP_LED_LIM_MIN_POS 0u 70 #define MCHP_LED_LIM_MIN_MASK 0xffu 71 #define MCHP_LED_LIM_MAX_POS 8u 72 #define MCHP_LED_LIM_MAX_MASK 0xff00u 73 74 /* 75 * LED Delay Register 76 */ 77 #define MCHP_LED_DLY_LO_MASK 0x0000fffu 78 #define MCHP_LED_DLY_HI_MASK 0x0fff000u 79 #define MCHP_LED_DLY_HI_POS 12u 80 81 /* 82 * LED Step Size Register 83 */ 84 #define MCHP_LED_STEP_FIELD_WIDTH 4u 85 #define MCHP_LED_STEP_MASK0 0x0fu 86 #define MCHP_LED_STEP0_POS 0u 87 #define MCHP_LED_STEP0_MASK 0x0000000fu 88 #define MCHP_LED_STEP1_POS 4u 89 #define MCHP_LED_STEP1_MASK 0x000000f0u 90 #define MCHP_LED_STEP2_POS 8u 91 #define MCHP_LED_STEP2_MASK 0x00000f00u 92 #define MCHP_LED_STEP3_POS 12u 93 #define MCHP_LED_STEP3_MASK 0x0000f000u 94 #define MCHP_LED_STEP4_POS 16u 95 #define MCHP_LED_STEP4_MASK 0x000f0000u 96 #define MCHP_LED_STEP5_POS 20u 97 #define MCHP_LED_STEP5_MASK 0x00f00000u 98 #define MCHP_LED_STEP6_POS 24u 99 #define MCHP_LED_STEP6_MASK 0x0f000000u 100 #define MCHP_LED_STEP7_POS 28u 101 #define MCHP_LED_STEP7_MASK 0xf0000000u 102 103 /* 104 * LED Update Register 105 */ 106 #define MCHP_LED_UPDT_FIELD_WIDTH 4u 107 #define MCHP_LED_UPDT_MASK0 0x0fu; 108 #define MCHP_LED_UPDT0_POS 0u 109 #define MCHP_LED_UPDT0_MASK 0x0000000fu 110 #define MCHP_LED_UPDT1_POS 4u 111 #define MCHP_LED_UPDT1_MASK 0x000000f0u 112 #define MCHP_LED_UPDT2_POS 8u 113 #define MCHP_LED_UPDT2_MASK 0x00000f00u 114 #define MCHP_LED_UPDT3_POS 12u 115 #define MCHP_LED_UPDT3_MASK 0x0000f000u 116 #define MCHP_LED_UPDT4_POS 16u 117 #define MCHP_LED_UPDT4_MASK 0x000f0000u 118 #define MCHP_LED_UPDT5_POS 20u 119 #define MCHP_LED_UPDT5_MASK 0x00f00000u 120 #define MCHP_LED_UPDT6_POS 24u 121 #define MCHP_LED_UPDT6_MASK 0x0f000000u 122 #define MCHP_LED_UPDT7_POS 28u 123 #define MCHP_LED_UPDT7_MASK 0xf0000000u 124 125 #define MCHP_BLINK_0P5_HZ_DUTY_CYCLE 0x010u 126 #define MCHP_BLINK_0P5_HZ_PRESCALE 0x0ffu 127 #define MCHP_BLINK_1_HZ_DUTY_CYCLE 0x020u 128 #define MCHP_BLINK_1_HZ_PRESCALE 0x07fu 129 130 /* =======================================================================*/ 131 /* ================ LED ================ */ 132 /* =======================================================================*/ 133 134 #define MCHP_LED_MAX_INSTANCES 4u 135 #define MCHP_LED_SPACING 0x100u 136 #define MCHP_LED_SPACING_PWROF2 8u 137 138 #define MCHP_LED_BASE_ADDR 0x4000b800u 139 140 #define MCHP_LED0_ADDR 0x4000b800u 141 #define MCHP_LED1_ADDR 0x4000b900u 142 #define MCHP_LED2_ADDR 0x4000ba00u 143 #define MCHP_LED3_ADDR 0x4000bb00u 144 145 #define MCHP_LED_ADDR(n) \ 146 (MCHP_LED_BASE_ADDR + ((uint32_t)(n) << MCHP_LED_SPACING_PWROF2)) 147 148 /** 149 * @brief Breathing-Blinking LED (LED) 150 */ 151 typedef struct led_regs 152 { /*!< (@ 0x4000b800) LED Structure */ 153 __IOM uint32_t CFG; /*! (@ 0x00000000) LED configuration */ 154 __IOM uint32_t LIMIT; /*! (@ 0x00000004) LED limits */ 155 __IOM uint32_t DLY; /*! (@ 0x00000008) LED delay */ 156 __IOM uint32_t STEP; /*! (@ 0x0000000c) LED update step size */ 157 __IOM uint32_t INTRVL; /*! (@ 0x00000010) LED update interval */ 158 __IOM uint32_t OUTDLY; /*! (@ 0x00000014) LED output delay */ 159 } LED_Type; 160 161 #endif /* #ifndef _LED_H */ 162 /* end led.h */ 163 /** @} 164 */ 165