X-Git-Url: http://nitlanguage.org diff --git a/lib/bcm2835/bcm2835.nit b/lib/bcm2835/bcm2835.nit index a7f9d69..d77d134 100644 --- a/lib/bcm2835/bcm2835.nit +++ b/lib/bcm2835/bcm2835.nit @@ -14,21 +14,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Services to control the bcm2835 chipset as used in the Raspberry Pi -# model B revision 1 Uses the C library by Mike McCauley from -# http://www.airspayce.com/mikem/bcm2835/ +# Services to control the bcm2835 chipset used in the Raspberry Pi +# +# Uses the C library by Mike McCauley available at http://www.airspayce.com/mikem/bcm2835/ +# +# This module targets the model B revision 1, it could be tweaked for other versions. module bcm2835 -import gpio - in "C Header" `{ #include `} -redef class Object - protected fun bcm2835_init: Bool `{ return bcm2835_init(); `} - protected fun bcm2835_close `{ bcm2835_close(); `} - protected fun bcm2835_debug=(v: Bool) `{ bcm2835_set_debug(v); `} +fun bcm2835_init: Bool `{ return bcm2835_init(); `} +fun bcm2835_close `{ bcm2835_close(); `} +fun bcm2835_debug=(v: Bool) `{ bcm2835_set_debug(v); `} + +# A physical binary pin +interface Pin + # Set the output of this pin + fun write(high: Bool) is abstract end extern class RPiPin `{ RPiGPIOPin `} @@ -436,10 +440,10 @@ class HD44780 #write(true, "C0".to_hex) # instead we use the following which may not be portable - for s in [count..40[ do write(false, ' '.ascii) + for s in [count..40[ do write(false, ' '.code_point) count = 0 else - write(false, c.ascii) + write(false, c.code_point) count += 1 end end