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

rtos_pmd.c
1 /*
2 * File: init_pmd.c
3 * Author: M91406
4 *
5 * Created on July 8, 2019, 6:26 PM
6 */
7
8
9 #include <xc.h> // include processor files - each processor file is guarded.
10 #include <stdint.h> // include standard integer data types
11 #include <stdbool.h> // include standard boolean data types
12 #include <stddef.h> // include standard definition data types
13
14 #include "common/p33c_pral/xc16_pral.h" // include common peripheral abstraction layer driver header file
15 #include "rtos_pmd.h" // include RTOS peripheral module disable initialization header file
16
17 /***********************************************************************************
18 * @fn uint16_t osPmd_Initialize(void)
19 * @ingroup pmd-initialization
20 * @brief Powers down all device peripherals
21 * @return unsigned integer (0=failure, 1=success)
22 *
23 * @details
24 * When the device is coming out of RESET, all peripheral modules are powered
25 * and active, ready to be initialized and used. However, each active peripheral
26 * consumes power and accidental writes to any of its special function registers
27 * may be a potential source for undesired behavior. Hence, in this application
28 * all power supply to all peripheral modules are disabled, minimizing the device
29 * power consumption and preventing potential misbehavior of unused peripheral
30 * modules.
31 *
32 * @note
33 * Unpowered peripherals cannot be initialized and reads from/write to the
34 * respective special function registers will fail until the power supply to
35 * the peripheral has been enabled. Hence, power to peripheral modules has to
36 * be enabled before any initialization of its register can take place.
37 *
38 * Depending on the peripheral a short delay period may be required for the
39 * peripheral functions to become available after power up.
40 *
41 * Please refer to the device data sheet for details.
42 *
43 **********************************************************************************/
44
45 volatile uint16_t osPmd_Initialize(void) {
46
47 volatile uint16_t retval=1;
48
49 // Enable all peripherals
50 retval &= p33c_Pmd_ConfigWrite(pmdConfigDefault);
51
52 return(retval);
53 }
54
55 // end of file