Where is actual library source?
Posted: Wed Feb 17, 2021 10:21 pm
I am new to MicroPython and been looking through docs, books and the forum for days to the answer to these questions.
1. Is the pyb library only to be used for the Pyboard? What if I have a custom STM32 project as I am planning? Should I then be using the machine library instead? My pinout will likely not be like the Pyboard.
2. Where is the source code for the machine library, for instance, the Pin class, or the Adc class? I see that there are different/more functions for the ADC in the pyb library (like filtering) than there are in the machine.ADC library. Perhaps I can add those missing functions to the machine library, but how? I would like to be able to examine the source files for these functions to see how they differ. I see machine_spi.c and etc. in the extmod library, but no such files for machine.Pin or machine.ADC classes. What am I missing? In general, how do I find the source behind any MicroPython class? How can I be sure that I have located the appropriate library code?
3. The pinout for the Pyboard shows a slave select pin for SPI but the library doesn't seem to have a hardware-controlled option. Why would it designate a slave select in the diagram if you could just use any pin and control it via software? I think that the STM32 should support a hardware-controlled slave select. Can it be enabled in MicroPython?
Thanks.
1. Is the pyb library only to be used for the Pyboard? What if I have a custom STM32 project as I am planning? Should I then be using the machine library instead? My pinout will likely not be like the Pyboard.
2. Where is the source code for the machine library, for instance, the Pin class, or the Adc class? I see that there are different/more functions for the ADC in the pyb library (like filtering) than there are in the machine.ADC library. Perhaps I can add those missing functions to the machine library, but how? I would like to be able to examine the source files for these functions to see how they differ. I see machine_spi.c and etc. in the extmod library, but no such files for machine.Pin or machine.ADC classes. What am I missing? In general, how do I find the source behind any MicroPython class? How can I be sure that I have located the appropriate library code?
3. The pinout for the Pyboard shows a slave select pin for SPI but the library doesn't seem to have a hardware-controlled option. Why would it designate a slave select in the diagram if you could just use any pin and control it via software? I think that the STM32 should support a hardware-controlled slave select. Can it be enabled in MicroPython?
Thanks.