Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91266497
pindefs.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 9, 12:21
Size
1 KB
Mime Type
text/x-c
Expires
Mon, Nov 11, 12:21 (2 d)
Engine
blob
Format
Raw Data
Handle
22232854
Attached To
R6618 Oncilla Power Management Board Firmware
pindefs.c
View Options
#include "p33FJ128GP802.h"
#include "pindefs.h"
/** \brief initialize all the pins for I/O
* initialize all the pins for I/O
*/
void
pin_init
()
{
// pin default configuration
ADPCFG
=
0xFFFF
;
// Set all Analog ports as Digital I/O
// battery power monitoring
TRISAbits
.
TRISA0
=
1
;
// BATT_VOLTAGE is input
TRISAbits
.
TRISA1
=
1
;
// BATT_CURRENT is input
// enable signals for power supplies
TRISAbits
.
TRISA3
=
0
;
// SERVO_VOLTAGE_EN is output
TRISAbits
.
TRISA4
=
0
;
// DIGITAL_VOLTAGE_EN is output
TRISBbits
.
TRISB3
=
0
;
// MOTOR_VOLTAGE_EN is output
TRISBbits
.
TRISB2
=
0
;
// POWER_EN is output
// switch button inputs
TRISBbits
.
TRISB12
=
1
;
// SW1 is input
TRISBbits
.
TRISB0
=
1
;
// SW2 is input
TRISBbits
.
TRISB1
=
1
;
// SW3 is input
// led driver interface
TRISBbits
.
TRISB4
=
0
;
// LED_CLK is output
TRISBbits
.
TRISB13
=
0
;
// LED_LE is output
TRISBbits
.
TRISB14
=
0
;
// LED_OE is output
TRISBbits
.
TRISB15
=
0
;
// LED_SDO is output
// speaker output
TRISBbits
.
TRISB11
=
0
;
// SPEAKER is output
_RP11R
=
0
b10010
;
// Map OC1 to RP11
//-------------- SPI 1 -------------------------------------------
_RP15R
=
0
b00111
;
// Map SPI SDO to RP15
_RP4R
=
0
b01000
;
// Map SPI SCK out to RP4
}
Event Timeline
Log In to Comment