Merge pull request #532 from hathach/house-keeping

House keeping
This commit is contained in:
Ha Thach
2020-10-09 21:25:17 +07:00
committed by GitHub
73 changed files with 118 additions and 165 deletions
+4 -4
View File
@@ -35,7 +35,7 @@ jobs:
- 'device/hid_composite' - 'device/hid_composite'
- 'device/hid_composite_freertos' - 'device/hid_composite_freertos'
- 'device/hid_generic_inout' - 'device/hid_generic_inout'
- 'device/hid_multipleinterface' - 'device/hid_multiple_interface'
- 'device/midi_test' - 'device/midi_test'
- 'device/msc_dual_lun' - 'device/msc_dual_lun'
- 'device/net_lwip_webserver' - 'device/net_lwip_webserver'
@@ -66,14 +66,14 @@ jobs:
npm install --global xpm npm install --global xpm
xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest
echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" echo `echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH
echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" echo `echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` >> $GITHUB_PATH
# TI MSP430 GCC # TI MSP430 GCC
mkdir -p /tmp/dl/ mkdir -p /tmp/dl/
[ -f "/tmp/dl/msp430-gcc.tar.bz2" ] || wget --progress=dot:mega $MSP430GCC_URL -O /tmp/dl/msp430-gcc.tar.bz2 [ -f "/tmp/dl/msp430-gcc.tar.bz2" ] || wget --progress=dot:mega $MSP430GCC_URL -O /tmp/dl/msp430-gcc.tar.bz2
tar -C $HOME -xaf /tmp/dl/msp430-gcc.tar.bz2 tar -C $HOME -xaf /tmp/dl/msp430-gcc.tar.bz2
echo "::add-path::`echo $HOME/msp430-gcc-*_linux64/bin`" echo `echo $HOME/msp430-gcc-*_linux64/bin` >> $GITHUB_PATH
- name: Checkout TinyUSB - name: Checkout TinyUSB
uses: actions/checkout@v2 uses: actions/checkout@v2
@@ -34,6 +34,12 @@
// MACRO CONSTANT TYPEDEF PROTYPES // MACRO CONSTANT TYPEDEF PROTYPES
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Interface index depends on the order in configuration descriptor
enum {
ITF_KEYBOARD = 0,
ITF_MOUSE = 1
};
/* Blink pattern /* Blink pattern
* - 250 ms : device not mounted * - 250 ms : device not mounted
* - 1000 ms : device mounted * - 1000 ms : device mounted
@@ -104,10 +110,6 @@ void tud_resume_cb(void)
void hid_task(void) void hid_task(void)
{ {
//Set up interfaces
const uint8_t keyboard_interface = 0;
const uint8_t mouse_interface = 1;
// Poll every 10ms // Poll every 10ms
const uint32_t interval_ms = 10; const uint32_t interval_ms = 10;
static uint32_t start_ms = 0; static uint32_t start_ms = 0;
@@ -126,7 +128,7 @@ void hid_task(void)
} }
/*------------- Keyboard -------------*/ /*------------- Keyboard -------------*/
if ( tud_hid_n_ready(keyboard_interface) ) if ( tud_hid_n_ready(ITF_KEYBOARD) )
{ {
// use to avoid send multiple consecutive zero report for keyboard // use to avoid send multiple consecutive zero report for keyboard
static bool has_key = false; static bool has_key = false;
@@ -136,29 +138,26 @@ void hid_task(void)
uint8_t keycode[6] = { 0 }; uint8_t keycode[6] = { 0 };
keycode[0] = HID_KEY_A; keycode[0] = HID_KEY_A;
tud_hid_n_keyboard_report(keyboard_interface, 0, 0, keycode); tud_hid_n_keyboard_report(ITF_KEYBOARD, 0, 0, keycode);
has_key = true; has_key = true;
}else }else
{ {
// send empty key report if previously has key pressed // send empty key report if previously has key pressed
if (has_key) tud_hid_n_keyboard_report(keyboard_interface, 0, 0, NULL); if (has_key) tud_hid_n_keyboard_report(ITF_KEYBOARD, 0, 0, NULL);
has_key = false; has_key = false;
} }
} }
/*------------- Mouse -------------*/ /*------------- Mouse -------------*/
if ( tud_hid_n_ready(mouse_interface) ) if ( tud_hid_n_ready(ITF_MOUSE) )
{ {
if ( btn ) if ( btn )
{ {
int8_t const delta = 5; int8_t const delta = 5;
// no button, right + down, no scroll pan // no button, right + down, no scroll pan
tud_hid_n_mouse_report(mouse_interface, 0, 0x00, delta, delta, 0, 0); tud_hid_n_mouse_report(ITF_MOUSE, 0, 0x00, delta, delta, 0, 0);
// delay a bit before attempt to send keyboard report
board_delay(10);
} }
} }
} }
@@ -167,7 +166,7 @@ void hid_task(void)
// Invoked when received GET_REPORT control request // Invoked when received GET_REPORT control request
// Application must fill buffer report's content and return its length. // Application must fill buffer report's content and return its length.
// Return zero will cause the stack to STALL request // Return zero will cause the stack to STALL request
uint16_t tud_hid_n_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen) uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen)
{ {
// TODO not Implemented // TODO not Implemented
(void) itf; (void) itf;
@@ -181,7 +180,7 @@ uint16_t tud_hid_n_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type
// Invoked when received SET_REPORT control request or // Invoked when received SET_REPORT control request or
// received data on OUT endpoint ( Report ID = 0, Type = 0 ) // received data on OUT endpoint ( Report ID = 0, Type = 0 )
void tud_hid_n_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize)
{ {
// TODO set LED based on CAPLOCK, NUMLOCK etc... // TODO set LED based on CAPLOCK, NUMLOCK etc...
(void) itf; (void) itf;
@@ -83,7 +83,7 @@ uint8_t const desc_hid_report2[] =
// Invoked when received GET HID REPORT DESCRIPTOR // Invoked when received GET HID REPORT DESCRIPTOR
// Application return pointer to descriptor // Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete // Descriptor contents must exist long enough for transfer to complete
uint8_t const * tud_hid_n_descriptor_report_cb(uint8_t itf) uint8_t const * tud_hid_descriptor_report_cb(uint8_t itf)
{ {
if (itf == 0) if (itf == 0)
{ {
+7
View File
@@ -147,6 +147,8 @@ else
JLINKEXE = JLinkExe JLINKEXE = JLinkExe
endif endif
JLINK_IF ?= swd
# Flash using jlink # Flash using jlink
flash-jlink: $(BUILD)/$(BOARD)-firmware.hex flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
@echo halt > $(BUILD)/$(BOARD).jlink @echo halt > $(BUILD)/$(BOARD).jlink
@@ -161,4 +163,9 @@ flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
flash-stlink: $(BUILD)/$(BOARD)-firmware.elf flash-stlink: $(BUILD)/$(BOARD)-firmware.elf
STM32_Programmer_CLI --connect port=swd --write $< --go STM32_Programmer_CLI --connect port=swd --write $< --go
# flash with pyocd
flash-pyocd: $(BUILD)/$(BOARD)-firmware.hex
pyocd flash -t $(PYOCD_TARGET) $<
pyocd reset -t $(PYOCD_TARGET)
endif # Make target endif # Make target
-1
View File
@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# For uf2 conversion # For uf2 conversion
UF2_FAMILY = 0xADA52840 UF2_FAMILY = 0xADA52840
-1
View File
@@ -51,7 +51,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# flash using bossac (as part of Nano33 BSP tools) # flash using bossac (as part of Nano33 BSP tools)
# can be found in arduino15/packages/arduino/tools/bossac/ # can be found in arduino15/packages/arduino/tools/bossac/
@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# For uf2 conversion # For uf2 conversion
UF2_FAMILY = 0xADA52840 UF2_FAMILY = 0xADA52840
@@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD21G18 JLINK_DEVICE = ATSAMD21G18
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: $(BUILD)/$(BOARD)-firmware.uf2 flash: $(BUILD)/$(BOARD)-firmware.uf2
-1
View File
@@ -57,7 +57,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAME51J19 JLINK_DEVICE = ATSAME51J19
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = DA14695 JLINK_DEVICE = DA14695
JLINK_IF = swd
# flash using jlink but with some twists # flash using jlink but with some twists
flash: flash-dialog flash: flash-dialog
-1
View File
@@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = DA14699 JLINK_DEVICE = DA14699
JLINK_IF = swd
# flash using jlink but with some twists # flash using jlink but with some twists
flash: flash-dialog flash: flash-dialog
-1
View File
@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC4088 JLINK_DEVICE = LPC4088
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC4357_M4 JLINK_DEVICE = LPC4357_M4
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD21G18 JLINK_DEVICE = ATSAMD21G18
JLINK_IF = swd
# flash using bossac at least version 1.8 # flash using bossac at least version 1.8
# can be found in arduino15/packages/arduino/tools/bossac/ # can be found in arduino15/packages/arduino/tools/bossac/
-1
View File
@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD51J19 JLINK_DEVICE = ATSAMD51J19
JLINK_IF = swd
# flash using bossac at least version 1.8 # flash using bossac at least version 1.8
# can be found in arduino15/packages/arduino/tools/bossac/ # can be found in arduino15/packages/arduino/tools/bossac/
-1
View File
@@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# For uf2 conversion # For uf2 conversion
UF2_FAMILY = 0xADA52840 UF2_FAMILY = 0xADA52840
-1
View File
@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# For uf2 conversion # For uf2 conversion
UF2_FAMILY = 0xADA52840 UF2_FAMILY = 0xADA52840
-1
View File
@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f405rg JLINK_DEVICE = stm32f405rg
JLINK_IF = swd
# Path to STM32 Cube Programmer CLI, should be added into system path # Path to STM32 Cube Programmer CLI, should be added into system path
STM32Prog = STM32_Programmer_CLI STM32Prog = STM32_Programmer_CLI
-1
View File
@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD21G18 JLINK_DEVICE = ATSAMD21G18
JLINK_IF = swd
# flash using bossac at least version 1.8 # flash using bossac at least version 1.8
# can be found in arduino15/packages/arduino/tools/bossac/ # can be found in arduino15/packages/arduino/tools/bossac/
-1
View File
@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD51J19 JLINK_DEVICE = ATSAMD51J19
JLINK_IF = swd
# flash using bossac at least version 1.8 # flash using bossac at least version 1.8
# can be found in arduino15/packages/arduino/tools/bossac/ # can be found in arduino15/packages/arduino/tools/bossac/
-1
View File
@@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# For uf2 conversion # For uf2 conversion
UF2_FAMILY = 0xADA52840 UF2_FAMILY = 0xADA52840
-1
View File
@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC11U37/401 JLINK_DEVICE = LPC11U37/401
JLINK_IF = swd
# flash using pyocd # flash using pyocd
flash: $(BUILD)/$(BOARD)-firmware.hex flash: $(BUILD)/$(BOARD)-firmware.hex
-1
View File
@@ -37,7 +37,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC11U68 JLINK_DEVICE = LPC11U68
JLINK_IF = swd
# flash using pyocd # flash using pyocd
flash: $(BUILD)/$(BOARD)-firmware.hex flash: $(BUILD)/$(BOARD)-firmware.hex
-1
View File
@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM3
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC1347 JLINK_DEVICE = LPC1347
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM3
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC1549 JLINK_DEVICE = LPC1549
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM3
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC1769 JLINK_DEVICE = LPC1769
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -41,7 +41,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC51U68 JLINK_DEVICE = LPC51U68
JLINK_IF = swd
# flash using pyocd (51u68 is not supported yet) # flash using pyocd (51u68 is not supported yet)
flash: $(BUILD)/$(BOARD)-firmware.hex flash: $(BUILD)/$(BOARD)-firmware.hex
-1
View File
@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC54114J256_M4 JLINK_DEVICE = LPC54114J256_M4
JLINK_IF = swd
# flash using pyocd # flash using pyocd
flash: $(BUILD)/$(BOARD)-firmware.hex flash: $(BUILD)/$(BOARD)-firmware.hex
-1
View File
@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC55S69 JLINK_DEVICE = LPC55S69
JLINK_IF = swd
# flash using pyocd # flash using pyocd
flash: $(BUILD)/$(BOARD)-firmware.hex flash: $(BUILD)/$(BOARD)-firmware.hex
-1
View File
@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD21G18 JLINK_DEVICE = ATSAMD21G18
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: $(BUILD)/$(BOARD)-firmware.bin flash: $(BUILD)/$(BOARD)-firmware.bin
-1
View File
@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM3
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC1768 JLINK_DEVICE = LPC1768
JLINK_IF = swd
# flash using pyocd # flash using pyocd
flash: $(BUILD)/$(BOARD)-firmware.hex flash: $(BUILD)/$(BOARD)-firmware.hex
-1
View File
@@ -37,7 +37,6 @@ FREERTOS_PORT = ARM_CM3
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = LPC1857 JLINK_DEVICE = LPC1857
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD21G18 JLINK_DEVICE = ATSAMD21G18
JLINK_IF = swd
# flash using bossac at least version 1.8 # flash using bossac at least version 1.8
# can be found in arduino15/packages/arduino/tools/bossac/ # can be found in arduino15/packages/arduino/tools/bossac/
-1
View File
@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD51J19 JLINK_DEVICE = ATSAMD51J19
JLINK_IF = swd
# flash using bossac at least version 1.8 # flash using bossac at least version 1.8
# can be found in arduino15/packages/arduino/tools/bossac/ # can be found in arduino15/packages/arduino/tools/bossac/
+5 -4
View File
@@ -49,8 +49,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = MIMXRT1011DAE5A JLINK_DEVICE = MIMXRT1011DAE5A
JLINK_IF = swd
# flash by copying bin file to DAP Mass Storage # For flash-pyocd target
flash: $(BUILD)/$(BOARD)-firmware.bin PYOCD_TARGET = mimxrt1010
cp $< /media/$(USER)/RT1010-EVK/
# flash using pyocd
flash: flash-pyocd
+3 -6
View File
@@ -45,12 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = MIMXRT1015DAF5A JLINK_DEVICE = MIMXRT1015DAF5A
JLINK_IF = swd
# flash by copying bin file to DAP Mass Storage # For flash-pyocd target
flash: $(BUILD)/$(BOARD)-firmware.bin PYOCD_TARGET = mimxrt1015
cp $< /media/$(USER)/RT1015-EVK/
# flash using pyocd # flash using pyocd
#flash: $(BUILD)/$(BOARD)-firmware.hex flash: flash-pyocd
# pyocd flash -b MIMXRT1015-EVK $<
+5 -4
View File
@@ -45,8 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = MIMXRT1021DAG5A JLINK_DEVICE = MIMXRT1021DAG5A
JLINK_IF = swd
# flash by copying bin file to DAP Mass Storage # For flash-pyocd target
flash: $(BUILD)/$(BOARD)-firmware.bin PYOCD_TARGET = mimxrt1020
cp $< /media/$(USER)/RT1020-EVK/
# flash using pyocd
flash: flash-pyocd
+4 -6
View File
@@ -43,10 +43,8 @@ CHIP_FAMILY = transdimension
# For freeRTOS port source # For freeRTOS port source
FREERTOS_PORT = ARM_CM7/r0p1 FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-pyocd target
JLINK_DEVICE = MIMXRT1052xxx6B PYOCD_TARGET = mimxrt1050
JLINK_IF = swd
# flash by copying bin file to DAP Mass Storage # flash using pyocd
flash: $(BUILD)/$(BOARD)-firmware.bin flash: flash-pyocd
cp $< /media/$(USER)/RT1050-EVK/
+5 -4
View File
@@ -45,8 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = MIMXRT1062xxx6A JLINK_DEVICE = MIMXRT1062xxx6A
JLINK_IF = swd
# flash by copying bin file to DAP Mass Storage # For flash-pyocd target
flash: $(BUILD)/$(BOARD)-firmware.bin PYOCD_TARGET = mimxrt1060
cp $< /media/$(USER)/RT1060-EVK/
# flash using pyocd
flash: flash-pyocd
+5 -4
View File
@@ -45,8 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = MIMXRT1064xxx6A JLINK_DEVICE = MIMXRT1064xxx6A
JLINK_IF = swd
# flash by copying bin file to DAP Mass Storage # For flash-pyocd target
flash: $(BUILD)/$(BOARD)-firmware.bin PYOCD_TARGET = mimxrt1064
cp $< /media/$(USER)/RT1064-EVK/
# flash using pyocd
flash: flash-pyocd
-1
View File
@@ -48,7 +48,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# flash using Nordic nrfutil (pip2 install nrfutil) # flash using Nordic nrfutil (pip2 install nrfutil)
# make BOARD=nrf52840_mdk_dongle SERIAL=/dev/ttyACM0 all flash # make BOARD=nrf52840_mdk_dongle SERIAL=/dev/ttyACM0 all flash
-1
View File
@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = NUC121SC2AE JLINK_DEVICE = NUC121SC2AE
JLINK_IF = swd
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
# Please compile and install it from github source # Please compile and install it from github source
-1
View File
@@ -33,7 +33,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = NUC125SC2AE JLINK_DEVICE = NUC125SC2AE
JLINK_IF = swd
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
# Please compile and install it from github source # Please compile and install it from github source
-1
View File
@@ -53,7 +53,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = NUC126VG4AE JLINK_DEVICE = NUC126VG4AE
JLINK_IF = swd
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
# Please compile and install it from github source # Please compile and install it from github source
-1
View File
@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = NUC120LE3 JLINK_DEVICE = NUC120LE3
JLINK_IF = swd
# Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
# Please compile and install it from github source # Please compile and install it from github source
-1
View File
@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = NUC505YO13Y JLINK_DEVICE = NUC505YO13Y
JLINK_IF = swd
# Note # Note
# To be able to program the SPI flash, it need to boot with ICP mode "1011". # To be able to program the SPI flash, it need to boot with ICP mode "1011".
-1
View File
@@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# flash using Nordic nrfutil (pip2 install nrfutil) # flash using Nordic nrfutil (pip2 install nrfutil)
# make BOARD=pca10059 SERIAL=/dev/ttyACM0 all flash # make BOARD=pca10059 SERIAL=/dev/ttyACM0 all flash
-1
View File
@@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52833_XXAA JLINK_DEVICE = nRF52833_XXAA
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f405rg JLINK_DEVICE = stm32f405rg
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -48,7 +48,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = nRF52840_xxAA JLINK_DEVICE = nRF52840_xxAA
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD11D14 JLINK_DEVICE = ATSAMD11D14
JLINK_IF = swd
# flash using edbg # flash using edbg
flash: $(BUILD)/$(BOARD)-firmware.bin flash: $(BUILD)/$(BOARD)-firmware.bin
-1
View File
@@ -47,7 +47,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMG55J19 JLINK_DEVICE = ATSAMG55J19
JLINK_IF = swd
# flash using edbg from https://github.com/ataradov/edbg # flash using edbg from https://github.com/ataradov/edbg
flash: $(BUILD)/$(BOARD)-firmware.bin flash: $(BUILD)/$(BOARD)-firmware.bin
-1
View File
@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = ATSAMD21G18 JLINK_DEVICE = ATSAMD21G18
JLINK_IF = swd
# flash using jlink # flash using jlink
flash: flash-jlink flash: flash-jlink
-1
View File
@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f070rb JLINK_DEVICE = stm32f070rb
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f072rb JLINK_DEVICE = stm32f072rb
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM3
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f103c8 JLINK_DEVICE = stm32f103c8
JLINK_IF = swd
# flash target ROM bootloader # flash target ROM bootloader
flash: $(BUILD)/$(BOARD)-firmware.bin flash: $(BUILD)/$(BOARD)-firmware.bin
-1
View File
@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM3
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f207zg JLINK_DEVICE = stm32f207zg
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f303vc JLINK_DEVICE = stm32f303vc
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f401cc JLINK_DEVICE = stm32f401cc
JLINK_IF = swd
# flash target ROM bootloader # flash target ROM bootloader
flash: $(BUILD)/$(BOARD)-firmware.bin flash: $(BUILD)/$(BOARD)-firmware.bin
-1
View File
@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f407vg JLINK_DEVICE = stm32f407vg
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f411ce JLINK_DEVICE = stm32f411ce
JLINK_IF = swd
# flash target ROM bootloader # flash target ROM bootloader
flash: $(BUILD)/$(BOARD)-firmware.bin flash: $(BUILD)/$(BOARD)-firmware.bin
-1
View File
@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f411ve JLINK_DEVICE = stm32f411ve
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32f41zx JLINK_DEVICE = stm32f41zx
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -57,7 +57,6 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32h743xi JLINK_DEVICE = stm32h743xi
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -52,7 +52,6 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32h745xi JLINK_DEVICE = stm32h745xi
JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink
-1
View File
@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM0
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = STM32L053R8 JLINK_DEVICE = STM32L053R8
JLINK_IF = swd
# Path to STM32 Cube Programmer CLI, should be added into system path # Path to STM32 Cube Programmer CLI, should be added into system path
STM32Prog = STM32_Programmer_CLI STM32Prog = STM32_Programmer_CLI
-1
View File
@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM4F
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32l476vg JLINK_DEVICE = stm32l476vg
JLINK_IF = swd
# Path to STM32 Cube Programmer CLI, should be added into system path # Path to STM32 Cube Programmer CLI, should be added into system path
STM32Prog = STM32_Programmer_CLI STM32Prog = STM32_Programmer_CLI
-1
View File
@@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = MIMXRT1062xxx6A JLINK_DEVICE = MIMXRT1062xxx6A
JLINK_IF = swd
# flash by using teensy_loader_cli https://github.com/PaulStoffregen/teensy_loader_cli # flash by using teensy_loader_cli https://github.com/PaulStoffregen/teensy_loader_cli
# Make sure it is in your PATH # Make sure it is in your PATH
+47 -43
View File
@@ -57,17 +57,7 @@ typedef struct
CFG_TUSB_MEM_SECTION static hidd_interface_t _hidd_itf[CFG_TUD_HID]; CFG_TUSB_MEM_SECTION static hidd_interface_t _hidd_itf[CFG_TUD_HID];
/*------------- Helpers -------------*/ /*------------- Helpers -------------*/
static inline hidd_interface_t* get_interface_by_itfnum(uint8_t itf_num) static inline uint8_t get_index_by_itfnum(uint8_t itf_num)
{
for (uint8_t i=0; i < CFG_TUD_HID; i++ )
{
if ( itf_num == _hidd_itf[i].itf_num ) return &_hidd_itf[i];
}
return NULL;
}
static inline uint8_t get_hid_index_by_itfnum(uint8_t itf_num)
{ {
for (uint8_t i=0; i < CFG_TUD_HID; i++ ) for (uint8_t i=0; i < CFG_TUD_HID; i++ )
{ {
@@ -227,13 +217,10 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request
{ {
TU_VERIFY(request->bmRequestType_bit.recipient == TUSB_REQ_RCPT_INTERFACE); TU_VERIFY(request->bmRequestType_bit.recipient == TUSB_REQ_RCPT_INTERFACE);
hidd_interface_t* p_hid = get_interface_by_itfnum( (uint8_t) request->wIndex ); uint8_t const hid_itf = get_index_by_itfnum((uint8_t) request->wIndex);
TU_ASSERT(p_hid); TU_VERIFY(hid_itf < CFG_TUD_HID);
#if CFG_TUD_HID>1 hidd_interface_t* p_hid = &_hidd_itf[hid_itf];
uint8_t const hid_itf = get_hid_index_by_itfnum((uint8_t) request->wIndex);
TU_VERIFY(hid_itf<0xFF);
#endif
if (request->bmRequestType_bit.type == TUSB_REQ_TYPE_STANDARD) if (request->bmRequestType_bit.type == TUSB_REQ_TYPE_STANDARD)
{ {
@@ -249,11 +236,11 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request
} }
else if (request->bRequest == TUSB_REQ_GET_DESCRIPTOR && desc_type == HID_DESC_TYPE_REPORT) else if (request->bRequest == TUSB_REQ_GET_DESCRIPTOR && desc_type == HID_DESC_TYPE_REPORT)
{ {
#if CFG_TUD_HID>1 uint8_t const * desc_report = tud_hid_descriptor_report_cb(
uint8_t const * desc_report = tud_hid_n_descriptor_report_cb(hid_itf); #if CFG_TUD_HID > 1
#else hid_itf // TODO for backward compatible callback, remove later when appropriate
uint8_t const * desc_report = tud_hid_descriptor_report_cb(); #endif
#endif );
tud_control_xfer(rhport, request, (void*) desc_report, p_hid->report_desc_len); tud_control_xfer(rhport, request, (void*) desc_report, p_hid->report_desc_len);
} }
else else
@@ -272,11 +259,12 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request
uint8_t const report_type = tu_u16_high(request->wValue); uint8_t const report_type = tu_u16_high(request->wValue);
uint8_t const report_id = tu_u16_low(request->wValue); uint8_t const report_id = tu_u16_low(request->wValue);
#if CFG_TUD_HID>1 uint16_t xferlen = tud_hid_get_report_cb(
uint16_t xferlen = tud_hid_n_get_report_cb(hid_itf, report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength); #if CFG_TUD_HID > 1
#else hid_itf, // TODO for backward compatible callback, remove later when appropriate
uint16_t xferlen = tud_hid_get_report_cb(report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength); #endif
#endif report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength
);
TU_ASSERT( xferlen > 0 ); TU_ASSERT( xferlen > 0 );
tud_control_xfer(rhport, request, p_hid->epin_buf, xferlen); tud_control_xfer(rhport, request, p_hid->epin_buf, xferlen);
@@ -293,7 +281,12 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request
if ( tud_hid_set_idle_cb ) if ( tud_hid_set_idle_cb )
{ {
// stall request if callback return false // stall request if callback return false
if ( !tud_hid_set_idle_cb(p_hid->idle_rate) ) return false; TU_VERIFY( tud_hid_set_idle_cb(
#if CFG_TUD_HID > 1
hid_itf, // TODO for backward compatible callback, remove later when appropriate
#endif
p_hid->idle_rate)
);
} }
tud_control_status(rhport, request); tud_control_status(rhport, request);
@@ -314,7 +307,15 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request
case HID_REQ_CONTROL_SET_PROTOCOL: case HID_REQ_CONTROL_SET_PROTOCOL:
p_hid->boot_mode = 1 - request->wValue; // 0 is Boot, 1 is Report protocol p_hid->boot_mode = 1 - request->wValue; // 0 is Boot, 1 is Report protocol
if (tud_hid_boot_mode_cb) tud_hid_boot_mode_cb(p_hid->boot_mode); if (tud_hid_boot_mode_cb)
{
tud_hid_boot_mode_cb(
#if CFG_TUD_HID > 1
hid_itf, // TODO for backward compatible callback, remove later when appropriate
#endif
p_hid->boot_mode
);
}
tud_control_status(rhport, request); tud_control_status(rhport, request);
break; break;
@@ -334,8 +335,11 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request
bool hidd_control_complete(uint8_t rhport, tusb_control_request_t const * p_request) bool hidd_control_complete(uint8_t rhport, tusb_control_request_t const * p_request)
{ {
(void) rhport; (void) rhport;
hidd_interface_t* p_hid = get_interface_by_itfnum( (uint8_t) p_request->wIndex );
TU_ASSERT(p_hid); uint8_t const hid_itf = get_index_by_itfnum((uint8_t) p_request->wIndex);
TU_VERIFY(hid_itf < CFG_TUD_HID);
hidd_interface_t* p_hid = &_hidd_itf[hid_itf];
if (p_request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS && if (p_request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS &&
p_request->bRequest == HID_REQ_CONTROL_SET_REPORT) p_request->bRequest == HID_REQ_CONTROL_SET_REPORT)
@@ -344,13 +348,12 @@ bool hidd_control_complete(uint8_t rhport, tusb_control_request_t const * p_requ
uint8_t const report_type = tu_u16_high(p_request->wValue); uint8_t const report_type = tu_u16_high(p_request->wValue);
uint8_t const report_id = tu_u16_low(p_request->wValue); uint8_t const report_id = tu_u16_low(p_request->wValue);
#if CFG_TUD_HID>1 tud_hid_set_report_cb(
uint8_t const hid_itf = get_hid_index_by_itfnum((uint8_t)p_request->wIndex); #if CFG_TUD_HID > 1
TU_VERIFY(hid_itf<0xFF); hid_itf, // TODO for backward compatible callback, remove later when appropriate
tud_hid_n_set_report_cb(hid_itf, report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength); #endif
#else report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength
tud_hid_set_report_cb(report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength); );
#endif
} }
return true; return true;
@@ -372,11 +375,12 @@ bool hidd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
if (ep_addr == p_hid->ep_out) if (ep_addr == p_hid->ep_out)
{ {
#if CFG_TUD_HID>1 tud_hid_set_report_cb(
tud_hid_n_set_report_cb(itf, 0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes); #if CFG_TUD_HID > 1
#else itf, // TODO for backward compatible callback, remove later when appropriate
tud_hid_set_report_cb(0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes); #endif
#endif 0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes
);
TU_ASSERT(usbd_edpt_xfer(rhport, p_hid->ep_out, p_hid->epout_buf, sizeof(p_hid->epout_buf))); TU_ASSERT(usbd_edpt_xfer(rhport, p_hid->ep_out, p_hid->epout_buf, sizeof(p_hid->epout_buf)));
} }
+19 -16
View File
@@ -84,39 +84,42 @@ static inline bool tud_hid_mouse_report(uint8_t report_id, uint8_t buttons, int8
// Callbacks (Weak is optional) // Callbacks (Weak is optional)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#if CFG_TUD_HID > 1
// Invoked when received GET HID REPORT DESCRIPTOR request // Invoked when received GET HID REPORT DESCRIPTOR request
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete // Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
#if CFG_TUD_HID>1 uint8_t const * tud_hid_descriptor_report_cb(uint8_t itf);
uint8_t const * tud_hid_n_descriptor_report_cb(uint8_t itf);
#else
uint8_t const * tud_hid_descriptor_report_cb(void);
#endif
// Invoked when received GET_REPORT control request // Invoked when received GET_REPORT control request
// Application must fill buffer report's content and return its length. // Application must fill buffer report's content and return its length.
// Return zero will cause the stack to STALL request // Return zero will cause the stack to STALL request
#if CFG_TUD_HID>1 uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen);
uint16_t tud_hid_n_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen);
#else
uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen);
#endif
// Invoked when received SET_REPORT control request or // Invoked when received SET_REPORT control request or
// received data on OUT endpoint ( Report ID = 0, Type = 0 ) // received data on OUT endpoint ( Report ID = 0, Type = 0 )
#if CFG_TUD_HID>1 void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize);
void tud_hid_n_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize);
#else
void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize);
#endif
// Invoked when received SET_PROTOCOL request ( mode switch Boot <-> Report ) // Invoked when received SET_PROTOCOL request ( mode switch Boot <-> Report )
TU_ATTR_WEAK void tud_hid_boot_mode_cb(uint8_t boot_mode); TU_ATTR_WEAK void tud_hid_boot_mode_cb(uint8_t itf, uint8_t boot_mode);
// Invoked when received SET_IDLE request. return false will stall the request // Invoked when received SET_IDLE request. return false will stall the request
// - Idle Rate = 0 : only send report if there is changes, i.e skip duplication // - Idle Rate = 0 : only send report if there is changes, i.e skip duplication
// - Idle Rate > 0 : skip duplication, but send at least 1 report every idle rate (in unit of 4 ms). // - Idle Rate > 0 : skip duplication, but send at least 1 report every idle rate (in unit of 4 ms).
TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t itf, uint8_t idle_rate);
#else
// TODO for backward compatible callback, remove later when appropriate
uint8_t const * tud_hid_descriptor_report_cb(void);
uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen);
void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize);
TU_ATTR_WEAK void tud_hid_boot_mode_cb(uint8_t boot_mode);
TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t idle_rate); TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t idle_rate);
#endif
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Inline Functions // Inline Functions
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+