Recently there was a PR merged into CircuitPython that allows for the mounting of a CIRCUITPY drive on an Android device. Previously this was not possible, so I wanted to try it out. For my testing, I used a Samsung Galaxy A13 phone running Android version 13. The board I used was a Circuit Playground Express running CircuitPython 9.0.0-alpha.4.
I'm currently working on a clock using a Qualia S3 board with a 4" 720x720 round display. The idea is to display an "analog" clock face on it. The clock will show your timezone on Earth and coordinated Mars time (MTC). In looking into MTC, I found the Mars24 Sunclock, which is a piece of desktop software from NASA that shows your local time, UTC time and then MTC.
hiya we're going to do some code porting from Arduino C++ to CircuitPython (Python 3) - begin by reading the cpp and h files in here: https://github.com/adafruit/Adafruit_VCNL4020
i do not need you to summarize or explain code. i do not need you to print out the code, you can ingest it directly. please wait for my direction before starting to port the code
start by converting each #define register name and value pair from the .h file to a const python assignment. const python assignments start with a '_' before the variable name, and the value is wrapped in a 'const()' function call
1. for I2C communication, we'll be using CircuitPython Bus Device: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
2. the circuitpython library will use properties more than get/set functions when applicable. these provide a simpler syntax in user code: thing.foo = 23 vs. thing.set_foo(23) and reading is just: print(thing.foo). this is in line with the circuitpython style guide: https://docs.circuitpython.org/en/latest/docs/design_guide.html#getters-setters
3. do not return bools in the function for error catching, use try/except
4. always include the comments from the arduino functions
ok in arduino we have a getter or setter function, and we define the busio_register based on the register map name, and then make a registerbits object that will let us map into the inner bits. in circuitpython its a lot easier, we can create an 'adafruit_register' variable of type RWBit or RWBits. use https://github.com/adafruit/Adafruit_CircuitPython_Register if you need to reference the class documentation. If the register bits we're looking to address is only 1 bit wide, we can use `register_bit_name = RWBit(DEVICE_REGISTER_CONST, bitnumber)` where `register_bit_name` is a descriptive name for the bit field we are working with, DEVICE_REGISTER_CONST is the matching register name from 'adafruit_busio_register' and bitnumber is the location of the single bit. If the register bit field is more than one bit wide, use 'register_bits_name = RWBits(numbits, DEVICE_REGISTER_CONST, shift)' which adds the number of bit width of the bitfield and the shifting required, you can get those from 'adafruit_busio_registerbits'
i'm working on a big rgb matrix project using the espn API to get data for tracking various sports teams. since it's an rgb matrix it makes sense to display the team logos. however, there are a lot of teams across all of the leagues and images for rgb matrices have to be just so. this part of the project was really intimidating.
however, as luck would have it, the espn API includes links to excellent .PNG image files for each team. i wrote a python script that creates folders on your computer for each set of images, downloads the images, names them to match the team abbreviation in the API, resizes them, adds gamma correction from the image correction for led matrices guide, spits out a properly formatted bitmap file and deletes the original .PNG image