| Digital Power Starter Kit 3 Firmware dsPIC33C Boost Converter Voltage Mode Control Example |

app_led.h
1 /* Microchip Technology Inc. and its subsidiaries. You may use this software
2 * and any derivatives exclusively with Microchip products.
3 *
4 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
5 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
6 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
7 * PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
8 * WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
9 *
10 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
11 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
12 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
13 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
14 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS
15 * IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF
16 * ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
17 *
18 * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
19 * TERMS.
20 */
21
22 /*
23 * File: app_led.h
24 * Author: M91406
25 * Comments: LED application layer
26 * Revision history:
27 */
28
29 // This is a guard condition so that contents of this file are not included
30 // more than once.
31 #ifndef APPLICATION_LAYER_DEBUGGING_LED_H
32 #define APPLICATION_LAYER_DEBUGGING_LED_H
33
34 #include <xc.h> // include processor files - each processor file is guarded.
35 #include <stdint.h> // include standard integer data types
36 #include <stdbool.h> // include standard boolean data types
37 #include <stddef.h> // include standard definition data types
38
39
40 // CUSTOM DECLARATIONS
41 #define DBGLED_PERIOD_FAST 2499
42 #define DBGLED_PERIOD_DEFAULT 4999
43 #define DBGLED_PERIOD_STANDBY 9999
44
45 /***********************************************************************************
46 * @ingroup app-layer-debug-led-properties-public
47 * @struct DEBUGGING_LED_s
48 * @brief Debugging LED settings data object
49 * @details
50 * This data structure holds all adjustable parameters used by the debugging
51 * LED driver required to tailor the driver functions to specific application
52 * requirements.
53 **********************************************************************************/
54
55 struct DEBUGGING_LED_STATUS_s{
56 union {
57 struct{
58
59 unsigned on : 1; // Bit #0: Flag bit, set and cleared by software driver, indicating the debugging LED is currently on (read only)
60 unsigned : 1; // Bit #1: (reserved)
61 unsigned : 1; // Bit #2: (reserved)
62 unsigned : 1; // Bit #3: (reserved)
63 unsigned : 1; // Bit #4: (reserved)
64 unsigned : 1; // Bit #5: (reserved)
65 unsigned : 1; // Bit #6: (reserved)
66 unsigned : 1; // Bit #7: (reserved)
67
68 unsigned : 1; // Bit #8: (reserved)
69 unsigned : 1; // Bit #9: (reserved)
70 unsigned : 1; // Bit #10: (reserved)
71 unsigned : 1; // Bit #11: (reserved)
72 unsigned : 1; // Bit #12: (reserved)
73 unsigned : 1; // Bit #13: (reserved)
74 unsigned : 1; // Bit #14: (reserved)
75 unsigned enabled; // Bit #15: Control bit enabling and disabling the Debugging LED function
76 } __attribute__((packed)) bits;
77
78 volatile uint16_t value; // buffer for 16-bit word read/write operations
79 };
80 };
81 typedef struct DEBUGGING_LED_STATUS_s DEBUGGING_LED_STATUS_t;
82
83 struct DEBUGGING_LED_s{
84 volatile struct DEBUGGING_LED_STATUS_s status;
85 volatile uint16_t period; //< Period setting of the Debugging LED driver
86 };
87 typedef struct DEBUGGING_LED_s DEBUGGING_LED_t;
88
89 // PUBLIC VARIABLE DECLARATION
90 extern volatile DEBUGGING_LED_t debug_led;
91
92 // PUBLIC FUNCTION PROTOTYPE DECLARATION
93 extern volatile uint16_t appLED_Initialize(void);
94 extern volatile uint16_t appLED_Execute(void);
95 extern volatile uint16_t appLED_Start(void);
96 extern volatile uint16_t appLED_Dispose(void);
97
98 #endif /* APPLICATION_LAYER_DEBUGGING_LED_H */
99
DEBUGGING_LED_STATUS_s
Definition: app_led.h:55
DEBUGGING_LED_s::period
volatile uint16_t period
Definition: app_led.h:85
DEBUGGING_LED_STATUS_s::on
unsigned on
Definition: app_led.h:59
DEBUGGING_LED_s
Definition: app_led.h:83
DEBUGGING_LED_s::status
volatile struct DEBUGGING_LED_STATUS_s status
Status word of the Debugging LED driver.
Definition: app_led.h:84
DEBUGGING_LED_STATUS_s::enabled
unsigned enabled
Definition: app_led.h:75
DEBUGGING_LED_STATUS_s::value
volatile uint16_t value
Definition: app_led.h:78