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

rtos_gpio.c
1 /*
2 * File: init_gpio.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 "rtos_gpio.h" // include RTOS GPIO initialization header file
11
12 /***********************************************************************************
13 * @fn uint16_t osGpio_Initialize(void)
14 * @ingroup gpio-initialization
15 * @brief Resets the device input/output pins to digital inputs
16 * @return unsigned integer (0=failure, 1=success)
17 *
18 * @details
19 * When the device is coming out of RESET, all device pins are configured as
20 * inputs and all analog functions will be enabled. Enabled analog functions
21 * are a potential source for conflicts and are therefore turned off by default
22 * during device startup to allow all peripheral configuration drivers to start
23 * from a defined default state.
24 *
25 **********************************************************************************/
26
27 volatile uint16_t osGpio_Initialize(void) {
28
29 volatile uint16_t retval=1;
30
31 // Reset all analog inputs to be Digital I/Os
32 ANSELA = 0x0000; // Port A is available on all devices
33 ANSELB = 0x0000; // Port B is available on all devices
34
35 #if defined (ANSELC) // Pre-compile check if this device has a Port C
36 ANSELC = 0x0000; // Port C is only available on higher pin-count devices
37 #endif
38 #if defined (ANSELD) // Pre-compile check if this device has a Port D
39 ANSELD = 0x0000; // Port D is only available on higher pin-count devices
40 #endif
41 #if defined (ANSELE) // Pre-compile check if this device has a Port E
42 ANSELE = 0x0000; // Port E is only available on higher pin-count devices
43 #endif
44
45 return(retval);
46 }
47
48 // end of file