drivers: Add "from micropython import const" when const is used.

Following best-practice use of the const feature, to make it compatible
with Python.
This commit is contained in:
Damien George 2016-11-03 12:41:11 +11:00
parent 561844f3ba
commit 7bb0f7b0f6
6 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# MicroPython SSD1306 OLED driver, I2C and SPI interfaces
from micropython import const
import time
import framebuf

View File

@ -1,6 +1,7 @@
"""NRF24L01 driver for Micro Python
"""
from micropython import const
import pyb
# nRF24L01+ registers

View File

@ -21,6 +21,7 @@ Example usage on ESP8266:
"""
from micropython import const
import time

View File

@ -1,6 +1,8 @@
# DS18x20 temperature sensor driver for MicroPython.
# MIT license; Copyright (c) 2016 Damien P. George
from micropython import const
_CONVERT = const(0x44)
_RD_SCRATCH = const(0xbe)
_WR_SCRATCH = const(0x4e)

View File

@ -1,6 +1,7 @@
# 1-Wire driver for MicroPython on ESP8266
# MIT license; Copyright (c) 2016 Damien P. George
from micropython import const
import _onewire as _ow
class OneWireError(Exception):

View File

@ -14,6 +14,7 @@ See:
STM32Cube_FW_F4_V1.1.0/Projects/STM32F4-Discovery/Demonstrations/Src/main.c
"""
from micropython import const
from pyb import Pin
from pyb import SPI