--- src/lib/avr.py 2012-09-14 11:26:42.000000000 +0200 +++ src/lib/avr.py 2012-08-30 15:55:14.000000000 +0200 @@ -1,7 +1,14 @@ # This file is Copyright 2007 Dean Hall. -# This file is part of the Python-on-a-Chip libraries. -# This software is licensed under the MIT License. -# See the LICENSE file for details. +# +# This file is part of the Python-on-a-Chip program. +# Python-on-a-Chip is free software: you can redistribute it and/or modify +# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1. +# +# Python-on-a-Chip is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 +# is seen in the file COPYING in this directory. ## @file # @copybrief avr @@ -34,6 +41,11 @@ """__NATIVE__ #include #include +void delay_MS(unsigned int n){ + while(n--){ + _delay_ms(1); + } +} /* * Common method for all port register operations @@ -233,11 +245,11 @@ # """ # pass -# def portC(a): -# """__NATIVE__ -# return _portX(&PORTC, &DDRC, &PINC); -# """ -# pass +def portC(a): + """__NATIVE__ + return _portX(&PORTC, &DDRC, &PINC); + """ + pass # def portD(a): # """__NATIVE__ @@ -269,11 +281,11 @@ # """ # pass -# def ddrC(a): -# """__NATIVE__ -# return _ddrX(&DDRC); -# """ -# pass +def ddrC(a): + """__NATIVE__ + return _ddrX(&DDRC); + """ + pass # def ddrD(a): @@ -385,11 +397,11 @@ pPmObj_t pa = NATIVE_GET_LOCAL(0); if (OBJ_GET_TYPE(pa) == OBJ_TYPE_INT) { - _delay_ms((double) ((pPmInt_t)pa)->val); + delay_MS((double) ((pPmInt_t)pa)->val); } else if (OBJ_GET_TYPE(pa) == OBJ_TYPE_FLT) { - _delay_ms((double) ((pPmFloat_t)pa)->val); + delay_MS((double) ((pPmFloat_t)pa)->val); } else {