Package: iic2343
IIC2343Write to the Basys3 ROM directly.InstallationInstall usingpip!$pipinstalliic2343UsageTo use the library, import theBasys3object directly and use thebegin,writeandendmethods!fromiic2343importBasys3instance=Basys3()instance.begin(port_number=2)# port_number is optionalinstance.write(1,bytearray([0x00,0x00,0x10,0x16,0x01]))instance.write(2,bytearray([0x00,0x00,0x00,0x18,0x03]))instance.write(3,bytearray([0x00,0x00,0x20,0x18,0x03]))instance.write(4,bytearray([0x00,0x00,0x00,0x20,0x00]))instance.end()MethodsHere, aBasys3instance has 3 methods:beginThe method receives an optionalport_numberparameter (in needs to be anint). If the parameter is not present and there is only one available serial port on your machine, theBasys3instance will use that serial port. Otherwise, it will raise an exception. The method initializes a port towriteto.writeThe method receives anaddressparameter (anint) and awordparameter (abytearray). It then attempts to write thewordon the specifiedaddress. If theBasys3instance fails, it returns a0. Otherwise, it returns anint.endThe method receives no parameters, and simply closes the port initialized on thebeginmethod.AttributesTheBasys3instance also has 1 attribute:available_portsThis attribute has a list with all the available ports (the ports areListPortInfoobjects). You don'tneedto use this attribute, but it might come in handy if you want to generate a GUI for your users or something like that.CLIThis module also includes a CLI! It is quite simple, but it might be useful to see ports on your machine. The CLI works as follows:$iic2343--help
usage:iic2343[-h][-v]{ports}...

Commandlineinterfacetoolforiic2343.

positionalarguments:{ports}Actiontobeexecuted.

optionalarguments:-h,--helpshowthishelpmessageandexit-v,--versionshowprogram'sversionnumberandexitThat was the--helpflag. Use it when you're not sure how something works! To see a list of your available ports, run the following command on your terminal:$iic2343ports(0)ttyS0desc:ttyS0(1)ttyUSB0desc:n/a(2)ttyUSB1desc:CP2102USBtoUARTBridgeController3portsfoundYou can also use the--verboseflag to get a bit more information about each port:$iic2343ports--verbose(0)/dev/ttyS0desc:ttyS0hwid:PNP0501(1)/dev/ttyUSB0desc:n/ahwid:PNP0502(2)/dev/ttyUSB1desc:CP2102USBtoUARTBridgeControllerhwid:USBVID:PID=10C4:EA60SER=0001LOCATION=2-1.63portsfoundDevelopingThis library usesPyTestas the test suite runner, andPyLint,Flake8,Black,ISortandMyPyas linters. It also usesPoetryas the default package manager.The library includes aMakefilethat has every command you need to start developing. If you don't have it, installPoetryusing:makeget-poetryThen, create a virtualenv to use throughout the development process, using:makebuild-envActivate the virtualenv using:..venv/bin/activateDeactivate it using:deactivateTo add a new package, usePoetry:poetryadd<new-package>To run the linters, you can use:# The following commands auto-fix the codemakeblack!
makeisort!# The following commands just review the codemakeblack
makeisort
makeflake8
makemypy
makepylintTo run the tests, you can use:maketestsReleasingTo make a new release of the library,git switchto themasterbranch and execute:makebump!minorThe wordminorcan be replaced withpatchormajor, depending on the type of release. Thebump!command will bump the versions of the library, create a new branch, add and commit the changes. Then, justmergethat branch tomaster. Finally, execute amergeto thestablebranch. Make sure to update the version before merging intostable, asPyPiwill reject packages with duplicated versions.