Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
led fixed. delay shorted
  • Loading branch information
tunerok committed Apr 29, 2021
1 parent 547d348 commit 4335bd5
Show file tree
Hide file tree
Showing 38 changed files with 3,979 additions and 4,003 deletions.
50 changes: 35 additions & 15 deletions Core/Src/main.c
Expand Up @@ -85,6 +85,16 @@ volatile int rotation_side = 0;
* @brief The application entry point.
* @retval int
*/
void dumb_blinking(void){
for(int i = 0; i < 2; i++){
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
HAL_Delay(30);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
HAL_Delay(30);
}
}


int main(void)
{
/* USER CODE BEGIN 1 */
Expand Down Expand Up @@ -122,7 +132,7 @@ int main(void)
mediaHID.id = 2;
mediaHID.keys = 0;

int mute_state = 1, next_state = 1, play_state = 1, rev_state = 1;
int mute_state = 0, next_state = 0, play_state = 0, rev_state = 0;
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
/* USER CODE END 2 */

Expand All @@ -137,20 +147,26 @@ int main(void)
/* USER CODE BEGIN 3 */
if(rotation_side > 0){
mediaHID.keys = USB_HID_VOL_UP;
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
//HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);
mediaHID.keys = 0;
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
HAL_Delay(20);
rotation_side = 0;
}
else if (rotation_side < 0){
mediaHID.keys = USB_HID_VOL_DEC;
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
//HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);
mediaHID.keys = 0;
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
HAL_Delay(20);
rotation_side = 0;
}

Expand All @@ -159,12 +175,13 @@ int main(void)
if (mute_state){
mediaHID.keys = USB_HID_MUTE;
mute_state = 0;
dumb_blinking();
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);
mediaHID.keys = 0;
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);

HAL_Delay(20);
}
}
else{
Expand All @@ -175,11 +192,12 @@ int main(void)
if (next_state){
mediaHID.keys = USB_HID_SCAN_NEXT;
next_state = 0;
dumb_blinking();
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);
mediaHID.keys = 0;
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);

}
}
Expand All @@ -192,11 +210,12 @@ int main(void)
if (play_state){
mediaHID.keys = USB_HID_PAUSE;
play_state = 0;
dumb_blinking();
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);
mediaHID.keys = 0;
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);

}
}
Expand All @@ -209,11 +228,12 @@ int main(void)
if (rev_state){
mediaHID.keys = USB_HID_SCAN_PREV;
rev_state = 0;
dumb_blinking();
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);
mediaHID.keys = 0;
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&mediaHID, sizeof(struct mediaHID_t));
HAL_Delay(30);
HAL_Delay(20);

}
}
Expand Down Expand Up @@ -288,7 +308,7 @@ static void MX_GPIO_Init(void)

/*Configure GPIO pin : PC13 */
GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
Expand Down
4,627 changes: 2,285 additions & 2,342 deletions MDK-ARM/JLinkLog.txt

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions MDK-ARM/usb_volumer.uvguix.aashirov

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion MDK-ARM/usb_volumer.uvoptx
Expand Up @@ -140,7 +140,7 @@
<SetRegEntry>
<Number>0</Number>
<Key>JL2CM3</Key>
<Name>-U171101405 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI-JP0 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
<Name>-U779692696 -O78 -S8 -ZTIFSpeedSel50000 -A0 -C0 -JU1 -JI-JP0 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103C8$Flash\STM32F10x_128.FLM)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
Expand Down
Binary file modified MDK-ARM/usb_volumer/main.crf
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/main.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_cortex.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_dma.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_exti.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_flash.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_flash_ex.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_gpio.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_gpio_ex.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_msp.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_pcd.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_pcd_ex.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_pwr.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_rcc.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_rcc_ex.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_tim.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_hal_tim_ex.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_it.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/stm32f1xx_ll_usb.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/system_stm32f1xx.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/usb_device.o
Binary file not shown.
Binary file modified MDK-ARM/usb_volumer/usb_volumer.axf
Binary file not shown.
2 changes: 1 addition & 1 deletion MDK-ARM/usb_volumer/usb_volumer.build_log.htm
Expand Up @@ -32,7 +32,7 @@ <h2>Output:</h2>
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
../Core/Src/main.c: 1 warning, 0 errors
linking...
Program Size: Code=18796 RO-data=292 RW-data=372 ZI-data=3012
Program Size: Code=18880 RO-data=292 RW-data=372 ZI-data=3012
FromELF: creating hex file...
"usb_volumer\usb_volumer.axf" - 0 Error(s), 1 Warning(s).

Expand Down

0 comments on commit 4335bd5

Please sign in to comment.