# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2020—2026, Glasgow Interface Explorer contributors
# This file is distributed under the same license as the Glasgow Interface Explorer package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2026.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Glasgow Interface Explorer \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-07-25 07:37+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: cn\n"
"Language-Team: cn <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.17.0\n"

#: ../../src/use/repl-script.rst:4
msgid "REPL & script operation"
msgstr ""

#: ../../src/use/repl-script.rst:7
msgid "What is \"*REPL*\"?"
msgstr ""

#: ../../src/use/repl-script.rst:9
msgid "If you've ever typed ``python3`` into a terminal, or found yourself looking at the three angle brackets (``>>>``), then you'll have some idea of what we're referring to. It stands for \"`Read Eval Print Loop`\", and is a fundamental way of interacting with many interpreted languages (including Bash and JavaScript, alongside Python)."
msgstr ""

#: ../../src/use/repl-script.rst:11
msgid "By invoking ``glasgow repl ...`` you can gain interactive code-level access to the applet of your choice."
msgstr ""

#: ../../src/use/repl-script.rst:14
msgid "As always, please make sure you select the correct I/O and supply voltage for whatever you have connected to your Glasgow."
msgstr ""

#: ../../src/use/repl-script.rst:26
msgid "What happens now is entirely up to you --- ``glasgow script ...`` is given an identical environment, except that it will run the nominated script rather than present control to you."
msgstr ""

#: ../../src/use/repl-script.rst:28
msgid "The Glasgow framework provides us with access to the ``device`` and ``args`` variables, plus another variable that is named differently depending on the applet being used. For example, the I²C applet calls it ``i2c_iface``."
msgstr ""

#: ../../src/use/repl-script.rst:36
msgid "Some examples are maintained in the `examples <https://github.com/GlasgowEmbedded/glasgow/tree/main/examples>`_ directory."
msgstr ""

#: ../../src/use/repl-script.rst:38
msgid "One further note --- a lot of the Glasgow framework uses ``asyncio``, with the most apparent impact to users being that the ``await`` keyword must be used. You are provided with an async-capable environment, so no additional setup work is required on your part --- just use the ``await`` keyword... if you ever see a ``<coroutine object ....>``, try using ``await``."
msgstr ""

#: ../../src/use/repl-script.rst:42
msgid "How do I use this interface?"
msgstr ""

#: ../../src/use/repl-script.rst:44
msgid "The exact usage will depend heavily on the applet you've requested, some examples are provided below with explanations."
msgstr ""

#: ../../src/use/repl-script.rst:46
msgid "As the startup prompt suggests, investigating ``help(applet_iface)`` and ``help(device)`` are good places to start... after that, have a look at the applet's code."
msgstr ""

#: ../../src/use/repl-script.rst:49
msgid "I²C"
msgstr ""

#: ../../src/use/repl-script.rst:51
msgid "For this example, I will be using the `Sparkfun BMP085 <https://web.archive.org/web/20230206233109/https://www.sparkfun.com/products/retired/9694>`_ (a now-retired breakout for an I²C barometric pressure sensor), which supports 3.3v operation."
msgstr ""

#: ../../src/use/repl-script.rst:54
msgid "I²C busses are implemented using open-drain, meaning that pull-up resistors are `required`... Glasgow's onboard 10kΩ pull-ups are enabled by default --- while they will generally be enough, they may not suffice for fast or long busses. This particular breakout board has on-board pull-ups already, so it's not necessary to use them."
msgstr ""

#: ../../src/use/repl-script.rst:66
msgid "Let's start with a bus scan:"
msgstr ""

#: ../../src/use/repl-script.rst:74
msgid "Address ``119`` has responded, which is ``0x77`` --- and this matches the datasheet!"
msgstr ""

#: ../../src/use/repl-script.rst:76
msgid "This sensor isn't the easiest to operate directly (you need to read a number of calibration variables and perform long calculations), so this is a great example of when you might want to start writing a script instead of using the REPL interface... however, to prove the point, we're going to read a register and leave the rest as an exercise for the reader."
msgstr ""

#: ../../src/use/repl-script.rst:78
msgid "If you're familiar with I²C, you'll know that a common convention is for the target register address to be conveyed as the first portion of a write's payload, with a subsequent read accessing the data from that location, with addresses incrementing automatically. Here we read the ``AC1`` value, which is a 16-bit integer stored at addresses ``0xAA`` and ``0xAB`` --- first by writing the ``0xAA`` base address, and then performing a 2-byte read."
msgstr ""

#: ../../src/use/repl-script.rst:88
msgid "UART"
msgstr ""

#: ../../src/use/repl-script.rst:90
msgid "To demonstrate a simple UART loopback, I've connected pin 0 and 1 of Port A together... i.e: anything that we transmit, will be immediately received again by us."
msgstr ""

#: ../../src/use/repl-script.rst:102
msgid "Again, we simply call the ``uart_iface.write()`` and ``uart_iface.read()`` functions to handle transmit and receive..."
msgstr ""

#: ../../src/use/repl-script.rst:112
msgid "WS2812"
msgstr ""

#: ../../src/use/repl-script.rst:114
msgid "I've got a `quarter of an Adafruit 60 LED ring <https://www.adafruit.com/product/1768>`_... that's 15x WS2812 RGB LEDs."
msgstr ""

#: ../../src/use/repl-script.rst:118
msgid "Due to some buffering artifacts, make sure you write a whole frame at once!"
msgstr ""

#: ../../src/use/repl-script.rst:130
msgid "Next, we just write pixel data! Glasgow handles the pixel format mapping for us, and because we requested ``RGB-xBRG``, the conversion from RGB24 (three bytes per pixel) will be handled in hardware. The ``xBRG`` indicates that we're giving a constand ``0`` for the White channel, followed by the required order of Red, Green, and Blue."
msgstr ""

#: ../../src/use/repl-script.rst:133
msgid "They're bright, so be careful of your eyes (I used ``1`` for a reason)... here's a strip of green pixels:"
msgstr ""

#: ../../src/use/repl-script.rst:140
msgid "A 3-bit rainbow: (black, red, green, yellow, blue, magenta, cyan, white)"
msgstr ""

#: ../../src/use/repl-script.rst:152
msgid "And all off again, followed by a full power-down of the I/O:"
msgstr ""

#: ../../src/use/repl-script.rst:160
msgid "Hopefully this example starts to show you the power you have available."
msgstr ""

#: ../../src/use/repl-script.rst:166
msgid "How do I use a script?"
msgstr ""

#: ../../src/use/repl-script.rst:168
msgid "Scripts operate in exactly the same way as the REPL interface --- the only real difference is that instead of you typing (or copy/pasting) the code, it will be read from the nominated file. This allows you to build up much more sophisticated things, harnessing the power of Glasgow without touching any applet code directly."
msgstr ""

#: ../../src/use/repl-script.rst:171
msgid "See the `PCF8574 <https://github.com/GlasgowEmbedded/glasgow/blob/main/examples/i2c-pcf8574.py>`_ example for a simple demo."
msgstr ""

#: ../../src/use/repl-script.rst:175
msgid "Can I use command line arguments?"
msgstr ""

#: ../../src/use/repl-script.rst:177
msgid "Yes! The ``args`` variable that is passed into the REPL and script environments contains all command line arguments that Glasgow sets up (including any defaults), along with a ``script_args`` member which contains anything after the first terminating ``--``."
msgstr ""

#: ../../src/use/repl-script.rst:179
msgid "Of course you're also able to setup ``argparse`` or do whatever argument parsing you need to do --- see the `script args <https://github.com/GlasgowEmbedded/glasgow/blob/main/examples/script_args.py>`_ example."
msgstr ""

