How to enable GPIO in hassOS home assistant

Is it possible to enable GPIO in hassOS? I want to use odyssey x86j4105 to control SSR modules in home assistant. Tried to add rpi GPIO integration in HACS but it doesn’t work. I have errors like in the photo logs. Can anyone help to be able to use GPIO on haoss?






Someone can help, how to enable GPIO in home assistant hassOS? Is it possible?

Hey,

tell me your Hassio version … GPIO Ports are not supported in Version 2022.06

You have to add rpi_pgio from HACS.

like this

GitHub - thecode/ha-rpi_gpio: Home Assistant Raspberry Pi GPIO Integration

Enable GPIO clock
The GPIO clock can be enabled in the RCC_AHB1ENR Register

As you can see above, the 0th bit of RCC_AHB1ENR Register enables the clock for the GPIOA. That’s why we need to write a 1 in the 0th position

RCC->AHB1ENR |= (1<<0); // Enable the GPIOA clock
2. Set the PIN PA1 as Input
To configure the pin as input, we will modify the GPIOx_MODER Register. This register is responsible for configuring different modes for the GPIO, and in this case we will configure it as the input mode

Since I am using pin PA1, I need to modify the pins 2 and 3. This basically works like, if the PIN is ‘y‘, the we need to configure the bits ‘2y’ and ‘2y+1’
Also, in order to set the pin as input, we need to set the bits (3:2) as 0:0. This means that we need to write a ‘0’ in the 2nd and 3rd positions

GPIOA->MODER &= ~((1<<2) | (1<<3)); // pin PA1(bits 3:2) as input (00)
3. Configure the Pull UP
I am going to configure the pin as the Pull-Up pin. The reason for the same is that the button is connected as shown below

When the button will be pressed, the current from the PA1 will sink into the ground, and the PA1 will go LOW

To configure the Pull UP / Pull DOWN, we need to modify the GPIOx_PUPDR Register

As we need to configure the Pull-UP for the the pin PA1, we need to modify respective bits (3:2). I want to set the Pull-up here, so i need to configure the bits (3:2) as 0:1

GPIOA->PUPDR |= (1<<2); // Pin PA1 (bits 3:2) are 0:1 → PULL-UP
That’s all for the configuration of the GPIO as input pin.

Regards,
Rachel Gomez