1. 08 Aug, 2014 4 commits
    • Damien George's avatar
      stmhal: Comment out unused functions. · 5b7c0c43
      Damien George authored
      5b7c0c43
    • Damien George's avatar
    • Damien George's avatar
      py: Fix bug where GC finaliser table was not completely zeroed out. · a1d3ee37
      Damien George authored
      This was a nasty bug to track down.  It only had consequences when the
      heap size was just the right size to expose the rounding error in the
      calculation of the finaliser table size.  And, a script had to allocate
      a small (1 or 2 cell) object at the very end of the heap.  And, this
      object must not have a finaliser.  And, the initial state of the heap
      must have been all bits set to 1.  All these conspire on the pyboard,
      but only if your run the script fresh (so unused memory is all 1's),
      and if your script allocates a lot of small objects (eg 2-char strings
      that are not interned).
      a1d3ee37
    • Dave Hylands's avatar
      Add support for selecting pin alternate functions from python. · 6f418fc1
      Dave Hylands authored
      Converts generted pins to use qstrs instead of string pointers.
      
      This patch also adds the following functions:
      pyb.Pin.names()
      pyb.Pin.af_list()
      pyb.Pin.gpio()
      
      dir(pyb.Pin.board) and dir(pyb.Pin.cpu) also produce useful results.
      
      pyb.Pin now takes kw args.
      
      pyb.Pin.__str__ now prints more useful information about the pin
      configuration.
      
      I found the following functions in my boot.py to be useful:
      ```python
      def pins():
          for pin_name in dir(pyb.Pin.board):
              pin = pyb.Pin(pin_name)
              print('{:10s} {:s}'.format(pin_name, str(pin)))
      
      def af():
          for pin_name in dir(pyb.Pin.board):
              pin = pyb.Pin(pin_name)
              print('{:10s} {:s}'.format(pin_name, str(pin.af_list())))
      ```
      6f418fc1
  2. 07 Aug, 2014 1 commit
  3. 06 Aug, 2014 4 commits
  4. 05 Aug, 2014 3 commits
  5. 04 Aug, 2014 5 commits
  6. 03 Aug, 2014 5 commits
  7. 02 Aug, 2014 3 commits
  8. 01 Aug, 2014 2 commits
  9. 31 Jul, 2014 9 commits
    • Damien George's avatar
      stmhal: Change 0:/ and 1:/ to /flash and /sd; add CWD support. · 65dd7bc1
      Damien George authored
      Some important changes to the way the file system is structured on the
      pyboard:
      
      1. 0: and 1: drive names are now replaced with POSIX inspired
      directories, namely /flash and /sd.
      
      2. Filesystem now supports the notion of a current working directory.
      Supports the standard Python way of manipulating it: os.chdir and
      os.getcwd.
      
      3. On boot up, current directory is /flash if no SD inserted, else /sd
      if SD inserted.  Then runs boot.py and main.py from the current dir.
      This is the same as the old behaviour, but is much more consistent and
      flexible (eg you can os.chdir in boot.py to change where main.py is run
      from).
      
      4. sys.path (for import) is now set to '' (current dir), plus /flash
      and /flash/lib, and then /sd and /sd/lib if SD inserted.  This, along
      with CWD, means that import now works properly.  You can import a file
      from the current directory.
      
      5. os.listdir is fixed to return just the basename, not the full path.
      
      See issue #537 for background and discussion.
      65dd7bc1
    • Damien George's avatar
      README: Add USB VID/PID to dfu-util command. · 5aac6aa4
      Damien George authored
      This reflects how it's done in stmhal/Makefile, via deploy.
      5aac6aa4
    • Damien George's avatar
      py: Improve encoding scheme for line-number to bytecode map. · 4747becc
      Damien George authored
      Reduces by about a factor of 10 on average the amount of RAM needed to
      store the line-number to bytecode map in the bytecode prelude.
      
      Using CPython3.4's stdlib for statistics: previously, an average of
      13 bytes were used per (bytecode offset, line-number offset) pair, and
      now with this improvement, that's down to 1.3 bytes on average.
      
      Large RAM usage before was due to some very large steps in line numbers,
      both from the start of the first line in a function way down in the
      file, and also functions that have big comments and/or big strings in
      them (both cases were significant).
      
      Although the savings are large on average for the CPython stdlib, it
      won't have such a big effect for small scripts used in embedded
      programming.
      
      Addresses issue #648.
      4747becc
    • Damien George's avatar
    • Damien George's avatar
      py: Improve handling of long-int overflow. · c9aa58e6
      Damien George authored
      This removes mpz_as_int, since that was a terrible function (it
      implemented saturating conversion).
      
      Use mpz_as_int_checked and mpz_as_uint_checked.  These now work
      correctly (they previously had wrong overflow checking, eg
      print(chr(10000000000000)) on 32-bit machine would incorrectly convert
      this large number to a small int).
      c9aa58e6
    • Damien George's avatar
      py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself. · bb4c6f35
      Damien George authored
      Addresses issue #724.
      bb4c6f35
    • Damien George's avatar
      stmhal, accel: Increase start-up times to 30ms; add extra 30ms delay. · fa1ecda3
      Damien George authored
      For accel to start-up reliably, need to wait 30ms between on/off, and
      30ms for it to enter active mode.  With this fix the accel can be read
      immediately after initialising it.
      
      Addresses issue #763.
      fa1ecda3
    • Damien George's avatar
      stmhal: Add USB_VCP class/object, for direct USB VCP control. · 3c4db9f9
      Damien George authored
      Before, pyb.stdin/pyb.stdout allowed some kind of access to the USB VCP
      device, but it was basic access.
      
      This patch adds a proper USB_VCP class and object with much more control
      over the USB VCP device.  Create an object with pyb.USB_VCP(), then use
      this object as if it were a UART object.  It has send, recv, read,
      write, and other methods.  send and recv allow a timeout to be specified.
      
      Addresses issue 774.
      3c4db9f9
    • Damien George's avatar
      py: Add mp_obj_str_builder_end_with_len. · 5f27a7e8
      Damien George authored
      This allows to create str's with a smaller length than initially asked
      for.
      5f27a7e8
  10. 30 Jul, 2014 1 commit
  11. 29 Jul, 2014 1 commit
  12. 28 Jul, 2014 2 commits