Last active
February 25, 2017 18:16
-
-
Save stestagg/f8a99227e585a1c66ff343aff6f984cd to your computer and use it in GitHub Desktop.
bitflyer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from microbit import i2c, sleep | |
CMD_ON = 175 | |
CMD_OFF = 174 | |
CMD_CHARGE_PUMP_SET = 141 | |
CMD_SET_ROW = 176 | |
CMD_TOP_TO_BOTTOM = 200 | |
CMD_LEFT_TO_RIGHT = 161 | |
CMD_SET_ADDR_MODE = 32 | |
ADDR_MODE_HORIZ = 0b00 | |
CHARGE_PUMP_ON = 20 | |
CMD_BUF = bytearray(1) | |
def command(*cmds): | |
for cmd in cmds: | |
CMD_BUF[0] = cmd | |
i2c.write(60, CMD_BUF, prefix=128) | |
def display_init(): | |
i2c.init(1000000) # frequency (hz) | |
command(CMD_OFF) | |
sleep(10) | |
command(CMD_ON) | |
command(CMD_TOP_TO_BOTTOM, CMD_LEFT_TO_RIGHT) | |
sleep(10) | |
command(CMD_SET_ADDR_MODE, ADDR_MODE_HORIZ) | |
command(0x21, 0, 127) | |
command(CMD_CHARGE_PUMP_SET, CHARGE_PUMP_ON) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment