Upgrade to Pro — share decks privately, control downloads, hide ads and more …

First step with Android Things

Avatar for Wesley Lima Wesley Lima
September 07, 2017

First step with Android Things

Avatar for Wesley Lima

Wesley Lima

September 07, 2017

More Decks by Wesley Lima

Other Decks in Technology

Transcript

  1. O que muda? • Display Optional • Status bar e

    Navigation Button — Removido • Permissões • Notificações
  2. • CalendarContract • ContactsContract • DocumentContract • DownloadManager • MediaStore

    • Settings • Telephony • UserDictionary • VoicemailContract O que muda?
  3. • Awareness • Cast • Google Analytics Firebase • FCM

    • Firebase Crash Reporting • Firebase Realtime Database • Firebase Remote Config • Firebase Storage • Fit • Instance ID • Location • Maps • Nearby • Places • Mobile Vision Google Service Com suporte
  4. • AdMod • Android Play • Drive • Firebase App

    Indexing • Firebase Authentication • Firebase Dynamic Link • Firebase Invites • Firebase Notification • Play Games • Sign-in Google Service Sem suporte
  5. Comunicação com mundo externo • GPIO — I/O de propósito

    geral • PWM — Modulação por largura de pulso • Comunicação serial • I2C • SPI • UART
  6. Comunicação com mundo externo • GPIO — I/O de propósito

    geral • PWM — Modulação por largura de pulso • Comunicação serial • I2C • SPI • UART
  7. Comunicação com mundo externo • GPIO — I/O de propósito

    geral • PWM — Modulação por largura de pulso • Comunicação serial • I2C • SPI • UART
  8. Comunicação com mundo externo • GPIO — I/O de propósito

    geral • PWM — Modulação por largura de pulso • Comunicação serial • I2C • SPI • UART
  9. SPI • Sensores • Display • 4 fios e mais

    • Full duplex • Sincrona • Velocidade
  10. Comunicação com mundo externo • GPIO — I/O de propósito

    geral • PWM — Modulação por largura de pulso • Comunicação serial • I2C • SPI • UART
  11. UART • Sensores • Display • GPS • 3 fios

    • Full duplex • Asincrona Things TX RX GND Periférico TX RX GND
  12. Comparação Protocolo Tipo de transferência Fios Periférico Velocidade transferência I2C

    Síncrona 3 Acima de 127 Baixa SPI Síncrona 4 Sem limite Alta UART Assíncrona 2/4 1 Media
  13. Gerenciador • PeripheralManagerService private fun initPwmIO() { gpioPwm = gpioManager.openPwm(PWM_0)

    } override fun setData(lamp: Lamp) { gpioPwm.apply { setEnabled(lamp.on) setPwmFrequencyHz(lamp.frequency.toDouble()) setPwmDutyCycle(lamp.duty.toDouble()) } }
  14. Configurações <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.fioalpha.androidthingmobile"> <application> <uses-library android:name="com.google.android.things"

    /> <activity android:name="MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.MAIN" /> <categoryandroid:name="android.intent.category.IOT_LAUNCHER" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest> Manifesto.xml
  15. Configurações • Gradle do Android Things implementation fileTree(include: ['*.jar'], dir:

    'libs') implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' compileOnly 'com.google.android.things:androidthings:+'