Пример #1
0
import nes, lcd
from fpioa_manager import *

# AUDIO_PA_EN_PIN = None  # Bit Dock and old MaixGo
AUDIO_PA_EN_PIN = 32  # Maix Go(version 2.20)
# AUDIO_PA_EN_PIN = 2     # Maixduino

# open audio PA
if AUDIO_PA_EN_PIN:
    fm.register(AUDIO_PA_EN_PIN, fm.fpioa.GPIO1)
    wifi_en = GPIO(GPIO.GPIO1, GPIO.OUT)
    wifi_en.value(1)

fm.register(19, fm.fpioa.GPIOHS0)
fm.register(18, fm.fpioa.GPIOHS1)
fm.register(21, fm.fpioa.GPIOHS2)
fm.register(20, fm.fpioa.GPIOHS3)

lcd.init(freq=15000000)
nes.init(1,
         cs=fm.fpioa.GPIOHS0,
         clk=fm.fpioa.GPIOHS1,
         mosi=fm.fpioa.GPIOHS2,
         miso=fm.fpioa.GPIOHS3)
nes.run("/sd/mario.nes")
Пример #2
0
import nes

nes.init(nes.KEYBOARD)
nes.run("/sd/mario.nes")

Пример #3
0
fm.register(34, fm.fpioa.I2S0_OUT_D1, force=True)
fm.register(35, fm.fpioa.I2S0_SCLK, force=True)
fm.register(33, fm.fpioa.I2S0_WS, force=True)

lcd.init(freq=15000000)
lcd.register(0x36, 0x68)

if __name__ == "__main__":

    # B A SEL START UP DOWN LEFT RIGHT
    # 1 2 4   8     16  32   64   128
    state = 0

    try:
        nes.init(nes.INPUT)
        nes.load("mario.nes")
        for i in range(20000):
            nes.loop()
        for i in range(2000):
            nes.loop()
            nes.input(8, 0, 0)
            nes.loop()
            nes.input(0, 0, 0)
        nes.loop()
        nes.input(8, 0, 0)
        nes.loop()
        nes.input(0, 0, 0)
        while True:
            #print(time.ticks_ms())
            nes.loop()