sprhawk / python-on-a-chip

Automatically exported from code.google.com/p/python-on-a-chip
Other
0 stars 0 forks source link

Add Angus Gratton's AVR extra functions #126

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On 2010/06/28, from Angus Gratton on the maillist:

3) avr_extra_functions.patch

I extended the existing avr.py with some new functions. There are now 
Arduino-style avr.digitalRead(PORT, PIN) and avr.digitalWrite(PORT, PIN, value) 
methods to read/write single pins.

Also, new avr.ddrA(VAL) to set DDRA register and avr.PORTA() now works 
correctly for reading pin values as well as writing them (I could only get 
writes to work with the old module.)

There are also avr.ddrX and avr.portX functions for all of the other ports 
(B-F) but they are commented out in the Python source because all of those 
extra functions use a bunch of RAM when the module imports - so for now you 
need to comment them in if you want to use each one.

Original issue reported on code.google.com by dwhall...@gmail.com on 10 Aug 2010 at 1:20

GoogleCodeExporter commented 9 years ago
Attached Angus Gratton's patch from the email

Original comment by dwhall...@gmail.com on 10 Aug 2010 at 1:23

Attachments:

GoogleCodeExporter commented 9 years ago
r570
- Applied the patch
- Renamed sleepMs() to delay() because MCU was not put in sleep mode
- Rewrote platform/avr/main.py to be more python-like
- Wrapped PINC ... PINF with #ifdefs because not all MCUs have those ports 
(would result in compile error).

Builds w/o error.  Too lazy to test on device.
Mainlined directly

Original comment by dwhall...@gmail.com on 11 Aug 2010 at 7:05