EDF - OnePIC MCU  Beta
8bit/OnePIC_mtouch8.c
Go to the documentation of this file.
00001 
00008 #include "OnePIC_mtouch.h"
00009 #include "mTouchCVD.h"
00010 #include "bsp.h"
00011 #include "int.h"
00012 
00016 void EDF_mTouchInit(void)
00017 {
00018     OSCCON = 0b11110000; // 32 MHz Fosc w/ PLLEN_ON (config)  (UPDATE CONFIG FILE IF CHANGED)
00019     OSCCONbits.SPLLEN = 0x01;
00020     OSCCONbits.IRCF = 0x0E;
00021     OSCCONbits.SCS = 0x00;
00022 
00023     PORTA = 0b00000000;
00024     PORTB = 0b00000000;
00025     PORTC = 0b00110000;
00026     PORTD = 0b00000000;
00027     PORTE = 0b00000000;
00028 
00029     ANSELA = 0b00000000;
00030     ANSELB = 0b00100000; //POT as analog
00031     ANSELD = 0b00000000;
00032     ANSELE = 0b00000000;
00033 
00034     TRISA = 0b00000000;
00035     TRISB = 0b00100000; //POT as input
00036     TRISC = 0b00000000;
00037     TRISD = 0b00000000;
00038     TRISE = 0b00000000;
00039 
00040     I2C_SCL_TRIS = 1; //Must set I2C lines as input to work properly (can't pull down SCL/SDA)
00041     I2C_SDA_TRIS = 1;
00042     mTouch_Init();
00043 
00044 }