Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added comment in Fubarino Mini header file about change notice pins.

Added start of chipKIT Pi variant files.
  • Loading branch information...
commit b74ca9774e9e6442d198d3412b09ca5f98cbdb9d 1 parent f5ea82d
@EmbeddedMan EmbeddedMan authored
View
609 hardware/pic32/variants/ChipKIT_Pi/Board_Data.c
@@ -0,0 +1,609 @@
+/************************************************************************/
+/* */
+/* Board_Data.c -- ChipKit PI Customization Data Declarations */
+/* */
+/************************************************************************/
+/* Author: Gene Apperson */
+/* Copyright 2011, Digilent. All rights reserved */
+/************************************************************************/
+/* File Description: */
+/* */
+/* This file contains the board specific declartions and data structure */
+/* to customize the chipKIT MPIDE for use with a CmodCK1 board using a */
+/* PIC32 part in a 44-pin package. */
+/* */
+/* This code is based on earlier work: */
+/* Copyright (c) 2010, 2011 by Mark Sproul */
+/* Copyright (c) 2005, 2006 by David A. Mellis */
+/* */
+/************************************************************************/
+/* Revision History: */
+/* */
+/* 11/28/2011(GeneA): Created by splitting data out of Board_Defs.h */
+/* 03/26/2013(KeithV): Modified for DP32 board */
+/* 06/14/2013(BrianS): Modified for ChipKIT Pi board */
+/* */
+/************************************************************************/
+//* This library is free software; you can redistribute it and/or
+//* modify it under the terms of the GNU Lesser General Public
+//* License as published by the Free Software Foundation; either
+//* version 2.1 of the License, or (at your option) any later version.
+//*
+//* This library is distributed in the hope that it will be useful,
+//* but WITHOUT ANY WARRANTY; without even the implied warranty of
+//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//* Lesser General Public License for more details.
+//*
+//* You should have received a copy of the GNU Lesser General
+//* Public License along with this library; if not, write to the
+//* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+//* Boston, MA 02111-1307 USA
+/************************************************************************/
+
+#if !defined(BOARD_DATA_C)
+#define BOARD_DATA_C
+
+#include <inttypes.h>
+
+/* ------------------------------------------------------------ */
+/* Data Tables */
+/* ------------------------------------------------------------ */
+/* The following declarations define data used in pin mapping. */
+/* ------------------------------------------------------------ */
+
+#if defined(OPT_BOARD_DATA)
+
+/* ------------------------------------------------------------ */
+/* This table is used to map from port number to the address of
+** the TRIS register for the port. This is used for setting the
+** pin direction.
+*/
+const uint32_t port_to_tris_PGM[] = {
+ NOT_A_PORT, //index value 0 is not used
+
+#if defined(_PORTA)
+ (uint32_t)&TRISA,
+#else
+ NOT_A_PORT,
+#endif
+
+#if defined(_PORTB)
+ (uint32_t)&TRISB,
+#else
+ NOT_A_PORT,
+#endif
+
+#if defined(_PORTC)
+ (uint32_t)&TRISC,
+#else
+ NOT_A_PORT,
+#endif
+
+#if defined(_PORTD)
+ (uint32_t)&TRISD,
+#else
+ NOT_A_PORT,
+#endif
+
+#if defined(_PORTE)
+ (uint32_t)&TRISE,
+#else
+ NOT_A_PORT,
+#endif
+
+#if defined(_PORTF)
+ (uint32_t)&TRISF,
+#else
+ NOT_A_PORT,
+#endif
+
+#if defined(_PORTG)
+ (uint32_t)&TRISG,
+#else
+ NOT_A_PORT,
+#endif
+
+ NOT_A_PORT,
+};
+
+/* ------------------------------------------------------------ */
+/* This table is used to map the digital pin number to the port
+** containing that pin. The default mapping is to assign pin numbers
+** for every possible port bit in order from PORTA to PORTG.
+*/
+const uint8_t digital_pin_to_port_PGM[] = {
+ // Pins 0 through 18
+ _IOPORT_PA, // 0 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
+ _IOPORT_PB, // 1 RB4 SOSCI/RPB4/RB4
+ _IOPORT_PB, // 2 RB5 TMS/RPB5/USBID/RB5
+ _IOPORT_PB, // 3 RB13 AN11/RPB13/CTPLS/PMRD/RB13
+ _IOPORT_PB, // 4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
+ _IOPORT_PB, // 5 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
+ _IOPORT_PA, // 6 RA2 OSC1/CLKI/RPA2/RA2
+ _IOPORT_PA, // 7 RA3 OSC2/CLKO/RPA3/PMA0/RA3
+ _IOPORT_PB, // 8 RB10 PGED2/RPB10/D+/CTED11/RB10
+ _IOPORT_PB, // 9 RB11 PGEC2/RPB11/D-/RB11
+ _IOPORT_PB, // 10 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
+ _IOPORT_PA, // 11 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
+ _IOPORT_PB, // 12 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
+ _IOPORT_PB, // 13 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+ _IOPORT_PA, // 14 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+ _IOPORT_PB, // 15 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
+ _IOPORT_PB, // 16 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
+ _IOPORT_PB, // 17 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
+ _IOPORT_PB, // 18 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
+};
+
+/* ------------------------------------------------------------ */
+/* This table is used to map from digital pin number to a bit mask
+** for the corresponding bit within the port.
+*/
+const uint16_t digital_pin_to_bit_mask_PGM[] = {
+ // Pins 0 through 18
+ _BV( 4 ) , // 0 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
+ _BV( 4 ) , // 1 RB4 SOSCI/RPB4/RB4
+ _BV( 5 ) , // 2 RB5 TMS/RPB5/USBID/RB5
+ _BV( 13 ) , // 3 RB13 AN11/RPB13/CTPLS/PMRD/RB13
+ _BV( 1 ) , // 4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
+ _BV( 0 ) , // 5 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
+ _BV( 2 ), // 6 RA2 OSC1/CLKI/RPA2/RA2
+ _BV( 3 ), // 7 RA3 OSC2/CLKO/RPA3/PMA0/RA3
+ _BV( 10 ) , // 8 RB10 PGED2/RPB10/D+/CTED11/RB10
+ _BV( 11 ) , // 9 RB11 PGEC2/RPB11/D-/RB11
+ _BV( 7 ) , // 10 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
+ _BV( 1 ) , // 11 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
+ _BV( 8 ), // 12 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
+ _BV( 14 ), // 13 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+ _BV( 0 ) , // 14 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+ _BV( 15 ) , // 15 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
+ _BV( 2 ) , // 16 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
+ _BV( 3 ) , // 17 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
+ _BV( 9 ) , // 18 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
+};
+
+/* ------------------------------------------------------------ */
+/* This table is used to map from digital pin number to the output
+** compare number, input capture number, and timer external clock
+** input associated with that pin.
+*/
+const uint8_t digital_pin_to_timer_PGM[] = {
+ // Pins 0 through 18
+ NOT_ON_TIMER, // 0 J4-1 RB5 USB TMS/RPB5/USBID/RB5
+ NOT_ON_TIMER, // 1 J4-2 RB7 INT0 TDI/RPB7/CTED3/PMD5/INT0/RB7
+ _TIMER_OC2 | _TIMER_IC3, // 2 J4-3 RB8 OC2, INT3, IC3, SDO2 TCK/RPB8/SCL1/CTED10/PMD4/RB8
+ _TIMER_OC3 | _TIMER_TCK5, // 3 J4-4 RB9 OC3, INT1, TCK5 TDO/RPB9/SDA1/CTED4/PMD3/RB9
+ NOT_ON_TIMER, // 4 J4-5 RB10 D+ PGED2/RPB10/D+/CTED11/RB10
+ NOT_ON_TIMER, // 5 J4-6 RB11 D- PGEC2/RPB11/D-/RB11
+ _TIMER_OC5 | _TIMER_TCK4 | _TIMER_IC1, // 6 J4-7 RB13 OC5, TCK4, IC1, RX1 AN11/RPB13/CTPLS/PMRD/RB13
+ NOT_ON_TIMER, // 7 J4-8 RB14 SCK1, TX2 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+ _TIMER_OC1, // 8 J4-9 RB15 OC1, SCK2 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
+ NOT_ON_TIMER, // 9 J3-1 RA0 CS1 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+ NOT_ON_TIMER, // 10 J3-2 RA1 SDI1, RX2 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
+ _TIMER_IC2, // 11 J3-3 RB0 PGD, IC2 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
+ _TIMER_TCK3, // 12 J3-4 RB1 PGC, TCK3 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
+ _TIMER_OC4 | _TIMER_IC5, // 13 J3-5 RB2 OC4, INT2, IC1, SDI2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
+ _TIMER_TCK2 | _TIMER_IC4, // 14 J3-6 RB3 TCK2, IC4, TX1 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
+ NOT_ON_TIMER, // 15 J3-7 RA2 OSC-PRI OSC1/CLKI/RPA2/RA2
+ NOT_ON_TIMER, // 16 J3-8 RA3 OSC-PRI OSC2/CLKO/RPA3/PMA0/RA3
+ NOT_ON_TIMER, // 17 J3-9 RB4 INT4, CS2 SOSCI/RPB4/RB4
+ _TIMER_TCK1, // 18 J3-10 RA4 SDO1, TCK1 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
+};
+
+/* ------------------------------------------------------------ */
+/* This table maps from a digital pin number to the corresponding
+** PPS register. This register is used to select the peripheral output
+** connected to the pin. The register is set to 0 to disconnedt the
+** pin from any peripheral so it can be used as GPIO.
+** For PIC32MX1xx/2xx series devices, the PPS output select registers
+** are arranged as a contiguous series of 32 bit registers. This table
+** treats these registers as an array of DWORDs an stores the index
+** to the register.
+*/
+const uint8_t digital_pin_to_pps_out_PGM[] = {
+ // Pins 0 through 18
+ _PPS_OUT(_PPS_RPB5R), // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
+ _PPS_OUT(_PPS_RPB7R), // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
+ _PPS_OUT(_PPS_RPB8R), // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
+ _PPS_OUT(_PPS_RPB9R), // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
+ _PPS_OUT(_PPS_RPB10R), // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
+ _PPS_OUT(_PPS_RPB11R), // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
+ _PPS_OUT(_PPS_RPB13R), // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
+ _PPS_OUT(_PPS_RPB14R), // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+ _PPS_OUT(_PPS_RPB15R), // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
+ _PPS_OUT(_PPS_RPA0R), // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+ _PPS_OUT(_PPS_RPA1R), // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
+ _PPS_OUT(_PPS_RPB0R), // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
+ _PPS_OUT(_PPS_RPB1R), // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
+ _PPS_OUT(_PPS_RPB2R), // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
+ _PPS_OUT(_PPS_RPB3R), // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
+ _PPS_OUT(_PPS_RPA2R), // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
+ _PPS_OUT(_PPS_RPA3R), // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
+ _PPS_OUT(_PPS_RPB4R), // 17 J3-9 RB4 SOSCI/RPB4/RB4
+ _PPS_OUT(_PPS_RPA4R), // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
+};
+
+/* ------------------------------------------------------------ */
+/* This table maps from the digital pin number to the value to be
+** loaded into a PPS input select register to select that pin.
+** It also maps from digital pin number to input/output pin set to
+** which the pin belongs. The set mask is in the high four bits,
+** the select value is in the low four bits.
+** Note: if the PIC32 device has more than four pin sets, or more than
+** 16 pin mapping choices per input function, then this table will have
+** to be redefined as a table of uint16_t values and the macros used to
+** access the table redefined as well.
+*/
+const uint8_t digital_pin_to_pps_in_PGM[] = {
+ // Pins 0 through 18
+ _PPS_IN(_PPS_RPB5), // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
+ _PPS_IN(_PPS_RPB7), // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
+ _PPS_IN(_PPS_RPB8), // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
+ _PPS_IN(_PPS_RPB9), // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
+ _PPS_IN(_PPS_RPB10), // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
+ _PPS_IN(_PPS_RPB11), // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
+ _PPS_IN(_PPS_RPB13), // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
+ _PPS_IN(_PPS_RPB14), // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+ _PPS_IN(_PPS_RPB15), // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
+ _PPS_IN(_PPS_RPA0), // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+ _PPS_IN(_PPS_RPA1), // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
+ _PPS_IN(_PPS_RPB0), // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
+ _PPS_IN(_PPS_RPB1), // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
+ _PPS_IN(_PPS_RPB2), // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
+ _PPS_IN(_PPS_RPB3), // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
+ _PPS_IN(_PPS_RPA2), // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
+ _PPS_IN(_PPS_RPA3), // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
+ _PPS_IN(_PPS_RPB4), // 17 J3-9 RB4 SOSCI/RPB4/RB4
+ _PPS_IN(_PPS_RPA4), // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
+};
+
+/* ------------------------------------------------------------ */
+/* This table maps from a digital pin number to the corresponding
+** analog pin number.
+*/
+//#if defined(_NOT_USED_)
+const uint8_t digital_pin_to_analog_PGM[] = {
+ // Pins 0 through 38
+ NOT_ANALOG_PIN, // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
+ NOT_ANALOG_PIN, // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
+ NOT_ANALOG_PIN, // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
+ NOT_ANALOG_PIN, // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
+ NOT_ANALOG_PIN, // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
+ NOT_ANALOG_PIN, // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
+ _BOARD_AN0, // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
+ _BOARD_AN1, // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+ _BOARD_AN2, // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
+ _BOARD_AN3, // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+ _BOARD_AN4, // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
+ _BOARD_AN5, // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
+ _BOARD_AN6, // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
+ _BOARD_AN7, // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
+ _BOARD_AN8, // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
+ NOT_ANALOG_PIN, // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
+ NOT_ANALOG_PIN, // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
+ NOT_ANALOG_PIN, // 17 J3-9 RB4 SOSCI/RPB4/RB4
+ NOT_ANALOG_PIN, // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
+};
+//#endif
+
+/* ------------------------------------------------------------ */
+/* This table is used to map from the analog pin number to the
+** actual A/D converter channel used for that pin.
+** In the default case, where there is a one-to-one mapping, this
+** table isn't needed as the analogInPinToChannel() macro is defined
+** to provide the mapping.
+*/
+//#if defined(_NOT_USED_)
+const uint8_t analog_pin_to_channel_PGM[] = {
+ //* Arduino Pin PIC32 Analog channel
+ 11, //* A0 11
+ 10, //* A1 10
+ 9, //* A2 9
+ 0, //* A3 0
+ 1, //* A4 1
+ 2, //* A5 2
+ 3, //* A6 3
+ 4, //* A7 4
+ 5, //* A8 5
+};
+//#endif
+
+/* ------------------------------------------------------------ */
+/* This table maps from an output compare number as stored in the
+** digital_pin_to_timer_PGM table to the digital pin number of the
+** pin that OC is connected to. This table is only required for
+** devices that support peripheral pin select (PPS), i.e. PIC32MX1xx/2xx
+** devices.
+*/
+
+const uint8_t output_compare_to_digital_pin_PGM[] = {
+ PIN_OC1, // A0, B3, B4, B15, B7 ; B15 RPB15R = 5
+ PIN_OC2, // A1, B5, B1, B11, B8 ; B8 RPB8R = 5
+ PIN_OC3, // A3, B14, B0, B10, B9 ; B9 RPB9R = 5
+ PIN_OC4, // A2, B6, A4, B13, B2 ; B2 RPB2R = 5
+ PIN_OC5, // A2, B6, A4, B13, B2 ; B13 RPB13R = 6
+};
+
+/* ------------------------------------------------------------ */
+/* This table maps from an external interrupt number to the digital
+** pin for that interrupt.
+*/
+
+const uint8_t external_int_to_digital_pin_PGM[] = {
+ NOT_PPS_PIN, // INT0 is not mappable; RB7
+ PIN_INT1, // A3, B14, B0, B10, B9; B9 INT1R = RPB9 = 4
+ PIN_INT2, // A2, B6, A4, B13, B2; B2 INT2R = RPB2 = 4
+ PIN_INT3, // A1, B5, B1, B11, B8; B8 INT3R = RPB8 = 4
+ PIN_INT4 // A0, B3, B4, B15, B7; B4 INT4R = RPB4 = 2
+};
+
+/* ------------------------------------------------------------ */
+/* Include Files for Board Customization Functions */
+/* ------------------------------------------------------------ */
+#if (OPT_BOARD_INIT != 0)
+#include <plib.h>
+#endif
+
+/* ------------------------------------------------------------ */
+/* Board Customization Functions */
+/* ------------------------------------------------------------ */
+/* */
+/* The following can be used to customize the behavior of some */
+/* of the core API functions. These provide hooks that can be */
+/* used to extend or replace the default behavior of the core */
+/* functions. To use one of these functions, add the desired */
+/* code to the function skeleton below and then set the value */
+/* of the appropriate compile switch above to 1. This will */
+/* cause the hook function to be compiled into the build and */
+/* to cause the code to call the hook function to be compiled */
+/* into the appropriate core function. */
+/* */
+/* ------------------------------------------------------------ */
+/*** _board_init
+**
+** Parameters:
+** none
+**
+** Return Value:
+** none
+**
+** Errors:
+** none
+**
+** Description:
+** This function is called from the core init() function.
+** This can be used to perform any board specific init
+** that needs to be done when the processor comes out of
+** reset and before the user sketch is run.
+*/
+#if (OPT_BOARD_INIT != 0)
+
+void _board_init(void) {
+
+ // Turn Secondary oscillator off as GPIO is needed
+ OSCCONCLR = _OSCCON_SOSCEN_MASK;
+
+}
+
+#endif
+
+/* ------------------------------------------------------------ */
+/*** _board_pinMode
+**
+** Parameters:
+** pin - digital pin number to configure
+** mode - mode to which the pin should be configured
+**
+** Return Value:
+** Returns 0 if not handled, !0 if handled.
+**
+** Errors:
+** none
+**
+** Description:
+** This function is called at the beginning of the pinMode
+** function. It can perform any special processing needed
+** when setting the pin mode. If this function returns zero,
+** control will pass through the normal pinMode code. If
+** it returns a non-zero value the normal pinMode code isn't
+** executed.
+*/
+#if (OPT_BOARD_DIGITAL_IO != 0)
+
+int _board_pinMode(uint8_t pin, uint8_t mode) {
+
+ return 0;
+
+}
+
+#endif
+
+/* ------------------------------------------------------------ */
+/*** _board_getPinMode
+**
+** Parameters:
+** pin - digital pin number
+** mode - pointer to variable to receive mode value
+**
+** Return Value:
+** Returns 0 if not handled, !0 if handled.
+**
+** Errors:
+** none
+**
+** Description:
+** This function is called at the beginning of the getPinMode
+** function. It can perform any special processing needed
+** when getting the pin mode. If this function returns zero,
+** control will pass through the normal getPinMode code. If
+** it returns a non-zero value the normal getPinMode code isn't
+** executed.
+*/
+#if (OPT_BOARD_DIGITAL_IO != 0)
+
+int _board_getPinMode(uint8_t pin, uint8_t * mode) {
+
+ return 0;
+
+}
+
+#endif
+
+/* ------------------------------------------------------------ */
+/*** _board_digitalWrite
+**
+** Parameters:
+** pin - digital pin number
+** val - value to write to the pin
+**
+** Return Value:
+** Returns 0 if not handled, !0 if handled.
+**
+** Errors:
+** none
+**
+** Description:
+** This function is called at the beginning of the digitalWrite
+** function. It can perform any special processing needed
+** in writing to the pin. If this function returns zero,
+** control will pass through the normal digitalWrite code. If
+** it returns a non-zero value the normal digitalWrite code isn't
+** executed.
+*/#if (OPT_BOARD_DIGITAL_IO != 0)
+
+int _board_digitalWrite(uint8_t pin, uint8_t val) {
+
+ return 0;
+
+}
+
+#endif
+
+/* ------------------------------------------------------------ */
+/*** _board_digitalRead
+**
+** Parameters:
+** pin - digital pin number
+** val - pointer to variable to receive pin value
+**
+** Return Value:
+** Returns 0 if not handled, !0 if handled.
+**
+** Errors:
+** none
+**
+** Description:
+** This function is called at the beginning of the digitalRead
+** function. It can perform any special processing needed
+** in reading from the pin. If this function returns zero,
+** control will pass through the normal digitalRead code. If
+** it returns a non-zero value the normal digitalRead code isn't
+** executed.
+*/
+#if (OPT_BOARD_DIGITAL_IO != 0)
+
+int _board_digitalRead(uint8_t pin, uint8_t * val) {
+
+ return 0;
+
+}
+
+#endif
+
+/* ------------------------------------------------------------ */
+/*** _board_analogRead
+**
+** Parameters:
+** pin - analog channel number
+** val - pointer to variable to receive analog value
+**
+** Return Value:
+** Returns 0 if not handled, !0 if handled.
+**
+** Errors:
+** none
+**
+** Description:
+** This function is called at the beginning of the analogRead
+** function. It can perform any special processing needed
+** in reading from the pin. If this function returns zero,
+** control will pass through the normal analogRead code. If
+** it returns a non-zero value the normal analogRead code isn't
+** executed.
+*/
+#if (OPT_BOARD_ANALOG_READ != 0)
+
+int _board_analogRead(uint8_t pin, int * val) {
+
+ return 0;
+
+}
+
+#endif
+
+/* ------------------------------------------------------------ */
+/*** _board_analogReference
+**
+** Parameters:
+**
+** Return Value:
+** Returns 0 if not handled, !0 if handled.
+**
+** Errors:
+** none
+**
+** Description:
+** This function is called at the beginning of the analogReference
+** function. It can perform any special processing needed
+** to set the reference voltage. If this function returns zero,
+** control will pass through the normal analogReference code. If
+** it returns a non-zero value the normal analogReference code isn't
+** executed.
+*/
+#if (OPT_BOARD_ANALOG_READ != 0)
+
+int _board_analogReference(uint8_t mode) {
+
+ return 0;
+
+}
+
+#endif
+
+/* ------------------------------------------------------------ */
+/*** _board_analogWrite
+**
+** Parameters:
+** pin - pin number
+** val - analog value to write
+**
+** Return Value:
+** Returns 0 if not handled, !0 if handled.
+**
+** Errors:
+** none
+**
+** Description:
+** This function is called at the beginning of the analogWrite
+** function. It can perform any special processing needed
+** in writing to the pin. If this function returns zero,
+** control will pass through the normal analogWrite code. If
+** it returns a non-zero value the normal analogWrite code isn't
+** executed.
+*/
+#if (OPT_BOARD_ANALOG_WRITE != 0)
+
+int _board_analogWrite(uint8_t pin, int val) {
+
+ return 0;
+
+}
+
+#endif
+
+#endif // OPT_BOARD_DATA
+
+/* ------------------------------------------------------------ */
+
+#endif // BOARD_DATA_C
+
+/************************************************************************/
View
403 hardware/pic32/variants/ChipKIT_Pi/Board_Defs.h
@@ -0,0 +1,403 @@
+/************************************************************************/
+/* */
+/* Board_Defs.h -- ChipKIT Pi Board Customization Declarations */
+/* */
+/************************************************************************/
+/* Author: Gene Apperson */
+/* Copyright 2011, Digilent. All rights reserved */
+/************************************************************************/
+/* File Description: */
+/* */
+/* This file contains the board specific declartions and data structure */
+/* to customize the chipKIT MPIDE for use with a ChipKIT PI board using */
+/* */
+/* This code is based on earlier work: */
+/* Copyright (c) 2010, 2011 by Mark Sproul */
+/* Copyright (c) 2005, 2006 by David A. Mellis */
+/* */
+/************************************************************************/
+/* Revision History: */
+/* */
+/* 10/07/2011(GeneA): Created */
+/* 11/28/2011(GeneA): Moved data definitions and configuration */
+/* functions to Board_Data.c */
+/* 11/29/2011(GeneA): Moved int priority definitions to System_Defs.h */
+/* 01/23/2013(KeithV): Modified for CK1 board */
+/* 03/26/2013(KeithV): Modified for DP32 board */
+/* 06/14/2013(BrianS): Modified for ChipKIT Pi board */
+/* */
+/************************************************************************/
+//* This library is free software; you can redistribute it and/or
+//* modify it under the terms of the GNU Lesser General Public
+//* License as published by the Free Software Foundation; either
+//* version 2.1 of the License, or (at your option) any later version.
+//*
+//* This library is distributed in the hope that it will be useful,
+//* but WITHOUT ANY WARRANTY; without even the implied warranty of
+//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+//* Lesser General Public License for more details.
+//*
+//* You should have received a copy of the GNU Lesser General
+//* Public License along with this library; if not, write to the
+//* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+//* Boston, MA 02111-1307 USA
+/************************************************************************/
+
+#if !defined(BOARD_DEFS_H)
+#define BOARD_DEFS_H
+
+#include <inttypes.h>
+
+/* ------------------------------------------------------------ */
+/* Public Board Declarations */
+/* ------------------------------------------------------------ */
+/* The following define symbols that can be used in a sketch to
+** refer to periperhals on the board generically.
+*/
+
+#define _BOARD_NAME_ "chipKIT Pi"
+
+/* Define the peripherals available on the board.
+*/
+#define NUM_DIGITAL_PINS 18
+#define NUM_ANALOG_PINS 2
+#define NUM_OC_PINS 5
+#define NUM_IC_PINS 5
+#define NUM_TCK_PINS 5
+#define NUM_INT_PINS 5
+
+#define NUM_SERIAL_PORTS 2
+#define NUM_SPI_PORTS 2
+#define NUM_I2C_PORTS 2
+
+#define NUM_DSPI_PORTS 2
+#define NUM_DTWI_PORTS 2
+
+/* Define I/O devices on the board.
+*/
+#define NUM_LED 2
+#define NUM_BTN 0
+#define NUM_SWT 0
+#define NUM_SERVO 0
+
+/* ------------------------------------------------------------ */
+/* LED Declarations */
+/* ------------------------------------------------------------ */
+
+/* Define the pin numbers for the LEDs
+NOTE: The ChipKIT Pi has no user LEDs, but some sketches use
+PIN_LED1, so we'll define that as Digital pin 3 (D3)
+*/
+#define PIN_LED1 14 // 11 RA0
+#define PIN_LED2 11 // 14 RA1
+
+/* ------------------------------------------------------------ */
+/* Button Declarations */
+/* ------------------------------------------------------------ */
+
+/* No buttons or this board
+*/
+
+/* Also define the virutal program button for soft reset */
+//#define USE_VIRTUAL_PROGRAM_BUTTON 1
+//#define VIRTUAL_PROGRAM_BUTTON_TRIS TRISBbits.TRISB4
+//#define VIRTUAL_PROGRAM_BUTTON LATBbits.LATB4
+
+/* ------------------------------------------------------------ */
+/* Switch Declarations */
+/* ------------------------------------------------------------ */
+
+/* No switches on this board.
+*/
+
+/* ------------------------------------------------------------ */
+/* Servo Pin Declarations */
+/* ------------------------------------------------------------ */
+
+/* No servo connectors on this board.
+*/
+
+/* ------------------------------------------------------------ */
+/* Timer Pin Declarations */
+/* ------------------------------------------------------------ */
+
+#define PIN_OC1 8 // B15 RPB15R = 5
+#define PIN_OC2 2 // B8 RPB8R = 5
+#define PIN_OC3 3 // B9 RPB9R = 5
+#define PIN_OC4 13 // B2 RPB2R = 5
+#define PIN_OC5 6 // B13 RPB13R = 6
+
+#define PIN_IC1 6 // RB13 IC1R = RPB13 = 3
+#define PIN_IC2 11 // B0 IC2R = RPB0 = 2
+#define PIN_IC3 2 // B8 IC3R = RPB8 = 4
+#define PIN_IC4 14 // B3 IC4R = RPB3 = 1
+#define PIN_IC5 13 // RB2 IC5R = RPB2 = 4
+
+#define PIN_TCK1 18 // A4, non PPS
+#define PIN_TCK2 14 // B3 T2CKR = RPB3 = 1
+#define PIN_TCK3 12 // B1 T3CKR = RPB1 = 2
+#define PIN_TCK4 6 // B13 T4CKR = RPB13 = 3
+#define PIN_TCK5 3 // B9 T5CKR = RPB9 = 4
+
+/* ------------------------------------------------------------ */
+/* Interrupt Pin Declarations */
+/* ------------------------------------------------------------ */
+
+#define PIN_INT0 1 // RB7 non-PPS
+#define PIN_INT1 3 // B9 INT1R = RPB9 = 4
+#define PIN_INT2 13 // B2 INT2R = RPB2 = 4
+#define PIN_INT3 2 // B8 INT3R = RPB8 = 4
+#define PIN_INT4 17 // B4 INT4R = RPB4 = 2
+
+/* ------------------------------------------------------------ */
+/* SPI Pin Declarations */
+/* ------------------------------------------------------------ */
+/* These symbols are defined for compatibility with the original
+** SPI library and the original pins_arduino.h.
+*/
+const static uint8_t SS = 9; // RA0 CS1 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+const static uint8_t MISO = 10; // RA1 SDI1 SDI1R = RPA1 = 0
+const static uint8_t MOSI = 18; // RA4 SDO1 RPA4R = SDO1 = 3
+const static uint8_t SCK = 13; // RB14 SCK1 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+
+/* The Digilent DSPI library uses these ports.
+*/
+#define PIN_DSPI0_SS 9 // 9 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+#define PIN_DSPI1_SS 33 // 33 RC4 RPC4/PMA4/RC4
+
+/* ------------------------------------------------------------ */
+/* Analog Pins */
+/* ------------------------------------------------------------ */
+/* Define symbols for accessing the analog pins. This table is
+** used to map an analog pin number to the corresponding digital
+** pin number.
+*/
+#define A0 14 // RA0
+#define A1 15 // RB15
+
+/* ------------------------------------------------------------ */
+/* Change Notice Pins */
+/* ------------------------------------------------------------ */
+/* These define the pin numbers for the various change notice
+** pins.
+*/
+#define PIN_CN0 0 // 0 J4-1 RB5 TMS/RPB5/USBID/RB5
+#define PIN_CN1 1 // 1 J4-2 RB7 TDI/RPB7/CTED3/PMD5/INT0/RB7
+#define PIN_CN2 2 // 2 J4-3 RB8 TCK/RPB8/SCL1/CTED10/PMD4/RB8
+#define PIN_CN3 3 // 3 J4-4 RB9 TDO/RPB9/SDA1/CTED4/PMD3/RB9
+#define PIN_CN4 4 // 4 J4-5 RB10 PGED2/RPB10/D+/CTED11/RB10
+#define PIN_CN5 5 // 5 J4-6 RB11 PGEC2/RPB11/D-/RB11
+#define PIN_CN6 6 // 6 J4-7 RB13 AN11/RPB13/CTPLS/PMRD/RB13
+#define PIN_CN7 7 // 7 J4-8 RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+#define PIN_CN8 8 // 8 J4-9 RB15 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
+#define PIN_CN9 9 // 9 J3-1 RA0 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+#define PIN_CN10 10 // 10 J3-2 RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
+#define PIN_CN11 11 // 11 J3-3 RB0 PGED1/AN2/C1IND/C2INB/C3IND/RPB0/PMD0/RB0
+#define PIN_CN12 12 // 12 J3-4 RB1 PGEC1/AN3/C1INC/C2INA/RPB1/CTED12/PMD1/RB1
+#define PIN_CN13 13 // 13 J3-5 RB2 AN4/C1INB/C2IND/RPB2/SDA2/CTED13/PMD2/RB2
+#define PIN_CN14 14 // 14 J3-6 RB3 AN5/C1INA/C2INC/RTCC/RPB3/SCL2/PMWR/RB3
+#define PIN_CN15 15 // 15 J3-7 RA2 OSC1/CLKI/RPA2/RA2
+#define PIN_CN16 16 // 16 J3-8 RA3 OSC2/CLKO/RPA3/PMA0/RA3
+#define PIN_CN17 17 // 17 J3-9 RB4 SOSCI/RPB4/RB4
+#define PIN_CN18 18 // 18 J3-10 RA4 SOSCO/RPA4/T1CK/CTED9/PMA1/RA4
+
+/* ------------------------------------------------------------ */
+/* Pin Mapping Macros */
+/* ------------------------------------------------------------ */
+/* Macros used to access the port and pin mapping tables.
+** These are mostly generic, but some of them may be board specific.
+** These perform slightly better as macros compared to inline functions
+*/
+#undef digitalPinToAnalog
+#define digitalPinToAnalog(P) ( digital_pin_to_analog_PGM[P] )
+
+#undef analogInPinToChannel
+#define analogInPinToChannel(P) ( analog_pin_to_channel_PGM[P] )
+
+/* ------------------------------------------------------------ */
+/* Data Definitions */
+/* ------------------------------------------------------------ */
+
+/* The following declare externals to access the pin mapping
+** tables. These tables are defined in Board_Data.c.
+*/
+
+#if !defined(OPT_BOARD_DATA)
+
+extern const uint32_t port_to_tris_PGM[];
+extern const uint8_t digital_pin_to_port_PGM[];
+extern const uint16_t digital_pin_to_bit_mask_PGM[];
+extern const uint16_t digital_pin_to_timer_PGM[];
+extern const uint8_t digital_pin_to_pps_out_PGM[];
+extern const uint8_t digital_pin_to_pps_in_PGM[];
+extern const uint8_t digital_pin_to_analog_PGM[];
+extern const uint8_t analog_pin_to_channel_PGM[];
+
+extern const uint8_t output_compare_to_digital_pin_PGM[];
+extern const uint8_t external_int_to_digital_pin_PGM[];
+
+#endif
+
+/* ------------------------------------------------------------ */
+/* Internal Declarations */
+/* ------------------------------------------------------------ */
+/* The following declarations are used to map peripherals for */
+/* the core and libraries and to provide configuration options */
+/* for the core. They are not normally needed by a user sketch. */
+/* ------------------------------------------------------------ */
+
+#if defined(OPT_BOARD_INTERNAL)
+
+/* ------------------------------------------------------------ */
+/* Core Configuration Declarations */
+/* ------------------------------------------------------------ */
+/* */
+/* These are conditional compilation switches that control the */
+/* board core configuration functions. These functions provide */
+/* hooks that can call from some of the core functions into */
+/* functions defined below that can be used to extend or */
+/* replace the default behavior of the core function. To use */
+/* this, enter the appropriate code into the appropriate */
+/* function skeleton below and then set the appropriate switch */
+/* value to 1. This will cause the configuration function to be */
+/* compiled into the build and will cause the code to call the */
+/* hook function to be compiled into the core function. */
+/* */
+/* ------------------------------------------------------------ */
+
+#define OPT_BOARD_INIT 1 //board needs special init code
+#define OPT_BOARD_DIGITAL_IO 0 //board does not extend digital i/o functions
+#define OPT_BOARD_ANALOG_READ 0 //board does not extend analogRead
+#define OPT_BOARD_ANALOG_WRITE 0 //board does not extend analogWrite
+
+/* ------------------------------------------------------------ */
+/* Serial Port Declarations */
+/* ------------------------------------------------------------ */
+
+/* Serial port 0 uses UART1 – for the serial monitor
+*/
+#define _SER0_BASE _UART1_BASE_ADDRESS
+#define _SER0_IRQ _UART1_ERR_IRQ
+#define _SER0_VECTOR _UART_1_VECTOR
+#define _SER0_IPL_ISR _UART1_IPL_ISR
+#define _SER0_IPL _UART1_IPL_IPC
+#define _SER0_SPL _UART1_SPL_IPC
+#define _SER0_TX_OUT PPS_OUT_U1TX // RPB3R = U1TX = 1
+#define _SER0_TX_PIN 1 // RB4
+#define _SER0_RX_IN PPS_IN_U1RX // U1RXR = RPB13 = 3
+#define _SER0_RX_PIN 6 // RB13 AN11/RPB13/CTPLS/PMRD/RB13
+
+
+/* Serial port 1 uses UART2
+*/
+#define _SER1_BASE _UART2_BASE_ADDRESS
+#define _SER1_IRQ _UART2_ERR_IRQ
+#define _SER1_VECTOR _UART_2_VECTOR
+#define _SER1_IPL_ISR _UART2_IPL_ISR
+#define _SER1_IPL _UART2_IPL_IPC
+#define _SER1_SPL _UART2_SPL_IPC
+#define _SER1_TX_OUT PPS_OUT_U2TX // RPB14R = U2TX = 2
+#define _SER1_TX_PIN 7 // RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+#define _SER1_RX_IN PPS_IN_U2RX // U2RXR = RPA1 = 0
+#define _SER1_RX_PIN 10 // RA1 PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1
+
+
+/* ------------------------------------------------------------ */
+/* SPI Port Declarations */
+/* ------------------------------------------------------------ */
+
+/* The default SPI port uses SPI1.
+*/
+#define _SPI_BASE _SPI1_BASE_ADDRESS
+#define _SPI_ERR_IRQ _SPI1_ERR_IRQ
+#define _SPI_RX_IRQ _SPI1_RX_IRQ
+#define _SPI_TX_IRQ _SPI1_TX_IRQ
+#define _SPI_VECTOR _SPI_1_VECTOR
+#define _SPI_IPL_ISR _SPI1_IPL_ISR
+#define _SPI_IPL _SPI1_IPL_IPC
+#define _SPI_SPL _SPI1_SPL_IPC
+
+/* SPI1
+*/
+// RA0 CS1 PGED3/VREF+/CVREF+/AN0/C3INC/RPA0/CTED1/PMD7/RA0
+// RA4 SDO1 RPA4R = SDO1 = 3
+// RA1 SDI1 SDI1R = RPA1 = 0
+// RB14 SCK1 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
+#define _DSPI0_BASE _SPI1_BASE_ADDRESS0 anss
+#define _DSPI0_ERR_IRQ _SPI1_ERR_IRQ
+#define _DSPI0_RX_IRQ _SPI1_RX_IRQ
+#define _DSPI0_TX_IRQ _SPI1_TX_IRQ
+#define _DSPI0_VECTOR _SPI_1_VECTOR
+#define _DSPI0_IPL_ISR _SPI1_IPL_ISR
+#define _DSPI0_IPL _SPI1_IPL_IPC
+#define _DSPI0_SPL _SPI1_SPL_IPC
+
+/* SPI2
+*/
+// RB4 CS2 SOSCI/RPB4/RB4
+// RB8 SDO2 RPB8R = SDO2 = 4
+// RB2 SDI2 SDI2R = RPB2 = 4
+// RB15 SCK2 AN9/C3INA/RPB15/SCK2/CTED6/PMCS1/RB15
+#define _DSPI1_BASE _SPI2_BASE_ADDRESS
+#define _DSPI1_ERR_IRQ _SPI2_ERR_IRQ
+#define _DSPI1_RX_IRQ _SPI2_RX_IRQ
+#define _DSPI1_TX_IRQ _SPI2_TX_IRQ
+#define _DSPI1_VECTOR _SPI_2_VECTOR
+#define _DSPI1_IPL_ISR _SPI2_IPL_ISR
+#define _DSPI1_IPL _SPI2_IPL_IPC
+#define _DSPI1_SPL _SPI2_SPL_IPC
+
+/* ------------------------------------------------------------ */
+/* I2C Port Declarations */
+/* ------------------------------------------------------------ */
+
+/* The standard I2C1 port uses I2C1 (SCL1/SDA1).
+** RB8/RB9 pins 38/4
+*/
+#define _TWI_BASE _I2C1_BASE_ADDRESS
+#define _TWI_BUS_IRQ _I2C1_BUS_IRQ
+#define _TWI_SLV_IRQ _I2C1_SLAVE_IRQ
+#define _TWI_MST_IRQ _I2C1_MASTER_IRQ
+#define _TWI_VECTOR _I2C_1_VECTOR
+#define _TWI_IPL_ISR _I2C1_IPL_ISR
+#define _TWI_IPL _I2C1_IPL_IPC
+#define _TWI_SPL _I2C1_SPL_IPC
+
+/* Declarations for Digilent DTWI library.
+** DTWI0 is on RB8/RB9 pins 38/4
+*/
+#define _DTWI0_BASE _I2C1_BASE_ADDRESS
+#define _DTWI0_BUS_IRQ _I2C1_BUS_IRQ
+#define _DTWI0_SLV_IRQ _I2C1_SLAVE_IRQ
+#define _DTWI0_MST_IRQ _I2C1_MASTER_IRQ
+#define _DTWI0_VECTOR _I2C_1_VECTOR
+#define _DTWI0_IPL_ISR _I2C1_IPL_ISR
+#define _DTWI0_IPL _I2C1_IPL_IPC
+#define _DTWI0_SPL _I2C1_SPL_IPC
+
+/* Declarations for Digilent DTWI library.
+** DTWI0 is on RB8/RB9 pins 38/4
+*/
+#define _DTWI1_BASE _I2C2_BASE_ADDRESS
+#define _DTWI1_BUS_IRQ _I2C2_BUS_IRQ
+#define _DTWI1_SLV_IRQ _I2C2_SLAVE_IRQ
+#define _DTWI1_MST_IRQ _I2C2_MASTER_IRQ
+#define _DTWI1_VECTOR _I2C_2_VECTOR
+#define _DTWI1_IPL_ISR _I2C2_IPL_ISR
+#define _DTWI1_IPL _I2C2_IPL_IPC
+#define _DTWI1_SPL _I2C2_SPL_IPC
+
+/* ------------------------------------------------------------ */
+/* A/D Converter Declarations */
+/* ------------------------------------------------------------ */
+
+
+/* ------------------------------------------------------------ */
+
+#endif // OPT_BOARD_INTERNAL
+
+/* ------------------------------------------------------------ */
+
+#endif // BOARD_DEFS_H
+
+/************************************************************************/
View
37 hardware/pic32/variants/ChipKIT_Pi/boards.txt
@@ -0,0 +1,37 @@
+############################################################
+chipkit_Pi.name=chipKIT Pi
+chipkit_Pi.group=chipKIT
+
+# new items
+chipkit_Pi.platform=pic32
+chipkit_Pi.board=_BOARD_CHIPKIT_PI_
+chipkit_Pi.ccflags=-Map="map.map"
+chipkit_Pi.board.define=
+chipkit_Pi.ldscript=chipKIT-application-32MX250F128.ld
+# end of new items
+
+# Use a high -Gnum for devices that have less than 64K of data memory
+# For -G1024, objects 1024 bytes or smaller will be accessed by
+# gp-relative addressing
+chipkit_Pi.compiler.c.flags=-O2::-c::-mno-smart-io::-w::-ffunction-sections::-fdata-sections::-G1024::-g::-mdebugger::-Wcast-align::-fno-short-double
+chipkit_Pi.compiler.cpp.flags=-O2::-c::-mno-smart-io::-w::-fno-exceptions::-ffunction-sections::-fdata-sections::-G1024::-g::-mdebugger::-Wcast-align::-fno-short-double
+
+chipkit_Pi.upload.protocol=stk500v2
+# 128KB - 4K for EEPROM - 4K for bootloader
+fubarino_mini.upload.maximum_size=122880
+chipkit_Pi.upload.speed=115200
+
+chipkit_Pi.bootloader.low_fuses=0xff
+chipkit_Pi.bootloader.high_fuses=0xdd
+chipkit_Pi.bootloader.extended_fuses=0x00
+chipkit_Pi.bootloader.path=not-supported
+chipkit_Pi.bootloader.file=not-supported
+chipkit_Pi.bootloader.unlock_bits=0x3F
+chipkit_Pi.bootloader.lock_bits=0x0F
+
+chipkit_Pi.build.mcu=32MX250F128B
+chipkit_Pi.build.f_cpu=40000000L
+chipkit_Pi.build.core=pic32
+chipkit_Pi.build.variant=ChipKIT_Pi
+
+############################################################
View
2  hardware/pic32/variants/Fubarino_Mini/Board_Defs.h
@@ -188,6 +188,8 @@ const static uint8_t SCK = 24; // PIC32 SCK2
/* ------------------------------------------------------------ */
/* These define the pin numbers for the various change notice
** pins.
+/// TODO: MX250 parts have Change Notification on EVERY I/O pin.
+/// How should that get mapped? What calls actually use these values?
*/
#define PIN_CN0 6
#define PIN_CN1 5
Please sign in to comment.
Something went wrong with that request. Please try again.