Skip to content

Instantly share code, notes, and snippets.

@ricma
Created July 25, 2022 14:58
Show Gist options
  • Save ricma/21a3c578841d8e8bb19554336fa288a0 to your computer and use it in GitHub Desktop.
Save ricma/21a3c578841d8e8bb19554336fa288a0 to your computer and use it in GitHub Desktop.
First steps with MCH2022 Badge

Synopsis

Work on the badge from MCH2022

See Also:

How to Develop and Push Python Code

See: https://www.badge.team/docs/badges/mch2022/software-development/

  1. Create this file: /etc/udev/rules.d/99-mch2022.rules as sudo:
    (find-file "/sudo:root@localhost:/etc/udev/rules.d/99-mch2022.rules")
        
  2. Add these lines:

    SUBSYSTEM==”usb”, ATTR{idVendor}==”16d0”, ATTR{idProduct}==”0f9a”, MODE=”0666”

  3. Run
    sudo udevadm control --reload-rules
    sudo udevadm trigger
        
  4. Plug in via usb-C and start the python app. Then
    screen /dev/ttyACM0 115200
        

    which gives you a python prompt.

    Note: To suspend the sesssion: C-a d, to resume: screen -r <TAB>. To kill it from the outside: screen -X -S <TAB> quit.

  5. Enter
    import display
    display.drawFill(0xd62728)  # This is matplotlib's C3 (red)
    display.flush()
        

    see the online API reference. For mch2022 specifics, see:

    import mch22
    dir(mch22)
    ['__class__', 'buttons', 'exit_python', 'fpga_disable', 'fpga_load',
     'fpga_receive', 'fpga_send', 'fpga_send_turbo', 'fpga_transaction',
     'get_brightness', 'lcd_mode', 'read_vbat', 'read_vusb',
     'set_brightness', 'set_handler']
        

Upload My Own App

  1. Get the copy scripts from github:
    sudo -H pip3 install pyusb
    git -C mch2022 clone git@github.com:badgeteam/mch2022-tools.git
        
  2. See what is on the batch
    cd mch2022-tools
    python3 webusb_fat_ls.py /flash/
        

    Booting into WebUSB, please wait …

    ████████████████████100.0%

    transfer speed: 1.28 kb/s Directory listing for ”flash“… Directory “apps” Directory “lib” Directory “cache” Directory “config”

Hatchery

https://mch2022.badge.team/

Using the Display

https://www.badge.team/docs/esp32-platform-firmware/esp32-app-development/api-reference/display

Example App - Neopixels

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment