Avatar for stephaneAG

stephaneAG

Member since Jun 2014 • Last active Oct 2018
  • 14 conversations
  • 149 comments

'love hackety trick

Most recent activity

  • in Projects
    Avatar for stephaneAG

    Hi there !

    Thanks for all that :)

    Good to know for the L4 ( I bet the ST guys find Espruino very neat ;p )

    Understood ( for "on my own" on the other board ): so I'll have that kind of fun if trying to do so ;)

    For the 52840, I just checked the topic you linked to: this is pretty cool ( can't wait to test/help on that subject .. & get fully custom HID over USB/bluetooth :D ) !!

    For porting to other boards, I bet you're more than busy hence I'll rely on digging myself & the community to sort things out ;)

    On the build process / build changes / improving Espruino side of things, I wish I had a solution to this but aside from more people full time I have no clues on how to help that ( other than digging & helping myself when I can afford to do so :) ) :/

    On the "xbox360 passthrough" side of things, it seems the Teensy 3.6 offers usb host capability, so I'll try that as well as a tacky transistors+diodes setup ( just to see HOW it fails ;) )
    ( related post on dedicated forum: https://forum.pjrc.com/threads/54026-Tee­nsy-3-6-Xbox360-USB-Passthrough?p=189233­#post189233)

    I'll give back updates as I go :)
    Keep up the good work ++

  • in Projects
    Avatar for stephaneAG

    All right, I checked some things out, but it seems the F4 discovery board has been replaced by the STM32F407VG
    Looking for it online, I guess the following is fully ok with Espruino ? https://www.ebay.fr/itm/Stm32f4-Discover­y-Stm32f407-Cortex-m4-Development-Board-­st-link-V2/263287563871?hash=item3d4d296­65f:g:EsEAAOSwhUtbUwub:rk:3:pf:0

    Also, do you think the following could work ok ( maybe with some tweaks* ? ) https://www.ebay.fr/itm/STM32F407VGT6-AR­M-Cortex-M4-32-bit-MCU-Core-Discovery-De­velopment-Board-STM32F4/263106386751

    *reading the following's 1st page, is seems that the onboard chip is the same ? https://ucilnica.fri.uni-lj.si/pluginfil­e.php/21843/mod_resource/content/0/user_­manual_stm_discovery.pdf
    If so, I guess the latter would just require using another board ST-LINK embed programmer or USB-FTDI adapter to get things ready for dev, right ? ( I found this on the topic: https://www.stm32duino.com/viewtopic.php­?f=39&t=2666)

    I 'll have to check the diffs between the former & the latter ( don't know yet what 'T6' stands for ), but the 2nd one's pricing sparks my interest .. ;)
    On this, do you have the formulas to calculate how many jsvars 'd fit for a particular board's flash size ? ( I'd hugely prefer to Digg by myself & not take someone else's time for further investigations )

    thanks :)

  • in Projects
    Avatar for stephaneAG

    @allObjects haha ^^, it seemed so ;P
    On the link you posted, nice Morse code logging ! ( although it was a little cryptic for me at first ;) )

    @Gordon I just had a look at the beast .. indeed, but so sad that it doesn't offer every pins it provides on connectors :/ For my current needs & considering the price I guess an STM32F4DISCOVERY 'd be a nice fit if fully supported by Espruino :)

    On the nRF side, I just saw these & they seem quite neat ;)

    Since I don't know at all the nRF platform, I currently can't be of any help on these :/
    But hey, if the stack doesn't change ( too much ? ) between the kit I have yet to try & the said one, I'll be glad to digg the subject & try things out ;)

    For the struct size stuff, I tried the following quick test ( on laptop since I don't know yet how to get logs .. using stg else than leds now ;p ) and the result is the expected 6 ..

    // gcc test.c -Wall -o test.a
    // nb: could the makefile used  set some padding ?
    [#include](http://forum.espruino.com/sea­rch/?q=%23include) <stdio.h>
    [#include](http://forum.espruino.com/sea­rch/?q=%23include) <stdint.h> /* to use uint16_t & cie */
    int main(void){
    //int main(int argc, char *argv[]){
      struct gamepadHID_t
      {
        uint16_t buttons;
        //uint8_t buttons1;
        //uint8_t buttons2;
        int8_t left_x;
        int8_t left_y;
        int8_t right_x;
        int8_t right_y;
      };
      struct gamepadHID_t gamepadHID;
      gamepadHID.buttons = 0b0000000000000000;
      //gamepadHID.buttons1 = 0b00000000;
      //gamepadHID.buttons2 = 0b00000000;
      gamepadHID.left_x = 0b00000000;
      gamepadHID.left_y = 0b00000000;
      gamepadHID.right_x = 0b00000000;
      gamepadHID.right_y = 0b00000000;
    
      // debug
      printf("struct size (unsigned long): %lu \n", sizeof(gamepadHID) );
    
      return 0;
    }
    

    I'll try things out later today & report back :)

    & before I forget, I saw these links on some way to flash the HM-10 for custom HID stuff if I'm correct :)
    https://geekhack.org/index.php?topic=622­36.0

  • in Projects
    Avatar for stephaneAG

    Back ;)

    @allObjects thanks for the confirmation, I guessed so but wasn't quite sure ;)
    This being said, in your 'HLHKLHL' chunk, does 'K' stands for tri-state/floating ? ( or is it just that you typed quite fast & that the 'K' keystroke was not meant to happen ? ^^ )
    I read so for the 'bundle auto configured pins' & cie in the pinMode ref, but didn't actually do tests on pinMode to consider it a resource hog ;)
    If theres' no need to 'force' it by using pinMode ( as Gordon says ) I guess I can consider this 'solved' ('d be better actually test 1st, but the logic is validated :) )

    @Gordon I don't know enough yet on the F3 USB stack to even consider being able to see the differences between it & the F1's / F4's so yup, switching boards is 'd be indeed a 'faster & safer' way ( although I could acquire quite a - not that useful afterward- knowledge on their particular implm changes ..)
    Digging how to do stuff directly on the F3 already showed me some changes that did happen

    // basic example of changes in namings of constants
    USER_BUTTON_GPIO_Port, USER_BUTTON_Pin
    // are now
    B1_GPIO_Port, B1_Pin
    // same goes for LEDS - some consts are kept ( fcn name, GPIO_PIN_SET, GPIO_PIN_RESET, ..)
    HAL_GPIO_WritePin(USER_LED_9_GPIO_Port, USER_LED_9_Pin, GPIO_PIN_SET);
    // is now
    HAL_GPIO_WritePin(LD9_GPIO_Port, LD9_Pin, GPIO_PIN_SET);
    

    If I recall coreectly, I noticed some Espruino files you pointed me to use 'stdPeriph' stuff & not HAL ? ( I may be incorrect on this, I'm still getting my head around the stm32f platform ..)

    On the examples I'm currently trying, I gotta switch from HID to CDC* ( then try the combo ;p ) & implement the xbox360 controller on that. If I manage to do so, adding its functionnality to Espruino builds would then 'just' be some js wrappers for C++ calls ( but this is a part I have yet to discover & cover ;P )

    *to try an example doing UART communication with either a laptop or another uC. next on the list is I2C, then SPI ;)

    Do you have in mind a F4 board that would be a kick ass with many pins ? I plan ( & 'd love ) to use Espruino on a client project but I have to use something reliable ( so not my own mess around the F3 .. ), and since it focuses on an 'Escape Game' room, having plenty of pins is quite handy :D

    On the "Espruino Open Adaptive gamepad' topic, I was wondering if there's any USB stack on the nRF boards or the MDBT42Q ?

    My reasons:

    • I really wished a flashed HC-05 allowed custom HID over bluetooth, but it doesn't ( only presets )
    • I need something that can appear as a custom periph( HID or xbox360controller ) over USB
    • having embed WiFi is a plus, allowing realtime buttons mapping changes through an app on laptop/tablet/smartphone when connecting the uC as either a server or client while acting as a bluetooth or usb device

    Currently, I'm using an Espruino WiFi for the wifi part & the usb HID part, & a teensy for the xbox360controller part
    Once I achieve an xbox360controller on the Espruino WiFi over USB, I won't need the teensy anymore, but 'd still need a platform to do custom HID ( & more ? ) over bluetooth ..
    The best 'd be a board that offers both & works fully with Espruino with plenty of pins :p

    @Gordon:

    .. GCC/whatever is padding the elements inside gamepadHID_t to 4 byte boundaries* ..
    .. ooks like it's 6 bytes but it may get reported as 8**. ..
    I'll have to digg those, yet it seems the Gamepad HID I implemented on the f3 acts as expected using the following:

    // while(1)
    if(HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin) == GPIO_PIN_SET){
        HAL_GPIO_WritePin(LD9_GPIO_Port, LD9_Pin, GPIO_PIN_SET);
    
        // stuff is set above in code, whatever the 'actual' state of the button press ..
        USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, sizeof(struct gamepadHID_t));
        HAL_Delay(50);
    
        gamepadHID.buttons = 0;
        gamepadHID.left_x = 0;
        gamepadHID.left_y = 0;
        gamepadHID.right_x = 0;
        gamepadHID.right_y = 0;
    
        USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, sizeof(struct gamepadHID_t));
        HAL_Delay(200);
        HAL_GPIO_WritePin(LD9_GPIO_Port, LD9_Pin, GPIO_PIN_RESET);
      }
    

    *, ** how to know if padding is allowed by GCC ? do you have a quick way to log the size of a report being sent ? ( I'm windering how much I'd need to mod the HID code I'm using to be able to use one of the available uarts to print debig stuff .. since I don't know gdb yet :/ .. )
    From my tests on another little program, using the struct with on uint16_t or 2 uint8t led, quite logically, to 6 bytes, but I wonder how to get the 'final' report size before its gets sent over ..

    @Gordon:

    RN42 links and code
    -> my pleasure ;P

    ps: I plan to produce 3ds for the 'espruino_OpenAdaptiveController.pdf ' at the end of the week :)
    ps2: I wonder how much more 'd be involved to get a 'modified' Espruino WiFi board with more broken out pins ( fro the datasheet, 35/50/81 ? :D )

    I'll be back with updates as soon as can do, as usual :)

    Big thanks for the hints ;)
    +

  • in Projects
    Avatar for stephaneAG

    Since attaching a file didn't work for the image I tried to attach & I just finished testing basic stuff around on Espruino 1V50 firmware for stm32f3discovery, here I try again the attachement ( & post stm's test code here as well ;) )

    /* Espruino on STM32F3DISCOVERY
      Docs:
      https://github.com/espruino/Espruino/blo­b/master/boards/pins/stm32f303.csv
      https://github.com/espruino/Espruino/blo­b/master/boards/STM32F3DISCOVERY.py
      R: connect 'USB ST-LINK' to update Espruino firmware using st-flash utility
      R: connect 'USB USER' only for using Espruino
      R: to 'refresh' the board, unplug/replug 'USB USER'
    
      Nb: currently has troubles when code is 'sent' from right side of IDE,
               even at 9600 bauds & with throttling ..
      //> Prompt not detected - upload failed. Trying to recover...
    */
    
    function buttonWatcher(e) {
      console.log('Hello World Espruino STM32F3DISCOVERY !');
    }
    
    function btnPressed(){
      var btnState = digitalRead(BTN1);
      if( btnState == 1 ){ console.log(e.time); }
    }
    var btnPollT;
    
    //pinMode(BTN1, 'input'); // on A0 - same as below
    //pinMode(BTN1, 'input_pulldown'); // on press, digitalRead displays 1
    //setWatch(buttonWatcher, BTN1, {edge:"falling", repeat:true});
    
    // USB.setConsole(); to prevent 'Console Moved from Serial1' on boot ?
    // WARNING: Parent must be a proper object - not a String, Integer, etc. ?
    //E.on('init', function() { // didn't work
     // worked :)
    function onInit(){
      digitalWrite(LED2, 1); // blue led on
      console.log("Hello World!");
      digitalWrite(LED3, 1); // orange led on
      //setWatch(buttonWatcher, BTN1, {edge:"falling", repeat:true}); // nope
      //setWatch(buttonWatcher, BTN1, {edge:"rising", repeat:true}); // nope
      btnPollT = setTimeout(btnPressed, 1000); // btn polling - nope
      digitalWrite(LED4, 1); // green led on
      USB.setConsole();
      digitalWrite(LED1, 1); // red led on
    }
    //});
    
  • in Projects
    Avatar for stephaneAG

    All right !
    So:
    Thanks to @Frida, I checked few versions of the Espruino firmwares & found one working:1V50 ( yup, a nice release from 2014-02-06 ;p )

    Heading to the http://www.espruino.com/ReferenceSTM32F3­DISCOVERY page, I hacked something up to better visualize the overlay legends for the row of pins: this solution is the best I have in mind ( doesn't move the pins legends ), involves no modification of the page html structure & is purely css.
    I didn't take the time to check if other boards overlay legends had the same overlapping problem, but I think this solution may come quite handy for some :)

    // proposal for the ReferenceSTM32F3DISCOVERY page ( & others ? )
    // generic css way to prevent overlapping pin rows legends ;)
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer):hover [#left](http://forum.espruino.com/search­/?q=%23left) { opacity: 0.1; }
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer):hover [#left2](http://forum.espruino.com/searc­h/?q=%23left2) { opacity: 0.1; }
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer):hover [#right](http://forum.espruino.com/searc­h/?q=%23right) { opacity: 0.1; }
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer):hover [#right2](http://forum.espruino.com/sear­ch/?q=%23right2) { opacity: 0.1; }
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer):hover [#left](http://forum.espruino.com/search­/?q=%23left):hover { opacity: 1; z-index: 10; }
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer):hover [#left2](http://forum.espruino.com/searc­h/?q=%23left2):hover { opacity: 1; z-index: 10; }
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer):hover [#right2](http://forum.espruino.com/sear­ch/?q=%23right2):hover { opacity: 1; z-index: 10; }
    [#boardcontainer](http://forum.espruino.­com/search/?q=%23boardcontainer):hover [#right](http://forum.espruino.com/searc­h/?q=%23right):hover { opacity: 1; z-index: 10; }
    

    This got me wondering if we could have ( or if there is ) a way to have js as well as css for /boards/STM32F3DISCOVERY.py & others ?

    board["_js"] = """
    /* Espruino - prevent pins overlay legends from overlapping when hovering */
    var customStyle = document.createElement('style');
    customStyle.textContent = '#boardcontainer:hover [#left](http://forum.espruino.com/search­/?q=%23left) { opacity: 0.1; }' +
      '#boardcontainer:hover [#left2](http://forum.espruino.com/searc­h/?q=%23left2) { opacity: 0.1; }' +
      '#boardcontainer:hover [#right](http://forum.espruino.com/searc­h/?q=%23right) { opacity: 0.1; }' +
      '#boardcontainer:hover [#right2](http://forum.espruino.com/sear­ch/?q=%23right2) { opacity: 0.1; }' +
      '#boardcontainer:hover [#left](http://forum.espruino.com/search­/?q=%23left):hover { opacity: 1; z-index: 10; } ' +
      '#boardcontainer:hover [#left2](http://forum.espruino.com/searc­h/?q=%23left2):hover { opacity: 1; z-index: 10; } ' +
      '#boardcontainer:hover [#right2](http://forum.espruino.com/sear­ch/?q=%23right2):hover { opacity: 1; z-index: 10; } ' +
      '#boardcontainer:hover [#right](http://forum.espruino.com/searc­h/?q=%23right):hover { opacity: 1; z-index: 10; } ';
    document.body.appendChild(customStyle);
    """
    

    This being said, I don't know yet which file to edit to add a little more content to the generated page ( espruino.com/ReferenceSTM32F3DISCOVERY ): I took some notes on the LEDS positions, colors & mapping that could be neat to have on this page as a reminder

    pin onboard label Espruino label color position
    E9 LD3 LED1 RED UP
    E8 LD4 LED2 BLUE UP-LEFT
    E10 LD5 LED3 ORANGE UP-RIGHT
    E15 LD6 LED4 GREEN LEFT
    E11 LD7 LED5 GREEN RIGHT
    E14 LD8 LED6 ORANGE DOWN-LEFT
    E12 LD9 LED7 BLUE DOWN-RIGHT
    E13 LD10 LED8 RED DOWN

    I could as well add code for the supported* onboard peripherals
    *I read CAN is not supported ( or is it ? ), but I'm wondering about the 'audio' pins ..

    Last but not least, I wonder if there is a typo in one of the labels in the corresponding .py file ?

    // https://github.com/espruino/Espruino/blo­b/master/boards/STM32F3DISCOVERY.py#L78
     'MEMS' : { 'device' : 'LSM303DLHC)', // is the ')' at the end ok ?
    

    This being said, hopefully @Gordon has an idea on how to fix the 'broken' USB & I'll learn the necessary to free him the time it 'd take to implement the fixes ^^ ( to find where it 'broke', the 1st thing I think about is testing firmwares from the 1V50 one up to where it no longer work & then check the diffs between their respective sources, but I don't know how much & which files are :/ )

    I'll digg few more tuts on the stm32f3 to better grasp the subject before being able to investigate the troubles & also port the xbox360 controller code to it ( .. )

    now onto doing few quick tests with the freshly flashed Espruino 1V50 firmware ;)

  • in Projects
    Avatar for stephaneAG

    Hi !
    Thanks for your hint, I actually didn't check the readme on https://github.com/espruino/Espruino :/ ..

    I'd be happy to fix things up, but I'm wondering what it'd imply & "how" is USB broken: I guess simply checking <1V8 implm & get back that code for >1V8 wouldn't work as expected ..

    anyway, thanks a lot: I'll be checking quickly a build <1V8 & see I can get something working/connecting ;)

  • in Projects
    Avatar for stephaneAG

    a quick update on "fixing stuff": it seems I can get the buttons to appear but not in a reliable manner ( I'd say if I'm fast enough plugging the usb cable ? this is weird .. ) and while code shouldn't work ?!
    could this in part come from not waiting enough on init or within the main while loop ?
    also, it could also come from the page I'm using for my tests ( http://html5gamepad.com/ ), but since it worked great until now, I bet the error in in my messy code ;p

    /* ==== main.c ==== */
    // still trying .. and 'sometimes' works with "#define HID_EPIN_SIZE 0x04" in "usbd_hid.h" ?! ;D
      //uint8_t bufferHID[6] = {0, 0, 0, 0, 0};
      uint8_t bufferHID[6] = {0, 0, 0, 0, 0, 0}; // nope ?!
      //uint8_t bufferHID[6] = {}; // gives 'implicit declaration ..' but works ? ..
      //uint8_t bufferHID[6];
      bufferHID[0] = (gamepadHID.buttons & 0xFF);
      bufferHID[1] = ( (gamepadHID.buttons >> 8) & 0xFF);
      bufferHID[2] = gamepadHID.left_x;
      bufferHID[3] = gamepadHID.left_y;
      bufferHID[4] = gamepadHID.right_x;
      bufferHID[5] = gamepadHID.right_y;
      USBD_HID_SendReport(&hUsbDeviceFS, &bufferHID, sizeof(bufferHID));
      //USBD_HID_SendReport(&hUsbDeviceFS, &bufferHID, sizeof(struct gamepadHID_t));
    
      //USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, sizeof(struct gamepadHID_t));
      HAL_Delay(30);
    
    /* ==== usbd_hid.h ==== */
    [#define](http://forum.espruino.com/sear­ch/?q=%23define) HID_EPIN_SIZE                 0x04 // shouldn't be enough, right ?
    
  • in Projects
    Avatar for stephaneAG

    Hi there !

    I'll be writing the hc-05->RN42 guide the coming week ( with screenshots ;p )

    on another subject, I uncovered dust from a STM32F3DISCOVERY yesterday & this time, took enough time to experiment with CubeMX-generated & modded stuff as well as flashing the thing.
    ( the goal is to familiarize myself enough with the stm32 environment without messing with one of my Espruino boards ;) ).
    I succefully flashed a mouse HID & a keyboard+media HID to it, but for some reason, I can't get the GamePad HID to work as intended: it's detected as such, but I still have a byte-related trouble with the buttons ( the joysticks works fine ).

    Thing is: I'm still wondering why the heck is doing so, since after multiple readings of the following code, I see no errors ? :|
    Shouldn't it work if "sizeof(struct gamepadHID_t)" equals to "HID_EPIN_SIZE" ?

    /* ==== main.c ==== */
    /* USER CODE BEGIN 1 */
    struct gamepadHID_t
      {
        //uint16_t buttons;
        uint8_t buttons1;
        uint8_t buttons2;
        int8_t left_x;
        int8_t left_y;
        int8_t right_x;
        int8_t right_y;
      };
      struct gamepadHID_t gamepadHID;
      //gamepadHID.buttons = 0b0000000000000000;
      gamepadHID.buttons1 = 0b00000000;
      gamepadHID.buttons2 = 0b00000000;
      gamepadHID.left_x = 0b00000000;
      gamepadHID.left_y = 0b00000000;
      gamepadHID.right_x = 0b00000000;
      gamepadHID.right_y = 0b00000000;
    /* USER CODE END 1 */
    
    /* USER CODE BEGIN 3 */
    //gamepadHID.buttons = 0x55AA;
      //gamepadHID.buttons = 0b0000000011111111; // works ?!
      //gamepadHID.buttons = 0b0000000111111111; // also works ?!!
      //gamepadHID.buttons = 0b0111111111111111; // also works ..
      //gamepadHID.buttons = 0b1111111111111111;
      //gamepadHID.buttons1 = 0x55;
      //gamepadHID.buttons2 = 0xAA;
      //gamepadHID.buttons1 = 0b11111111;
      //gamepadHID.buttons2 = 0b11111111;
      gamepadHID.buttons1 = 0b01111111;
      gamepadHID.buttons2 = 0b01111111;
      gamepadHID.left_x = 127;
      gamepadHID.left_y = 127;
      gamepadHID.right_x = -127;
      gamepadHID.right_y = -127;
      //USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, sizeof(struct gamepadHID_t));
      //USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, sizeof(struct gamepadHID_t)+2);
      //USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, 8);
      //USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, sizeof(struct gamepadHID_t)+1);
      //HAL_Delay(30);
      //gamepadHID.buttons = 0;
      USBD_HID_SendReport(&hUsbDeviceFS, &gamepadHID, sizeof(struct gamepadHID_t));
      //HAL_Delay(30);
      //unsigned char data[HID_DATA_IN_PACKET_SIZE] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
      //unsigned char data[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
      //uint8_t data[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
      //uint8_t data[6] = { 0x00, 0x00, 127, 127, 127, 127}; // works with below T
      //uint8_t data[6] = { 127, 00, 127, 127, 127, 127}; // nope
      //USBD_HID_SendReport(data, 6);
      //USBD_HID_SendReport(&hUsbDeviceFS, &data, sizeof(data)); // "T" works, but 'implicit declaration' ..
    /* USER CODE END 3 */
    
    /* ==== usb_hid.h ==== */
    /** @defgroup USBD_HID_Exported_Defines
      * @{
      */
    [#define](http://forum.espruino.com/sear­ch/?q=%23define) HID_EPIN_ADDR                 0x81
    [#define](http://forum.espruino.com/sear­ch/?q=%23define) HID_EPIN_SIZE                 0x06 /* max report size - for GamePad */
    // ( .. )
    [#define](http://forum.espruino.com/sear­ch/?q=%23define) HID_CUSTOM_REPORT_DESC_SIZE    46 /* GamePad HID report size */
    
    /* ==== usb_hid.c ==== */
    // TEF Edit: change 'bInterfaceSubClass' to 0 ( gamepad does not respect boot specifications )
    //                & 'nInterfaceProtocol' to 5 ( gamepad )
    __ALIGN_BEGIN static uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ­]  __ALIGN_END =
    {
    // ( .. )
    0x00,         /*bInterfaceSubClass : 1=BOOT, 0=no boot*/
    0x05,         /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse, 5=gamepad */
    // ( .. )
    // custom descriptor for GamePad
    __ALIGN_BEGIN static uint8_t HID_CUSTOM_ReportDesc[HID_CUSTOM_REPORT_­DESC_SIZE]  __ALIGN_END = {
      // 46 bytes
      0x05,   0x01,      // USAGE_PAGE (Generic Desktop)
      0x09,   0x05,      // USAGE (Game Pad) - Hut1_12v2.pdf p28 of 128
      0xA1,   0x01,      // COLLECTION (Application)
    
      0xA1,   0x00,      //   COLLECTION (Physical)
      0x05,   0x09,      //     USAGE_PAGE (Button)
      0x19,   0x01,      //     USAGE_MINIMUM (Button 1)
      0x29,   0x10,      //     USAGE_MAXIMUM (Button 16)
    
      0x15,   0x00,      //     LOGICAL_MINIMUM (0)
      0x25,   0x01,      //     LOGICAL_MAXIMUM (1)
      0x95,   0x10,      //     REPORT_COUNT (16)
      0x75,   0x01,      //     REPORT_SIZE (1)
    
      0x81,   0x02,      //     INPUT (Data,Var,Abs)
    
      0x05,   0x01,      //     USAGE_PAGE (Generic Desktop)
      0x09,   0x30,      //     USAGE (X)
      0x09,   0x31,      //     USAGE (Y)
      0x09,   0x32,      //     USAGE (Z) - Hut1_12v2.pdf p26 = represents R X-axis
      0x09,   0x33,      //     USAGE (Rx) - Hut1_12v2.pdf p26 = represents R Y-axis
    
      0x15,   0x81,      //     LOGICAL_MINIMUM (-127)
      0x25,   0x7F,      //     LOGICAL_MAXIMUM (127)
      0x75,   0x08,      //     REPORT_SIZE (8)
      0x95,   0x04,      //     REPORT_COUNT (4)
    
      0x81,   0x06,      //     INPUT (Data,Var,Abs) - absolute for joysticks ( != rel for mouse )
      0xC0,              //   END_COLLECTION
    
      0xc0               // END_COLLECTION
    };
    
    

    Once the above is fixed, one of the next steps is porting the Xbox360 controller code to it ( and then continue digging how to use an existing controller for the handshake part .. ).

    As a side note, I tried but coouldn't get Espruino on the board ?
    I used the Espruino_1V92 & Espruino_1V92.3 firmwares ( it seems 1V99 isn't available on the repos for the STM32F3DISCOVERY )
    ( I took not of the need for unplugging & replugging the 'USB USER' plug, but no /dev/tty<..> ever appear on my mac :/ )
    The cli commands I used are the following:

    // to flash any firmware generated from a 'make' call on CubeMX-generated files
    st-flash --format ihex write ./build/stm32f3discovery_hidTest1.hex
    // to flash Espruino firmware ? :|
    st-flash erase // to clean stuff
    st-flash write ./espruino_1v92/espruino_1v92.3_stm32f3d­iscovery.bin 0x08000000
    
Actions