mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-29 19:17:28 +08:00
:-) :-) :-) :-)
This commit is contained in:
@@ -5,10 +5,9 @@
|
|||||||
<file name="i2c_abuse_test.h"/>
|
<file name="i2c_abuse_test.h"/>
|
||||||
</header>
|
</header>
|
||||||
<init fun="init_i2c_abuse_test()"/>
|
<init fun="init_i2c_abuse_test()"/>
|
||||||
|
<periodic fun="periodic_50Hz_i2c_abuse_test()" period="0.02" autorun="TRUE" />
|
||||||
<event fun="event_i2c_abuse_test()" />
|
<event fun="event_i2c_abuse_test()" />
|
||||||
<!-- <periodic fun="periodic_50Hz_i2c_abuse_test()" period="0.02" autorun="FALSE"/> -->
|
|
||||||
<makefile>
|
<makefile>
|
||||||
<!-- define name="i2c_abuse_test_MODULE_LED" value="2"/ -->
|
|
||||||
<file name="i2c_abuse_test.c"/>
|
<file name="i2c_abuse_test.c"/>
|
||||||
</makefile>
|
</makefile>
|
||||||
</module>
|
</module>
|
||||||
|
|||||||
@@ -1203,8 +1203,15 @@ void i2c_setbitrate(struct i2c_periph *periph, int bitrate)
|
|||||||
{
|
{
|
||||||
if (periph == &i2c2)
|
if (periph == &i2c2)
|
||||||
{
|
{
|
||||||
|
// I2C_DeInit(I2C1);
|
||||||
|
// I2C_Cmd(I2C2, DISABLE);
|
||||||
|
|
||||||
I2C2_InitStruct.I2C_ClockSpeed = bitrate;
|
I2C2_InitStruct.I2C_ClockSpeed = bitrate;
|
||||||
I2C_Init(I2C2, i2c2.init_struct);
|
// I2C_Cmd(I2C2, ENABLE);
|
||||||
|
// I2C_Init(I2C2, i2c2.init_struct);
|
||||||
|
// 1) Program peripheral input clock CR2: to get correct timings
|
||||||
|
// 2) Configure clock control registers
|
||||||
|
// 3) Configure rise time register
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I2C_DEBUG_LED
|
#ifdef I2C_DEBUG_LED
|
||||||
@@ -1341,6 +1348,10 @@ bool_t i2c_submit(struct i2c_periph* periph, struct i2c_transaction* t) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef I2C_DEBUG_LED
|
||||||
|
LED2_ON();
|
||||||
|
LED2_OFF();
|
||||||
|
#endif
|
||||||
PPRZ_I2C_SEND_START(periph);
|
PPRZ_I2C_SEND_START(periph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ void baro_init(void) {
|
|||||||
|
|
||||||
|
|
||||||
void baro_periodic(void) {
|
void baro_periodic(void) {
|
||||||
#warning BARO_FILE_CODE_DISABLED
|
#warning BARO_BOARD_CODE_DISABLED
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (baro_board.status) {
|
switch (baro_board.status) {
|
||||||
|
|||||||
@@ -169,6 +169,8 @@ static void i2c_abuse_send_transaction(uint8_t _init)
|
|||||||
|
|
||||||
void event_i2c_abuse_test(void)
|
void event_i2c_abuse_test(void)
|
||||||
{
|
{
|
||||||
|
static uint8_t bit1 = 0;
|
||||||
|
static uint8_t bit2 = 0;
|
||||||
|
|
||||||
if (i2c_idle(&i2c2))
|
if (i2c_idle(&i2c2))
|
||||||
{
|
{
|
||||||
@@ -197,6 +199,7 @@ void event_i2c_abuse_test(void)
|
|||||||
|
|
||||||
if ((i2c_test1.status == I2CTransFailed) || (i2c_test1.status == I2CTransSuccess))
|
if ((i2c_test1.status == I2CTransFailed) || (i2c_test1.status == I2CTransSuccess))
|
||||||
{
|
{
|
||||||
|
RunOnceEvery(100,LED_TOGGLE(7));
|
||||||
if (i2c_abuse_test_counter < 16)
|
if (i2c_abuse_test_counter < 16)
|
||||||
{
|
{
|
||||||
i2c_abuse_test_counter++;
|
i2c_abuse_test_counter++;
|
||||||
@@ -208,32 +211,25 @@ void event_i2c_abuse_test(void)
|
|||||||
{
|
{
|
||||||
i2c_abuse_test_counter = 1;
|
i2c_abuse_test_counter = 1;
|
||||||
|
|
||||||
i2c_setbitrate(&i2c2, i2c_abuse_test_bitrate);
|
//i2c_setbitrate(&i2c2, i2c_abuse_test_bitrate);
|
||||||
|
|
||||||
i2c_abuse_test_bitrate += 17000;
|
i2c_abuse_test_bitrate += 17000;
|
||||||
if (i2c_abuse_test_bitrate > 500000)
|
if (i2c_abuse_test_bitrate > 500000)
|
||||||
{
|
{
|
||||||
static uint8_t bit = 0;
|
|
||||||
i2c_abuse_test_bitrate -= 500000;
|
i2c_abuse_test_bitrate -= 500000;
|
||||||
bit = 1 - bit;
|
bit1 = 1 - bit1;
|
||||||
if (bit==0)
|
|
||||||
{ LED_ON(7);} else { LED_OFF(7); }
|
|
||||||
LED_OFF(6);
|
|
||||||
}
|
}
|
||||||
LED_TOGGLE(4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i2c_abuse_test_counter < 16)
|
if (i2c_abuse_test_counter < 16)
|
||||||
{
|
{
|
||||||
i2c_abuse_send_transaction( i2c_abuse_test_counter );
|
i2c_abuse_send_transaction( i2c_abuse_test_counter );
|
||||||
LED_TOGGLE(5);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void periodic_50Hz_i2c_abuse_test(void) {
|
void periodic_50Hz_i2c_abuse_test(void) {
|
||||||
// LED_TOGGLE(DEMO_MODULE_LED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user