New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic implementation for Orange Pi (Allwinner H3 CPU) GPIO component #1956

Closed
wants to merge 2 commits into
base: dev
from

Conversation

Projects
None yet
4 participants
@Toshik
Copy link

Toshik commented May 1, 2016

Description:
Very basic implementation for Orange Pi (Allwinner H3 CPU) GPIO component

Related issue (if applicable): #

Example entry for configuration.yaml (if applicable):

switch:
  platform: opi_gpio
  ports:
    362: Standby Led
    15: Normal Led
  invert_logic: false

Checklist:

If code communicates with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

Toshik added some commits Mar 22, 2016

Orange Pi PC initial support
Very basic implementation for Orange Pi (Allwinner H3 CPU) GPIO component
Update opi_gpio.py
required module update
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP)

REQUIREMENTS = ['git+git://github.com/Toshik/orangepi_PC_gpio_pyH3.git@master#pyA20==0.2.1']

This comment has been minimized.

@balloobbot

balloobbot May 1, 2016

Contributor

farcy v1.1

  • 80: E501 line too long (92 > 79 characters)

This comment has been minimized.

@fabaff

fabaff May 1, 2016

Member

Why are you using your fork instead of the original project?

This comment has been minimized.

@balloob

balloob May 3, 2016

Member

You should also point at the zip file offered by GitHub per commit/branch. You should also point at a specific commit, as the master branch can be updated with breaking changes.

This comment has been minimized.

@Toshik

Toshik May 9, 2016

Original repo messed up pin numbers. Also I have plans to implement interrupts in my fork.

This comment has been minimized.

@fabaff

fabaff May 13, 2016

Member

According to the original's project issue tracker was the mapping error fixed.


def cleanup_gpio(event):
"""Stuff to do before stopping."""
#GPIO.cleanup()

This comment has been minimized.

@balloobbot

balloobbot May 1, 2016

Contributor

farcy v1.1

  • 9: E265 block comment should start with '# '

This comment has been minimized.

@fabaff

fabaff May 1, 2016

Member

This cleanup seems to come from the RPi implementation.

This comment has been minimized.

@Toshik

Toshik May 9, 2016

Yep, it is just copy&paste

return gpio.input(port)


def edge_detect(port, event_callback, bounce):

This comment has been minimized.

@fabaff

fabaff May 1, 2016

Member

Seems like a left-over from RPi.

This comment has been minimized.

@Toshik

Toshik May 9, 2016

I have plans to implement it

def turn_on(self):
"""Turn the device on."""
opi_gpio.write_output(self._port, 0 if self._invert_logic else 1)
self._state = True

This comment has been minimized.

@fabaff

fabaff May 1, 2016

Member

You have read_input. Why not read the port after setting to get the state?

This comment has been minimized.

@Toshik

Toshik May 9, 2016

Just copy&paste from RPi implementation


def prepare_gpio(event):
"""Stuff to do when home assistant starts."""
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, cleanup_gpio)

This comment has been minimized.

@balloob

balloob May 3, 2016

Member

If you're not cleaning up anything, this is not needed either.

This comment has been minimized.

@Toshik

Toshik May 9, 2016

I think it will be important in case of GPIO interrupts will be implemented

@balloob

This comment has been minimized.

Copy link
Member

balloob commented Jun 2, 2016

This PR seems to have gone stale. Closing it. You can reopen it when you're ready to finish it.

@balloob balloob closed this Jun 2, 2016

@Toshik

This comment has been minimized.

Copy link

Toshik commented Aug 21, 2016

Well, what was a problem to merge it?
It was only one working solution...

@balloob

This comment has been minimized.

Copy link
Member

balloob commented Aug 21, 2016

There were a bunch of unaddressed comments and all build checks failed.

@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.