1. 16 Aug, 2014 1 commit
  2. 08 Aug, 2014 1 commit
    • 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
  3. 31 Jul, 2014 2 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
      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
  4. 22 Jul, 2014 1 commit
  5. 19 Jul, 2014 1 commit
  6. 12 Jul, 2014 1 commit
  7. 11 Jul, 2014 1 commit
  8. 15 Jun, 2014 1 commit
    • Damien George's avatar
      stmhal: Add Python function to set UART for REPL. · 25479281
      Damien George authored
      This adds a hook to get/set pyb_uart_global_debug from Python, using
      pyb.repl_uart().  You can set it to an arbitrary UART object, and then
      the REPL (in and out) is repeated on this UART object (as well as on USB
      CDC).
      
      Ultimately, this will be replaced with a proper Pythonic interface to
      set sys.stdin and sys.stdout.
      25479281
  9. 14 Jun, 2014 1 commit
  10. 11 Jun, 2014 1 commit
  11. 18 May, 2014 1 commit
  12. 08 May, 2014 1 commit
  13. 03 May, 2014 1 commit
    • Damien George's avatar
      Add license header to (almost) all files. · 04b9147e
      Damien George authored
      Blanket wide to all .c and .h files.  Some files originating from ST are
      difficult to deal with (license wise) so it was left out of those.
      
      Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
      04b9147e
  14. 21 Apr, 2014 6 commits
  15. 20 Apr, 2014 2 commits
  16. 19 Apr, 2014 5 commits
  17. 18 Apr, 2014 4 commits
  18. 16 Apr, 2014 1 commit
  19. 15 Apr, 2014 2 commits
  20. 14 Apr, 2014 1 commit
  21. 10 Apr, 2014 1 commit
    • Damien George's avatar
      stmhal: Add stm module, which contains some constants for the MCU. · 3f489845
      Damien George authored
      Also contains raw memory read/write functions, read8, read16, read32,
      write8, write16, write32.  Can now do:
      
      stm.write16(stm.GPIOA + stm.GPIO_BSRRL, 1 << 13)
      
      This turns on the red LED.
      
      With the new constant folding, the above constants for the GPIO address
      are actually compiled to constants (and the addition done) at compile
      time.  For viper code and inline assembler, this optimisation will make
      a big difference.  In the inline assembler, using these constants would
      not be possible without this constant folding.
      3f489845
  22. 08 Apr, 2014 2 commits
  23. 05 Apr, 2014 1 commit
    • Damien George's avatar
      py: Replace stream_p with *stream_p in mp_obj_type_t. · 27e735fd
      Damien George authored
      This is to reduce ROM usage.  stream_p is used in file and socket types
      only (at the moment), so seems a good idea to make the protocol
      functions a pointer instead of the actual structure.
      
      It saves 308 bytes of ROM in the stmhal/ port, 928 in unix/.
      27e735fd
  24. 03 Apr, 2014 1 commit