Commit Graph

56 Commits

Author SHA1 Message Date
Jeff Epler d82292fa1f README: Remove a statement that's not particularly true at the moment 2020-06-25 11:44:21 -05:00
Jeff Epler 3c11f6cc05 tests: Remove a test for micropython-specific SPI behavior 2020-06-25 11:44:21 -05:00
Damien George a12d046c42 tests/pyb: Make i2c and pyb1 pyboard tests run again.
For i2c.py: the accelerometer now uses the new I2C driver so need to
explicitly init the legacy i2c object to get the test working.

For pyb1.py: the legacy pyb.hid() call will crash if the USB_HID object is
not initialised.
2018-06-08 13:00:27 +10:00
Damien George db2bdad8a2 tests/pyb: Update tests to run correctly on PYBv1.0.
In adcall.py the pyb module may not be imported, so use ADCAll directly.

In dac.py the DAC object now prints more info, so update .exp file.

In spi.py the SPI should be deinitialised upon exit, so the test can run a
second time correctly.
2018-05-02 15:25:37 +10:00
Damien George d12483d936 tests/pyb: Add test for pyb.ADCAll class. 2018-04-11 17:12:13 +10:00
Damien George b30e0d2f26 stm32/dac: Add buffering argument to constructor and init() method.
This can be used to select the output buffer behaviour of the DAC.  The
default values are chosen to retain backwards compatibility with existing
behaviour.

Thanks to @peterhinch for the initial idea to add this feature.
2018-04-11 14:22:21 +10:00
Peter Hinch 4f40fa5cf4 stm32/adc: Add read_timed_multi() static method, with docs and tests. 2018-04-11 13:36:17 +10:00
Damien George 0096a4bd00 tests/pyb/adc.py: Fix test so that it really does test ADC values.
Reading into a bytearray will truncate values to 0xff so the assertions
checking read_timed() would previously always succeed.

Thanks to @peterhinch for finding this problem and providing the solution.
2018-04-11 13:21:57 +10:00
Damien George 22c693aa6f tests/pyb/can: Update to test pyb.CAN restart, state, info, inplace recv 2018-03-19 15:15:39 +11:00
Damien George 9600a1f207 tests/pyb: Update CAN test to expect that auto_restart is printed. 2018-03-16 18:37:55 +11:00
Paul Sokolovsky 85d809d1f4 tests: Convert remaining "sys.exit()" to "raise SystemExit". 2017-06-10 20:34:38 +03:00
Ville Skyttä ca16c38210 various: Spelling fixes 2017-05-29 11:36:05 +03:00
Damien George d3bb3e38df tests/pyb: Adjust tests so they can run on PYB and PYBLITE.
A few tests still fail on PYBLITE, and that's due to differences in the
available peripheral block numbers on the different MCUs (eg I2C(2)
exists on one, but it's I2C(3) on the other).
2017-02-06 13:50:34 +11:00
Damien George 27c149efe0 stmhal: Add pyb.fault_debug() function, to control hard-fault behaviour.
This new function controls what happens on a hard-fault:
- debugging disabled: board will do a reset
- debugging enabled: board will print registers and stack and flash LEDs

The default is disabled, ie to do a reset.  This is different to previous
behaviour which flashed the LEDs and waited indefinitely.
2017-02-06 13:22:17 +11:00
Damien George 54ea10a76a tests/pyb/uart: Update test to match recent change to UART timeout_char. 2017-01-04 17:53:41 +11:00
Damien George c4e58eaa98 stmhal/i2c: Add option to I2C to enable/disable use of DMA transfers.
New keyword option in constructor and init() method is "dma=<bool>".
DMA is now disabled by default for I2C transfers because it currently does
not handle I2C bus errors very well (eg if slave device doesn't ACK or
NACK correctly during a transfer).
2016-11-11 17:36:19 +11:00
Damien George b236b1974b tests/pyb: Update exp file for previously updated extint test. 2016-09-09 19:37:45 +10:00
Damien George 2f02960607 tests/pyb: Add test for ExtInt when doing swint while disabled. 2016-09-09 19:36:09 +10:00
Damien George 97ce5d1d77 tests/pyb/rtc: Make RTC test on pyboard more reliable by calling init(). 2016-06-03 15:13:39 +01:00
Damien George 5ab98d5c41 stmhal: Convert to use internal errno symbols; enable uerrno module. 2016-05-10 23:30:39 +01:00
Henrik Sölver c4587e2426 stmhal/can: Allow to get existing CAN obj if constructed without args.
Initialisation of CAN objects should now behave as other peripheral
objects.

Fixes issue #2001.
2016-05-08 12:47:33 +01:00
Damien George f7e5e677df tests/pyb: Add simple test for stm module on pyboard. 2016-02-10 17:06:07 +00:00
Damien George ef5f2669dc tests: For pyboard, add test for I2C error handling and recovery. 2016-01-30 00:06:04 +00:00
Damien George 3cfb15cf4d tests: Update pyboard LED test. 2016-01-29 23:12:59 +00:00
Damien George 0d9b450701 stmhal: Make uart.write() function correctly for timeout=0.
In non-blocking mode (timeout=0), uart.write() can now transmit all of its
data without raising an exception.  uart.read() also works correctly in
this mode.

As part of this patch, timout_char now has a minimum value which is long
enough to transfer 1 character.

Addresses issue #1533.
2015-11-30 17:29:52 +00:00
Ryan Shaw f99491cbf7 stmhal: uart.any() function now returns number of bytes available. 2015-11-30 13:07:20 +00:00
Henrik Sölver 35e7d9c0f1 stmhal/can: Fix a bug in filter handling.
Reported here: http://forum.micropython.org/viewtopic.php?f=2&t=845
2015-11-02 23:09:49 +00:00
Peter Hinch 0e87bc7be6 tests: In pyb RTC tests, check wakeup register values. 2015-10-09 23:06:05 +01:00
Damien George 526dd54252 tests: Add test for pyboard SPI in slave mode, recv with no master.
See PR #1414.
2015-08-05 23:47:57 +01:00
Damien George 6d1ff7e966 tests: Add tests to create valid and invalid UART, I2C, SPI, CAN busses. 2015-05-28 11:06:12 +01:00
Dave Hylands a3a14b9db7 lib: Fix some issues in timeutils
In particular, dates prior to Mar 1, 2000 are screwed up.

The easiest way to see this is to do:

>>> import time
>>> time.localtime(0)
(2000, 1, 1, 0, 0, 0, 5, 1)
>>> time.localtime(1)
(2000, 1, 2, 233, 197, 197, 6, 2)

With this patch, we instead get:
>>> import time
>>> time.localtime(1)
(2000, 1, 1, 0, 0, 1, 5, 1)

Doh - In C % is NOT a modulo operator, it's a remainder operator.
2015-05-21 23:31:50 +03:00
blmorris 5df81de7af sthmal/rtc.c: Add calibration() method to get/set RTC fine-tuning value. 2015-05-11 23:48:39 +01:00
Henrik e3cd154317 stmhal: Add support for sending and receiving CAN RTR messages. 2015-04-18 14:53:00 +01:00
Damien George 7d5e34287c stmhal: Allow sending CAN messages with timeout=0.
Thanks to Henrik Sölver for this patch.
2015-04-16 23:52:43 +01:00
Damien George 7a6dbaa89b stmhal: Make LED object print LED(x) for consistency with constructor. 2015-04-11 21:50:53 +01:00
Damien George db80b65402 tests: Make pyb/timer test check callback timing properly. 2015-03-20 23:50:33 +00:00
Damien George ac4f6b804f stmhal: Fix adc.read_timed so buffer store respects element size.
Addresses issue #1154.
2015-03-13 22:11:50 +00:00
Damien George b67253e96f tests: Update pyb/uart.py test since baudrate of 1200 is too low. 2015-02-27 00:40:08 +00:00
Damien George 626ee90ce1 tests: Add more tests for pyb.Timer class. 2015-02-23 13:18:33 +00:00
Henrik Sölver f80f1a7077 stmhal: Add support for CAN rx callbacks. 2015-02-15 03:10:53 +00:00
Damien George baafb290ad stmhal: Add uart.sendbreak() method, to send a break condition. 2015-02-13 19:04:24 +00:00
Damien George 6936f4626c tests: Get misc/print_exception and pyb/spi working on pyboard. 2014-12-18 13:37:56 +00:00
Henrik Sölver acb92c186c Adding CAN filter management 2014-11-26 18:52:33 +00:00
Damien George 224fee0e10 stmhal: Fix HAL error raising; make test for it.
Addresses issue #968.
2014-11-15 20:39:44 +00:00
Damien George efc49c5591 stmhal: Improve CAN print function. 2014-10-30 23:16:05 +00:00
Henrik Sölver 6a15ac80dc tests: Added and adapted CAN tests for extended messages 2014-10-30 23:16:01 +00:00
Damien George 480a7ce58f stmhal: Change SPI phase spec to 0,1 to match standard conventions.
Was 1 or 2, now 0 or 1 (respectively).  0 means sample MISO on first
edge, 1 means sample on second edge.

Addresses issue #936.
2014-10-26 13:54:31 +00:00
Damien George 481d714bd5 stmhal: Overhaul UART class to use read/write, and improve it.
UART object now uses a stream-like interface: read, readall, readline,
readinto, readchar, write, writechar.

Timeouts are configured when the UART object is initialised, using
timeout and timeout_char keyword args.

The object includes optional read buffering, using interrupts.  You can set
the buffer size dynamically using read_buf_len keyword arg.  A size of 0
disables buffering.
2014-10-21 22:15:20 +01:00
Damien George e535a61983 tests: Add simple CAN test. 2014-10-02 17:32:02 +01:00
Damien George fa1a9bc9fd tests: Add test for pyb.disable_irq and pyb.enable_irq. 2014-08-25 18:44:10 +01:00