Skip to content

Commit

Permalink
Deleted TIM2 ISR dissalowing during sensors reading
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury Vostrenkov committed Oct 3, 2020
1 parent 5471979 commit 8b9eef5
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 23 deletions.
Binary file modified MDK-ARM/FreeJoy.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion MDK-ARM/FreeJoy.uvoptx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>ST-LINKIII-KEIL_SWO</Key>
<Name>-U0667FF494951785087063933 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
<Name>-U0667FF494951785087063933 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
Expand Down
16 changes: 5 additions & 11 deletions application/Src/buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ logical_buttons_state_t logical_buttons_state[MAX_BUTTONS_NUM];
button_data_t buttons_data[MAX_BUTTONS_NUM/8];
pov_data_t pov_data[MAX_POVS_NUM];
uint8_t pov_pos[MAX_POVS_NUM];
uint8_t shifts_state;
uint8_t a2b_first;
uint8_t a2b_last;
uint8_t shifts_state = 0;
uint8_t a2b_first = 0;
uint8_t a2b_last = 0;

/**
* @brief Processing debounce for raw buttons input
Expand Down Expand Up @@ -897,14 +897,8 @@ void ButtonsReadLogical (dev_config_t * p_dev_config)
for (uint8_t i=0; i<5; i++)
{
if (p_dev_config->shift_config[i].button >= 0)
{
for (uint8_t j=0; j<MAX_BUTTONS_NUM; j++)
{
if (j == p_dev_config->shift_config[i].button)
{
shifts_state |= (logical_buttons_state[j].current_state << i);
}
}
{
shifts_state |= (logical_buttons_state[p_dev_config->shift_config[i].button].current_state << i);
}
}

Expand Down
3 changes: 0 additions & 3 deletions application/Src/mcp320x.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ void MCP320x_StartDMA(sensor_t * sensor, uint8_t channel)
sensor->tx_complete = 1;
sensor->curr_channel = channel;

// Disable timer's interrupts
NVIC_DisableIRQ(TIM2_IRQn);

// CS low
pin_config[sensor->source].port->ODR &= ~pin_config[sensor->source].pin;

Expand Down
3 changes: 0 additions & 3 deletions application/Src/mlx90393.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ void MLX90393_StartDMA(sensor_t * sensor)
tmp_buf[6] = 0x00; // Z MSB
tmp_buf[7] = 0x00; // Z LSB

// Disable other interrupts
NVIC_DisableIRQ(TIM2_IRQn);

// CS low
pin_config[sensor->source].port->ODR &= ~pin_config[sensor->source].pin;
SPI_FullDuplex_TransmitReceive(tmp_buf, sensor->data, 8, MLX90393_SPI_MODE);
Expand Down
3 changes: 1 addition & 2 deletions application/Src/stm32f10x_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,7 @@ void DMA1_Channel2_IRQHandler(void)
MLX90393_StopDMA(&sensors[i++]);
}
}
// Enable other peripery IRQs
NVIC_EnableIRQ(TIM2_IRQn);


// Process next sensor
for ( ;i<MAX_AXIS_NUM;i++)
Expand Down
3 changes: 0 additions & 3 deletions application/Src/tle5011.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ void TLE501x_StartDMA(sensor_t * sensor)
sensor->data[0] = 0x00;
sensor->data[1] = 0x8C;

// Disable other interrupts
NVIC_DisableIRQ(TIM2_IRQn);

SPI_HalfDuplex_Transmit(&sensor->data[0], 2, TLE5011_SPI_MODE);
}

Expand Down
10 changes: 10 additions & 0 deletions application/Src/usb_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,20 @@ void Set_System(void)
/* Enable all GPIOs Clock*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);

GPIOA->ODR &= ~GPIO_Pin_12; // Enumeration
Delay_ms(5); //delay

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);



#else /* defined(STM32F37X) || defined(STM32F303xC) */

Expand Down

0 comments on commit 8b9eef5

Please sign in to comment.