Skip to content

Commit

Permalink
Update 20111122 from Gene: All of the Board_Defs.h files have been up…
Browse files Browse the repository at this point in the history
…dated. I added back in some macros for compatibility reasons. This should fix the problems Brian was having compiling the SoftPWMServo library.

Former-commit-id: c02358d
  • Loading branch information
ricklon committed Nov 23, 2011
1 parent 13dd48e commit ba4a113
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 36 deletions.
10 changes: 3 additions & 7 deletions hardware/pic32/cores/pic32/HardwareSerial.cpp
Expand Up @@ -92,6 +92,7 @@
** Parameters:
** uartP - pointer to base register for UART
** irqP - base IRQ number for the UART
** vecP - interrupt vector number used by this UART
**
** Return Value:
** none
Expand All @@ -110,11 +111,6 @@ HardwareSerial::HardwareSerial(p32_uart * uartP, int irqP, int vecP)
irq = irqP;
vec = vecP;

/* Make sure that the UART is disabled until the user wants to
** use it.
*/
//uart->uxMode.reg = 0;

/* The interrupt flag and enable control register addresses and
** the bit numbers for the flag bits can be computed from the
** IRQ number for the UART. The irq parameter specifies the IRQ
Expand Down Expand Up @@ -394,8 +390,8 @@ void HardwareSerial::write(uint8_t theChar)

void HardwareSerial::doSerialInt(void)
{
int bufIndex;
uint8_t ch;
int bufIndex;
uint8_t ch;

/* If it's a receive interrupt, get the character and store
** it in the receive buffer.
Expand Down
8 changes: 6 additions & 2 deletions hardware/pic32/libraries/DSPI/DSPI.cpp
Expand Up @@ -8,6 +8,9 @@
/************************************************************************/
/* Module Description: */
/* */
/* This is the main program module for the Digilent SPI library for use */
/* with the chipKIT system. This library supports access to all of the */
/* SPI ports defined on the board in use. */
/* */
/************************************************************************/
/* Revision History: */
Expand Down Expand Up @@ -480,7 +483,7 @@ DSPI::transfer(uint16_t cbReq, uint8_t * pbSnd, uint8_t * pbRcv) {
**
** Parameters:
** cbReq - number of bytes to send to the slave
** pbSnd
** pbSnd - buffer containing bytes to send
**
** Return Value:
** none
Expand Down Expand Up @@ -508,6 +511,7 @@ DSPI::transfer(uint16_t cbReq, uint8_t * pbSnd) {
**
** Parameters:
** cbReq - number of bytes to receive from the slave
** bPad - pad byte to send to slave
** pbRcv - buffer to hold received bytes
**
** Return Value:
Expand All @@ -519,7 +523,7 @@ DSPI::transfer(uint16_t cbReq, uint8_t * pbSnd) {
** Description:
** This function will receive the specified number of bytes
** from the slave. The given pad byte will be sent to the
** slave to cause the receive bytes to be sent.
** slave to cause the received bytes to be sent.
*/

void
Expand Down
2 changes: 2 additions & 0 deletions hardware/pic32/libraries/DSPI/DSPI.h
Expand Up @@ -8,6 +8,8 @@
/************************************************************************/
/* File Description: */
/* */
/* This header file contains interface declarations for use of the */
/* Digilent chipKIT SPI library. */
/* */
/************************************************************************/
/* Revision History: */
Expand Down
19 changes: 0 additions & 19 deletions hardware/pic32/libraries/Wire/utility/twi.c
Expand Up @@ -120,22 +120,6 @@ void twi_init(p32_i2c * ptwiT, uint8_t irqBus, uint8_t irqSlv, uint8_t irqMst, u
*/
ptwi->ixBrg.reg = twi_computeBrg(TWI_FREQ);

#if defined(DEAD)
// Enable the I2C1 module and turn on clock stretching.
I2C1CONSET = ( 1 << bnOn ) | ( 1 << bnStren );
// Enable Interrupts
IEC0SET = ( 1 << bnI2c1mie ) | ( 1 << bnI2c1sie) | ( 1 << bnI2c1bie); // Enable interrupts
IPC6SET = ( 1 << bnI2c1ip2) | ( 1 << bnI2c1ip1); // Setup Interupt Priority

// Configure the I2C1 baud rate generator to output the appropriate
// clock.
I2C1BRGSET = ( CLK_PBUS/ ( 2 * TWI_FREQ ) ) - 2;

// Clear the interrupt flags associated with the I2C1 module.
IFS0CLR = ( 1 << bnI2c1mif ) | ( 1 << bnI2c1sif ) | ( 1 << bnI2c1bif );
INTEnableSystemMultiVectoredInt ();
INTEnableInterrupts ();
#endif
}

/*
Expand All @@ -149,9 +133,6 @@ void twi_setAddress(uint8_t address)
// set twi slave address
ptwi->ixAdd.reg = address;

#if defined(DEAD)
I2C1ADDSET = address;
#endif
}

/*
Expand Down
4 changes: 4 additions & 0 deletions hardware/pic32/variants/Cerebot_32MX4/Board_Defs.h
Expand Up @@ -217,7 +217,11 @@ const static uint8_t SCK = 11; // PIC32 SCK2
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P])
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )
#define digitalPinToAnalog(P) ( ((P) < NUM_ANALOG_PINS) ? (P) : digital_pin_to_analog_PGM[P] )
#define analogInPinToChannel(P) ( analog_pin_to_channel_PGM[P] )

Expand Down
4 changes: 4 additions & 0 deletions hardware/pic32/variants/Cerebot_32MX7/Board_Defs.h
Expand Up @@ -209,7 +209,11 @@ const static uint8_t SCK = 43; // PIC32 SCK4
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P])
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )
#define digitalPinToAnalog(P) ( (P) < 10 ? (P) : digital_pin_to_analog_PGM[P] )
#define analogInPinToChannel(P) ( analog_pin_to_channel_PGM[P] )

Expand Down
4 changes: 4 additions & 0 deletions hardware/pic32/variants/Cerebot_MX3ck/Board_Defs.h
Expand Up @@ -202,7 +202,11 @@ const static uint8_t SCK = 35; // PIC32 SCK2
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P])
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )
#define digitalPinToAnalog(P) ( ((P) < NUM_ANALOG_PINS) ? (P) : digital_pin_to_analog_PGM[P] )
#define analogInPinToChannel(P) ( analog_pin_to_channel_PGM[P] )

Expand Down
4 changes: 4 additions & 0 deletions hardware/pic32/variants/Cerebot_MX4ck/Board_Defs.h
Expand Up @@ -217,7 +217,11 @@ const static uint8_t SCK = 11; // PIC32 SCK2
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P])
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )
#define digitalPinToAnalog(P) ( ((P) < NUM_ANALOG_PINS) ? (P) : digital_pin_to_analog_PGM[P] )
#define analogInPinToChannel(P) ( analog_pin_to_channel_PGM[P] )

Expand Down
4 changes: 4 additions & 0 deletions hardware/pic32/variants/Cerebot_MX7ck/Board_Defs.h
Expand Up @@ -209,7 +209,11 @@ const static uint8_t SCK = 43; // PIC32 SCK4
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P])
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )
#define digitalPinToAnalog(P) ( (P) < 10 ? (P) : digital_pin_to_analog_PGM[P] )
#define analogInPinToChannel(P) ( analog_pin_to_channel_PGM[P] )

Expand Down
12 changes: 8 additions & 4 deletions hardware/pic32/variants/Default_100/Board_Defs.h
Expand Up @@ -200,10 +200,14 @@ const static uint8_t SCK = 102; // PIC32 SCK2
*/
#define digitalPinToPort(P) ( digital_pin_to_port_PGM[P] )
#define digitalPinToBitMask(P) ( digital_pin_to_bit_mask_PGM[P] )
#define digitalPinToTimer(P) ( digital_pin_to_timer_PGM[P] )
#define portOutputRegister(P) ( (volatile uint32_t *)( port_to_output_PGM[P]) )
#define portInputRegister(P) ( (volatile uint32_t *)( port_to_input_PGM[P]) )
#define portModeRegister(P) ( (volatile uint32_t *)( port_to_mode_PGM[P]) )
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P] )
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )

// This definition can be used for the default mapping.
#define digitalPinToAnalog(P) ( (((P) > 15) && ((P) < 32)) ? (P)-16 : NOT_ANALOG_PIN )
Expand Down
12 changes: 8 additions & 4 deletions hardware/pic32/variants/Default_64/Board_Defs.h
Expand Up @@ -200,10 +200,14 @@ const static uint8_t SCK = 102; // PIC32 SCK2
*/
#define digitalPinToPort(P) ( digital_pin_to_port_PGM[P] )
#define digitalPinToBitMask(P) ( digital_pin_to_bit_mask_PGM[P] )
#define digitalPinToTimer(P) ( digital_pin_to_timer_PGM[P] )
#define portOutputRegister(P) ( (volatile uint32_t *)( port_to_output_PGM[P]) )
#define portInputRegister(P) ( (volatile uint32_t *)( port_to_input_PGM[P]) )
#define portModeRegister(P) ( (volatile uint32_t *)( port_to_mode_PGM[P]) )
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P] )
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )

// This definition can be used for the default mapping.
#define digitalPinToAnalog(P) ( (((P) > 15) && ((P) < 32)) ? (P)-16 : NOT_ANALOG_PIN )
Expand Down
4 changes: 4 additions & 0 deletions hardware/pic32/variants/Max32/Board_Defs.h
Expand Up @@ -203,7 +203,11 @@ const static uint8_t SCK = 52; // PIC32 SCK2A
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P])
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )
#define digitalPinToAnalog(P) ( (P) < 16 ? (P) : ((P) >= 54) && ((P) < 70) ? (P)-54 : NOT_ANALOG_PIN )
#define analogInPinToChannel(P) ( P )

Expand Down
4 changes: 4 additions & 0 deletions hardware/pic32/variants/Uno32/Board_Defs.h
Expand Up @@ -202,7 +202,11 @@ const static uint8_t SCK = 13; // PIC32 SCK2
#define digitalPinToTimerOC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_OC) )
#define digitalPinToTimerIC(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_IC) )
#define digitalPinToTimerTCK(P) ( (digital_pin_to_timer_PGM[P] & _MSK_TIMER_TCK) )
#define digitalPinToTimer(P) digitalPinToTimerOC(P)
#define portRegisters(P) ( port_to_tris_PGM[P] )
#define portModeRegister(P) ( (volatile uint32_t *)port_to_tris_PGM[P] )
#define portInputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0010) )
#define portOutputRegister(P) ( (volatile uint32_t *)(port_to_tris_PGM[P] + 0x0020) )
#define digitalPinToAnalog(P) ( (P) < 12 ? (P) : ((P) >= 14) && ((P) < 26) ? (P)-14 : NOT_ANALOG_PIN )
#define analogInPinToChannel(P) ( analog_pin_to_channel_PGM[P] )

Expand Down

0 comments on commit ba4a113

Please sign in to comment.