Tags:
create new tag
view all tags

The ttgo module

The ttgo module is again a pure MicroPython module used to initialize the t-watch hardware. It contains two classes:

  • Watch
  • Motor
  • and Display
The Watch class has the following methods:
  • Watch(fastboot=False): creates a Watch object. This method initializes:
    • the I2C port 0 bus
    • the axp202 power management module
    • the display
    • and touch screen hardware
  • __init_prep__() initializes:
    • Motor class
    • the PCF8563 real time clock
    • and the BMA423 triaxial acceleration sensor.
  • __init_touch__() initializes the FT6236U touch panel controller. This method is called when the Watch object is created
  • __display__() initializes the st7789 display controller
  • pmu_attach_interrupt(callback): attaches a callback routine to pmu (power management unit) interrupts
  • rtc_attach_interrupt(callback): attaches a callback routine to the bma423 interrupt
  • enable_audio_power(en=True): enables of disables power to the sound system
  • lvgl_begin(): initializes the LVGL graphical user interface library and registers the st7789 display driver and the ft6x36 touch panel driver with LVGL
  • init_power(): initializes the pmu system
  • power_off(): switch watch power off
After creating a Watch object :
import ttgo
watch = ttgo.Watch()

you can access the initialized driver objects with:

  • watch.__i2c__
  • watch.touch
  • watch.tft
  • watch.motor
  • watch.rtc
  • watch.pmu
  • watch.bma
The Display class has these methods:
  • Display(pmu):
    • creates a st7789_lvgl object
    • initializes the back light GPIO pin
    • turns the display back light off
  • backlight_fade(val=100): fade the back light level to val
  • switch_scene():
  • set_backlight_level(percent): set the back light level
  • __turn_lcd_backlight__(val): turn back light on or off)
  • __set_lcd_backlight_voltage(voltage=3200): set the voltage to a level between 2.4V and 3.2 V
The Motor class:
  • Motor(): create a Motor object. Create a PWM pin on GPIO 4 to control the vibration motor power
  • on(): switch the buzzer and vibration motor on
  • off(): switch it off
  • set_strength(strength): set the strength of the vibration/buzzer signal
  • set_freq(freq): set the PWM frequency

-- Uli Raich - 2021-01-28

Comments

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2021-01-29 - UliRaich
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback