@@ -15,17 +15,16 @@
|
||||
#include "common.h"
|
||||
|
||||
#define DT_BASE "/proc/device-tree"
|
||||
/*
|
||||
/*
|
||||
* "Radxa ROCK Pi 4" is the model name on stock 5.x kernels
|
||||
* "ROCK PI 4A", "ROCK PI 4B" is used on Radxa 4.4 kernel
|
||||
* "ROCK PI 4A", "ROCK PI 4B" and "ROCK PI 4C" is used on Radxa 4.4 kernel
|
||||
* so we search for the string below by ignoring case
|
||||
*/
|
||||
#define PLATFORM_NAME_ROCK_PI_4 "ROCK Pi 4"
|
||||
#define PLATFORM_NAME_ROCK_PI_4A "ROCK PI 4A"
|
||||
#define PLATFORM_NAME_ROCK_PI_4B "ROCK PI 4B"
|
||||
#define PLATFORM_NAME_ROCK_PI4 "ROCK Pi 4"
|
||||
#define PLATFORM_NAME_ROCK_PI4_2 "ROCK PI 4"
|
||||
#define MAX_SIZE 64
|
||||
|
||||
const char* rockpi4_serialdev[MRAA_ROCKPI4_UART_COUNT] = { "/dev/ttyS2","/dev/ttyS4"};
|
||||
const char* rockpi4_serialdev[MRAA_ROCKPI4_UART_COUNT] = { "/dev/ttyS2", "/dev/ttyS4" };
|
||||
|
||||
void
|
||||
mraa_rockpi4_pininfo(mraa_board_t* board, int index, int sysfs_pin, mraa_pincapabilities_t pincapabilities_t, char* fmt, ...)
|
||||
@@ -39,9 +38,9 @@ mraa_rockpi4_pininfo(mraa_board_t* board, int index, int sysfs_pin, mraa_pincapa
|
||||
vsnprintf(pininfo->name, MRAA_PIN_NAME_SIZE, fmt, arg_ptr);
|
||||
|
||||
if( pincapabilities_t.gpio == 1 ) {
|
||||
va_arg(arg_ptr, int);
|
||||
pininfo->gpio.gpio_chip = va_arg(arg_ptr, int);
|
||||
pininfo->gpio.gpio_line = va_arg(arg_ptr, int);
|
||||
va_arg(arg_ptr, int);
|
||||
pininfo->gpio.gpio_chip = va_arg(arg_ptr, int);
|
||||
pininfo->gpio.gpio_line = va_arg(arg_ptr, int);
|
||||
}
|
||||
|
||||
pininfo->capabilities = pincapabilities_t;
|
||||
@@ -71,11 +70,10 @@ mraa_rockpi4()
|
||||
|
||||
if (mraa_file_exist(DT_BASE "/model")) {
|
||||
// We are on a modern kernel, great!!!!
|
||||
if (mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4) ||
|
||||
mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4A) ||
|
||||
mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4B)
|
||||
if (mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI4) ||
|
||||
mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI4_2)
|
||||
) {
|
||||
b->platform_name = PLATFORM_NAME_ROCK_PI_4;
|
||||
b->platform_name = PLATFORM_NAME_ROCK_PI4;
|
||||
b->uart_dev[0].device_path = (char*) rockpi4_serialdev[0];
|
||||
b->uart_dev[1].device_path = (char*) rockpi4_serialdev[1];
|
||||
}
|
||||
@@ -88,7 +86,7 @@ mraa_rockpi4()
|
||||
b->uart_dev[1].index = 4;
|
||||
|
||||
// I2C
|
||||
if (strncmp(b->platform_name, PLATFORM_NAME_ROCK_PI_4, MAX_SIZE) == 0) {
|
||||
if (strncmp(b->platform_name, PLATFORM_NAME_ROCK_PI4, MAX_SIZE) == 0) {
|
||||
b->i2c_bus_count = MRAA_ROCKPI4_I2C_COUNT;
|
||||
b->def_i2c_bus = 0;
|
||||
b->i2c_bus[0].bus_id = 7;
|
||||
|
||||
Reference in New Issue
Block a user