Skip to content
Snippets Groups Projects
Commit 26d1dc5a authored by beuchatp's avatar beuchatp
Browse files

Fixed the gpio chip and line numbering change in a few places that were missed...

Fixed the gpio chip and line numbering change in a few places that were missed in the previous commit
parent 7a0e379e
Branches
No related tags found
No related merge requests found
Showing
with 34 additions and 34 deletions
......@@ -20,19 +20,19 @@
/>
<param
name = "line_number_for_motor_left_channel_a"
value = "133"
value = "105"
/>
<param
name = "line_number_for_motor_left_channel_b"
value = "134"
value = "106"
/>
<param
name = "line_number_for_motor_right_channel_a"
value = "105"
value = "84"
/>
<param
name = "line_number_for_motor_right_channel_b"
value = "160"
value = "130"
/>
<param
name = "delta_t_for_publishing_counts"
......
......@@ -4,7 +4,7 @@
GPIO_Encoder_Listener::GPIO_Encoder_Listener()
{
struct gpiod_line *line;
strcpy(this->gpio_chip_name, "/dev/gpiochip0");
strcpy(this->gpio_chip_name, "/dev/gpiochip1");
this->gpio_chip = gpiod_chip_open(this->gpio_chip_name);
gpiod_line_bulk_init(&(this->bulk));
for (int i = 0; i < 4; i++)
......
......@@ -17,9 +17,9 @@ private:
// private variables
static const int GPIO_CHIP_NAME_LENGTH_MAX = 20;
static const int LINE_NUMBER_MOTOR_R_CH_A = 105;
static const int LINE_NUMBER_MOTOR_R_CH_B = 160;
static const int LINE_NUMBER_MOTOR_L_CH_A = 133;
static const int LINE_NUMBER_MOTOR_L_CH_B = 134;
static const int LINE_NUMBER_MOTOR_R_CH_B = 106;
static const int LINE_NUMBER_MOTOR_L_CH_A = 84;
static const int LINE_NUMBER_MOTOR_L_CH_B = 130;
const int line_numbers[4] = {
LINE_NUMBER_MOTOR_R_CH_A,
LINE_NUMBER_MOTOR_R_CH_B,
......
......@@ -9,7 +9,7 @@ int main()
// Choose the I2C device.
//const char * i2c_device_name = "/dev/i2c-1";
// ::gpiod::chip chip("gpiochip0");
// ::gpiod::chip chip("gpiochip1");
// auto lines = chip.get_lines({ 161 });
// lines.request({ "foobar", ::gpiod::line_request::EVENT_BOTH_EDGES, 0});
//
......@@ -26,9 +26,9 @@ int main()
// }
// int line_number = 148;
int line_number = 134;
// int line_number = 105;
const char * gpio_chip_name = "/dev/gpiochip0";
int line_number = 105;
// int line_number = 130;
const char * gpio_chip_name = "/dev/gpiochip1";
int num_events_to_display = 20;
......@@ -44,7 +44,7 @@ int main()
printf("event variable initialised as: %d timestamp: [%8ld.%09ld]\n", event.event_type, event.ts.tv_sec, event.ts.tv_nsec);
value = gpiod_ctxless_get_value("/dev/gpiochip0", line_number, false, "foobar");
value = gpiod_ctxless_get_value("/dev/gpiochip1", line_number, false, "foobar");
printf("value = %d\n", value);
......
......@@ -168,14 +168,14 @@ void get_gpiod_line_and_add_to_bulk(struct gpiod_chip *chip, int *line_numbers,
void setup_gpio_listener(struct gpiod_chip **chip,
struct gpiod_line_bulk *line_bulk, struct gpiod_line_event *event)
{
const int line_number_motor_l_ch_a = 133;
const int line_number_motor_l_ch_b = 134;
const int line_number_motor_r_ch_a = 105;
const int line_number_motor_r_ch_b = 160;
const int line_number_motor_l_ch_a = 105;
const int line_number_motor_l_ch_b = 106;
const int line_number_motor_r_ch_a = 84;
const int line_number_motor_r_ch_b = 130;
int line_numbers[4] = {line_number_motor_l_ch_a, line_number_motor_l_ch_b,
line_number_motor_r_ch_a, line_number_motor_r_ch_b};
const char *gpio_chip_name = "/dev/gpiochip0";
const char *gpio_chip_name = "/dev/gpiochip1";
struct gpiod_line *lines[4];
......@@ -226,7 +226,7 @@ void listen_on_gpio(struct gpiod_line_bulk *line_bulk,
gpio_line_event_status_init(event_statuses, 4);
std::map<int, int> line_number_to_index = {
{133, 0}, {134, 1}, {105, 2}, {160, 3}};
{105, 0}, {106, 1}, {84, 2}, {130, 3}};
int line_index;
event_summaries_init(event_summaries);
......@@ -300,7 +300,7 @@ void listen_on_gpio(struct gpiod_line_bulk *line_bulk,
void write_json_test_report(test_config_t *test_config, gpio_line_event_summary_t *event_summaries, gpio_line_event_bulk_log_t **all_events)
{
int line_numbers[4] = {133, 134, 105, 160};
int line_numbers[4] = {105, 106, 84, 130};
std::ofstream logfile;
logfile.open("log/logfile.json");
logfile << "{ ";
......@@ -342,7 +342,7 @@ void write_json_test_report(test_config_t *test_config, gpio_line_event_summary_
void print_test_report(gpio_line_event_summary_t *event_summaries,
gpio_line_event_bulk_log_t **all_events)
{
int line_numbers[4] = {133, 134, 105, 160};
int line_numbers[4] = {105, 106, 84, 130};
for (int i = 0; i < 4; i++)
{
printf(
......
......@@ -151,8 +151,8 @@ void drive_wheels(
void setup_gpio_listener(struct gpiod_chip **chip, struct gpiod_line **line, struct gpiod_line_event *event)
{
const int line_number = 133;
const char * gpio_chip_name = "/dev/gpiochip0";
const int line_number = 105;
const char * gpio_chip_name = "/dev/gpiochip1";
// struct gpiod_line_event event;
// struct gpiod_chip *chip;
......@@ -165,7 +165,7 @@ void setup_gpio_listener(struct gpiod_chip **chip, struct gpiod_line **line, str
event->ts.tv_nsec);
// TODO: substitute ctxless with something else (ctxless is deprecated)
value = gpiod_ctxless_get_value("/dev/gpiochip0", line_number, false, "foobar");
value = gpiod_ctxless_get_value("/dev/gpiochip1", line_number, false, "foobar");
printf("[motor encoder]: value = %d\n", value);
*chip = gpiod_chip_open(gpio_chip_name);
*line = gpiod_chip_get_line(*chip,line_number);
......
......@@ -65,10 +65,10 @@ std::mutex m_counting_mutex;
int m_gpiochip_number = 1;
// > The line numbers to read
int m_line_number_for_motor_left_channel_a = 133;
int m_line_number_for_motor_left_channel_b = 134;
int m_line_number_for_motor_right_channel_a = 105;
int m_line_number_for_motor_right_channel_b = 160;
int m_line_number_for_motor_left_channel_a = 105;
int m_line_number_for_motor_left_channel_b = 106;
int m_line_number_for_motor_right_channel_a = 84;
int m_line_number_for_motor_right_channel_b = 130;
// > Boolean flag for when to stop counting
bool encoder_thread_should_count = true;
......@@ -169,7 +169,7 @@ void encoderCountingThreadMain()
{
// Specify the chip name of the GPIO interface
// > Note: for the 40-pin header of the Jetson SBCs, this
// is "/dev/gpiochip0"
// is "/dev/gpiochip1"
std::stringstream temp_string_stream;
temp_string_stream << "/dev/gpiochip" << m_gpiochip_number;
const char * gpio_chip_name = temp_string_stream.str().c_str();
......@@ -325,7 +325,7 @@ int main(int argc, char* argv[])
// the "launch" folder, you see the following lines of code:
// <param
// name = "line_number_for_motor_left_channel_a"
// value = 133
// value = 105
// />
// > These lines of code add a parameter named to this node
// with the parameter name: "line_number_for_motor_left_channel_a"
......
......@@ -56,8 +56,8 @@ int main(int argc, char* argv[])
// Specify the chip name of the GPIO interface
// > Note: for the 40-pin header of the Jetson SBCs, this
// is "/dev/gpiochip0"
const char * gpio_chip_name = "/dev/gpiochip0";
// is "/dev/gpiochip1"
const char * gpio_chip_name = "/dev/gpiochip1";
// Get the GPIO line number to monitor
// Notes:
......
......@@ -65,8 +65,8 @@ int main(int argc, char* argv[])
// Specify the chip name of the GPIO interface
// > Note: for the 40-pin header of the Jetson SBCs, this
// is "/dev/gpiochip0"
const char * gpio_chip_name = "/dev/gpiochip0";
// is "/dev/gpiochip1"
const char * gpio_chip_name = "/dev/gpiochip1";
// Get the GPIO line number to monitor
// Notes:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment