aboutsummaryrefslogtreecommitdiff
path: root/ports/esp8266/modmachine.c
AgeCommit message (Collapse)Author
2020-10-01ports: Add SoftI2C and SoftSPI to machine module where appropriate.Damien George
Previous commits removed the ability for one I2C/SPI constructor to construct both software- or hardware-based peripheral instances. Such construction is now split to explicit soft and non-soft types. This commit makes both types available in all ports that previously could create both software and hardware peripherals: machine.I2C and machine.SPI construct hardware instances, while machine.SoftI2C and machine.SoftSPI create software instances. This is a breaking change for use of software-based I2C and SPI. Code that constructed I2C/SPI peripherals in the following way will need to be changed: machine.I2C(-1, ...) -> machine.SoftI2C(...) machine.I2C(scl=scl, sda=sda) -> machine.SoftI2C(scl=scl, sda=sda) machine.SPI(-1, ...) -> machine.SoftSPI(...) machine.SPI(sck=sck, mosi=mosi, miso=miso) -> machine.SoftSPI(sck=sck, mosi=mosi, miso=miso) Code which uses machine.I2C and machine.SPI classes to access hardware peripherals does not need to change. Signed-off-by: Damien George <damien@micropython.org>
2020-10-01extmod/machine_i2c: Rename type to SoftI2C and add custom print method.Damien George
Also rename machine_i2c_type to mp_machine_soft_i2c_type. These changes make it clear that it's a soft-I2C implementation, and match SoftSPI. Signed-off-by: Damien George <damien@micropython.org>
2020-09-18all: Rename absolute time-based functions to include "epoch".Damien George
For time-based functions that work with absolute time there is the need for an Epoch, to set the zero-point at which the absolute time starts counting. Such functions include time.time() and filesystem stat return values. And different ports may use a different Epoch. To make it clearer what functions use the Epoch (whatever it may be), and make the ports more consistent with their use of the Epoch, this commit renames all Epoch related functions to include the word "epoch" in their name (and remove references to "2000"). Along with this rename, the following things have changed: - mp_hal_time_ns() is now specified to return the number of nanoseconds since the Epoch, rather than since 1970 (but since this is an internal function it doesn't change anything for the user). - littlefs timestamps on the esp8266 have been fixed (they were previously off by 30 years in nanoseconds). Otherwise, there is no functional change made by this commit. Signed-off-by: Damien George <damien@micropython.org>
2020-04-23all: Format code to add space after C++-style comment start.stijn
Note: the uncrustify configuration is explicitly set to 'add' instead of 'force' in order not to alter the comments which use extra spaces after // as a means of indenting text for clarity.
2020-04-05all: Use MP_ERROR_TEXT for all error messages.Jim Mussared
2020-03-20esp8266/modmachine: Implement machine.soft_reset().Damien George
Fixes issue #5764.
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2019-09-04esp8266/machine_adc: Rename pyb_adc_* to machine_adc_*.Damien George
2019-07-01esp8266: Provide custom machine_time_pulse_us that feeds soft WDT.Damien George
So that the timeout for machine.time_pulse_us() can be large. Fixes issue #2775.
2019-05-10esp8266/modmachine: Handle overflow of timer to get longer periods.Damien George
Can now handle up to about 298 days maximum for millisecond periods. Fixes issue #4664.
2019-02-28esp8266/modmachine: Call ets_event_poll after waiti in machine.idle.Damien George
Because "waiti 0" may have waited for a while (eg 500ms) and the internal WDT may need to be fed immediately. Fixes issue #4459.
2019-01-31esp8266/modmachine: In lightsleep, only waiti if wifi is turned off.Damien George
Otherwise the STA interface can't do DTIM sleeping correctly and power consumption goes up.
2019-01-30esp8266/modmachine: Implement simple machine.lightsleep function.Damien George
Use of "waiti 0" reduces power consumption by about 3mA compared to a time.sleep_ms call.
2019-01-30esp8266/modmachine: Rename machine.sleep to machine.lightsleep.Damien George
While keeping machine.sleep as an alias for machine.lightsleep for backwards compatibility.
2019-01-30esp8266/modmachine: Implement optional time_ms arg to machine.deepsleep.Damien George
2018-07-17esp8266,esp32: Implement high-res timers using new tick_hz argument.Nicko van Someren
machine.Timer now takes a new argument in its constructor (or init method): tick_hz which specified the units for the period argument. The period of the timer in seconds is: period/tick_hz. For backwards compatibility tick_hz defaults to 1000. If the user wants to specify the period (numerator) in microseconds then tick_hz can be set to 1000000. The user can also specify a period of an arbitrary number of cycles of an arbitrary frequency using these two arguments. An additional freq argument has been added to allow frequencies to be specified directly in Hertz. This supports floating point values when available.
2018-05-17esp8266/modmachine: Allow I2C and SPI to be configured out of the build.Damien George
I2C costs about 3000 bytes of code, and SPI costs about 4400 bytes.
2017-09-06ports: Make new ports/ sub-directory and move all ports there.Damien George
This is to keep the top-level directory clean, to make it clear what is core and what is a port, and to allow the repository to grow with new ports in a sustainable way.