Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Restructure micropython libs and adding print statements to functions in the microbit library that we will not implement in the simulator - #257

Merged
Vandy Liu (vandyliu) merged 17 commits into
devfrom
users/t-vali/unsupported-python-modules
Mar 16, 2020
Merged

Vandy Liu (vandyliu) merged 17 commits into
devfrom
users/t-vali/unsupported-python-modules

Conversation

@vandyliu

@vandyliu Vandy Liu (vandyliu) commented Mar 9, 2020 •

Copy link
Copy Markdown
Contributor

PLEASE TEST IT OUT

Description:

AB#34028

  • Reorganized all micropython libraries under src/micropython
  • Adding print statements to functions in the microbit library that we will not implement in the simulator
  • In Express.py (for CPX)
  • In compass.py, i2c.py, spi.py and microbit_model.py (for microbit)
  • In audio, radio, music, speech, neopixel, utime
  • print statement looks like: {function_name} on line {line_number} in {user_file_name} is not implemented in the simulator but it will work on the actual device!

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Limitations:

Please describe limitations of this PR

Testing:

Tested in the simulator with:

from microbit import *

spi.init()
spi.read(2)
spi.write(2)
spi.write_readinto(1, 2)
reset()
panic(23)
i2c.init()
i2c.read(2, 3)
i2c.write(2, 3)
i2c.scan()
compass.calibrate()
compass.clear_calibration()
compass.get_field_strength()
compass.get_x()
compass.get_y()
compass.get_z()
compass.heading()
compass.is_calibrated()
import microbit

microbit.spi.init()
microbit.spi.read(2)
microbit.spi.write(2)
microbit.spi.write_readinto(1, 2)
microbit.reset()
microbit.panic(23)
microbit.i2c.init()
microbit.i2c.read(2, 3)
microbit.i2c.write(2, 3)
microbit.i2c.scan()
microbit.compass.calibrate()
microbit.compass.clear_calibration()
microbit.compass.get_field_strength()
microbit.compass.get_x()
microbit.compass.get_y()
microbit.compass.get_z()
microbit.compass.heading()
microbit.compass.is_calibrated()
from adafruit_circuitplayground import cp

cp.play_tone(2, 2)
cp.start_tone(2)
cp.stop_tone()
cp.adjust_touch_threshold(3)
cp.tapped()
import audio
audio.play("a")
audio.AudioFrame()

import music
music.set_tempo()
music.get_tempo()
music.play("a")
music.pitch("a")
music.stop()

import neopixel
n = neopixel.NeoPixel("a", "1")
n.clear()
n.show()

import radio
radio.on()
radio.off()
radio.config()
radio.reset()
radio.send_bytes("S")
radio.receive_bytes()
radio.receive_bytes_into("a")
radio.send("?")
radio.receive()
radio.receive_full()

import speech
speech.translate("A")
speech.pronounce("asa")
speech.say("a")
speech.sing("a")

import utime
utime.ticks_ms()
utime.ticks_us()
utime.ticks_add(1, 1)
utime.ticks_diff(1,1)
  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • My code has been formatted with npm run format and passes the checks in npm run check
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@andreamah Andrea Mah (andreamah) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! Awesome 😁

@vandyliu Vandy Liu (vandyliu) changed the title Adding print statements to functions in the microbit library that we will not implement in the simulator WIP Adding print statements to functions in the microbit library that we will not implement in the simulator Mar 10, 2020
Comment thread src/adafruit_circuitplayground/express.py
Comment thread src/adafruit_circuitplayground/express.py
@vandyliu Vandy Liu (vandyliu) changed the title WIP Adding print statements to functions in the microbit library that we will not implement in the simulator ;WIP Adding print statements to functions in the microbit library that we will not implement in the simulator Mar 13, 2020
@vandyliu Vandy Liu (vandyliu) changed the title ;WIP Adding print statements to functions in the microbit library that we will not implement in the simulator WIP: Adding print statements to functions in the microbit library that we will not implement in the simulator Mar 13, 2020
@vandyliu Vandy Liu (vandyliu) changed the title WIP: Adding print statements to functions in the microbit library that we will not implement in the simulator Restructure micropython libs and adding print statements to functions in the microbit library that we will not implement in the simulator Mar 13, 2020

@andreamah Andrea Mah (andreamah) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(❁´◡`❁) good to go!!

@vandyliu
Vandy Liu (vandyliu) merged commit 2318618 into dev Mar 16, 2020
@vandyliu
Vandy Liu (vandyliu) deleted the users/t-vali/unsupported-python-modules branch March 16, 2020 22:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants