Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 468 → Rev 469

/trunk/i2c.c
223,7 → 223,6
{
static u8 Rx_Idx = 0, Tx_Idx = 0;
u16 status;
u8 text[20];
 
//IENABLE; // do not enable IRQ nesting for I2C!!!!
// detemine I2C State
243,9 → 242,6
}
else
{ // depending on current i2c state
sprintf(text, "%02X ", status);
UART1_PutString(text);
switch(status)
{
// the start condition was initiated on the bus
384,7 → 380,7
}
}
//IDISABLE; // do not enable IRQ nesting for I2C!!!!
VIC1->VAR = 0xFF; // write any value to VIC0 Vector address register
VIC1->VAR = 0xFF; // write any value to VIC1 Vector address register
}
 
// ----------------------------------------------------------------------------------------
441,7 → 437,7
I2C_SlaveAddress = SlaveAddr;
I2C_pRxHandler = pRxHandler;
// test on busy flag and clear it
I2C_CheckEvent( I2C1, I2C_FLAG_BUSY );
I2C_ClearFlag(I2C0, I2C_FLAG_BUSY);
// enable I2C IRQ
VIC_ITCmd(I2C1_ITLine, ENABLE);
// initiate start condition on the bus
/trunk/i2c0.c
104,7 → 104,7
// and clock out at least 9 SCL pulses, then generate a stop
// condition and then leave the clock line high.
 
// configure P2.2->I2C0_CLKOUT and P2.3->I2C0_DOUT to normal port operation
// configure P2.0->I2C0_CLKOUT and P2.1->I2C0_DOUT to normal port operation
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
115,6 → 115,7
 
u8 i;
u32 delay;
 
// set SCL high and then SDA to low (start condition)
GPIO_WriteBit(GPIO2, GPIO_Pin_0, Bit_SET);
delay = SetDelay(1);
137,7 → 138,7
GPIO_WriteBit(GPIO2, GPIO_Pin_1, Bit_SET);
 
 
// reconfigure P2.2->I2C0_CLKOUT and P2.3->I2C0_DOUT
// reconfigure P2.0->I2C0_CLKOUT and P2.1->I2C0_DOUT
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Direction = GPIO_PinOutput;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
169,7 → 170,7
 
VIC_Config(I2C0_ITLine, VIC_IRQ , PRIORITY_I2C0);
 
I2C0_Timeout = SetDelay(10*I2C0_Timeout);
I2C0_Timeout = SetDelay(10*I2C1_TIMEOUT);
I2C_GenerateSTOP(I2C0, ENABLE);
I2C0_State = I2C_STATE_IDLE;
 
214,7 → 215,7
I2C0_TxBufferSize = 0;
I2C0_RxBufferSize = 0;
 
I2C0_Timeout = SetDelay(10*I2C0_Timeout);
I2C0_Timeout = SetDelay(10*I2C0_TIMEOUT);
 
UART1_PutString("ok");
}
224,7 → 225,6
{
static u8 Rx_Idx = 0, Tx_Idx = 0;
u16 status;
u8 text[20];
 
 
246,9 → 246,6
}
else
{ // depending on current i2c state
 
sprintf(text, "%02X ", status);
UART1_PutString(text);
switch(status)
{
// the start condition was initiated on the bus
387,7 → 384,7
}
}
//IDISABLE; // do not enable IRQ nesting for I2C!!!!
VIC1->VAR = 0xFF; // write any value to VIC0 Vector address register
VIC1->VAR = 0xFF; // write any value to VIC1 Vector address register
}
 
// ----------------------------------------------------------------------------------------
444,7 → 441,7
I2C0_SlaveAddress = SlaveAddr;
I2C0_pRxHandler = pRxHandler;
// test on busy flag and clear it
I2C_CheckEvent( I2C0, I2C_FLAG_BUSY );
I2C_ClearFlag(I2C0, I2C_FLAG_BUSY);
// enable I2C IRQ
VIC_ITCmd(I2C0_ITLine, ENABLE);
// initiate start condition on the bus
/trunk/main.c
146,6 → 146,7
s32 newErrorCode = 0;
UART_VersionInfo.HardwareError[0] = 0;
 
//ToDo
if(CheckDelay(I2C1_Timeout) || (Compass_Heading < 0)) DebugOut.StatusRed |= AMPEL_COMPASS;
else DebugOut.StatusRed &= ~AMPEL_COMPASS; // MK3Mag green status
 
173,6 → 174,7
DebugOut.StatusGreen &= ~AMPEL_BL; // status of BL Present
UART_VersionInfo.HardwareError[0] |= NC_ERROR0_SPI_RX;
}
//ToDo
else if(CheckDelay(I2C1_Timeout))
{
LED_RED_ON;
494,7 → 496,8
UART1_Init();
UART1_PutString("\r\n---------------------------------------------");
// initialize usb
USB_ConfigInit();
// to do
//USB_ConfigInit(); // disable because of unexpected side effects with I2C0
// initialize timer 2 for servo outputs
//TIMER2_Init();
// initialize UART2 to FLIGHTCTRL
505,7 → 508,7
Analog_Init();
// initialize SPI0 to FC
SPI0_Init();
// initialize i2c bus (needs Timer 1)
// initialize i2c busses (needs Timer 1)
I2C0_Init();
I2C1_Init();
 
/trunk/ncmag.c
943,6 → 943,7
u8 retval = 0;
u8 repeat;
 
// extern suchen, dann intern suchen
NCMAG_SelectI2CBus(0);
 
NCMAG_Present = 0;