-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathio_cfg.h
88 lines (74 loc) · 3.5 KB
/
io_cfg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*********************************************************************
*
* Microchip USB C18 Firmware Version 1.0
*
*********************************************************************
* FileName: io_cfg.h
* Dependencies: See INCLUDES section below
* Processor: PIC18
* Compiler: C18 2.30.01+
* Company: Microchip Technology, Inc.
*
* Software License Agreement
*
* The software supplied herewith by Microchip Technology Incorporated
* (the “Company”) for its PICmicro® Microcontroller is intended and
* supplied to you, the Company’s customer, for use solely and
* exclusively on Microchip PICmicro Microcontroller products. The
* software is owned by the Company and/or its supplier, and is
* protected under applicable copyright laws. All rights are reserved.
* Any use in violation of the foregoing restrictions may subject the
* user to criminal sanctions under applicable laws, as well as to
* civil liability for the breach of the terms and conditions of this
* license.
*
* THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
* Author Date Comment
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Rawin Rojvanit 11/19/04 Original.
* Brian Schmalz 03/15/06 Updated for UBW boards.
********************************************************************/
/******************************************************************************
* -io_cfg.h-
* I/O Configuration File
* The purpose of this file is to provide a mapping mechanism between
* pin functions and pin assignments. This provides a layer of abstraction
* for the firmware code and eases the migration process from one target
* board design to another.
*
*****************************************************************************/
#ifndef IO_CFG_H
#define IO_CFG_H
/** I N C L U D E S *************************************************/
#include "autofiles\usbcfg.h"
/** T R I S *********************************************************/
#define INPUT_PIN 1
#define OUTPUT_PIN 0
/** U S B ***********************************************************/
#define usb_bus_sense 1
#define self_power 1
/** L E D ***********************************************************/
/* On UBW, LED1 = RC0, LED2 = RC1, SW = RC2 */
#define mInitAllLEDs() LATC &= 0xFC; TRISC &= 0xFC;
#define mLED_1 LATCbits.LATC0
#define mLED_2 LATCbits.LATC1
#define mLED_1_On() mLED_1 = 1;
#define mLED_2_On() mLED_2 = 1;
#define mLED_1_Off() mLED_1 = 0;
#define mLED_2_Off() mLED_2 = 0;
#define mLED_1_Toggle() mLED_1 = !mLED_1;
#define mLED_2_Toggle() mLED_2 = !mLED_2;
/** S W I T C H *****************************************************/
#define mInitSwitch() TRISCbits.TRISC2 = 1;
#define UserSW PORTCbits.RC2
#define mLED_Both_Off() {mLED_1_Off(); mLED_2_Off();}
#define mLED_Both_On() {mLED_1_On(); mLED_2_On();}
#define mLED_Only_1_On() {mLED_1_On(); mLED_2_Off();}
#define mLED_Only_2_On() {mLED_1_Off(); mLED_2_On();}
#endif //IO_CFG_H