Skip to content

Build unknown mraa platform #21

Open
@kleysoncastro

Description

When the lib mraa is installed with apt it receives this MRAA version (v2.1.0-22-gb24cd50) on the Radxa ROCK Pi S.

  • When done using buildroot, the version looks like this. Version 2022.02.1 on Unknown platform

code

#include <iostream>
#include <mraa.hpp>

int main() {
    // Inicializar o barramento I2C
    mraa::I2c i2c(0);  // O número 0 refere-se ao barramento I2C 0

    // Verificar se o barramento I2C foi inicializado corretamente
    if (!i2c.address(0x0A)) {
        std::cerr << "Erro ao inicializar o barramento I2C" << std::endl;
        return 1;
    }

    // Ler um byte do dispositivo no endereço 0x0A
    uint8_t dataRead;
    if (i2c.read(&dataRead, 1) != mraa::SUCCESS) {
        std::cerr << "Erro ao ler do dispositivo I2C" << std::endl;
        return 1;
    }

    std::cout << "Valor lido: " << static_cast<int>(dataRead) << std::endl;

    return 0;
}
  • The code above runs normally in the debian version, in the version with buildroot I have this error
# ./i2c-list 
terminate called after throwing an instance of 'std::invalid_argument'
  what():  Invalid i2c bus
Aborted

Using, it ok

# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- 0a -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

I don't know if it's appropriate to open an issue here, but I would like to compile this mraa lib to run on my image. can you help me ?

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions