From d6780cf49e9f4c28edcb458359dd72cefad8d697 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 2 Oct 2020 14:36:35 -0500 Subject: User generic MTAC pin names for LoRa --- mtac_lora.c | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/mtac_lora.c b/mtac_lora.c index fbedd7b..665bbf6 100644 --- a/mtac_lora.c +++ b/mtac_lora.c @@ -1,4 +1,4 @@ -#define DRIVER_VERSION "v1.1.4" +#define DRIVER_VERSION "v1.1.5" #define DRIVER_AUTHOR "John Klug " #define DRIVER_DESC "MTS LoRa Accessory Card" #define DRIVER_NAME "mtac-lora" @@ -6,6 +6,12 @@ #include #include +#ifdef TI43X +#include +#endif +#ifdef SAM9G25 +#include +#endif #include #include #include @@ -14,12 +20,13 @@ #include #include -static struct gpio_pin gpio_pins_mtcdt_mtac_lora_0_0[] = { + +static struct gpio_pin gpio_pins_mtac_lora_0_0[] = { // gpio pins for Accessory Card 1 { .name = "AP1_RESET", .pin = { - .gpio = AT91_PIN_PB12, + .gpio = M_AP1_NRESET, .flags = GPIOF_OUT_INIT_HIGH, .label = "ap1-reset", } @@ -29,7 +36,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_0_0[] = { { .name = "AP2_RESET", .pin = { - .gpio = AT91_PIN_PB13, + .gpio = M_AP2_NRESET, .flags = GPIOF_OUT_INIT_HIGH, .label = "ap2-reset", } @@ -37,12 +44,12 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_0_0[] = { { }, }; -static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = { +static struct gpio_pin gpio_pins_mtac_lora_1_5[] = { // gpio pins for Accessory Card 1 { .name = "AP1_RESET", .pin = { - .gpio = AT91_PIN_PB12, + .gpio = M_AP1_NRESET, .flags = GPIOF_OUT_INIT_HIGH, .label = "ap1-reset", } @@ -50,7 +57,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = { { .name = "AP1_CDONE", .pin = { - .gpio = AT91_PIN_PC6, + .gpio = M_AP1_GPIO1, .flags = GPIOF_IN, .label = "ap1-cdone", }, @@ -58,7 +65,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = { { .name = "AP1_CRESET", .pin = { - .gpio = AT91_PIN_PC7, + .gpio = M_AP1_GPIO4, .flags = GPIOF_OUT_INIT_HIGH, .label = "ap1-creset", } @@ -68,7 +75,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = { { .name = "AP2_RESET", .pin = { - .gpio = AT91_PIN_PB13, + .gpio = M_AP2_NRESET, .flags = GPIOF_OUT_INIT_HIGH, .label = "ap2-reset", } @@ -76,7 +83,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = { { .name = "AP2_CDONE", .pin = { - .gpio = AT91_PIN_PC20, + .gpio = M_AP2_GPIO1, .flags = GPIOF_IN, .label = "ap2-cdone", }, @@ -84,7 +91,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = { { .name = "AP2_CRESET", .pin = { - .gpio = AT91_PIN_PC21, + .gpio = M_AP2_GPIO2, .flags = GPIOF_OUT_INIT_HIGH, .label = "ap2-creset", } @@ -92,12 +99,12 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_1_5[] = { { }, }; -static struct gpio_pin gpio_pins_mtcdt_mtac_lora_2g4_0_0[] = { +static struct gpio_pin gpio_pins_mtac_lora_2g4_0_0[] = { // gpio pins for Accessory Card 1 { .name = "AP1_RESET", .pin = { - .gpio = AT91_PIN_PB12, + .gpio = M_AP1_NRESET, .flags = GPIOF_OUT_INIT_HIGH, .label = "ap1-reset", } @@ -105,7 +112,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_2g4_0_0[] = { { .name = "AP1_BOOT", .pin = { - .gpio = AT91_PIN_PC6, + .gpio = M_AP1_GPIO1, .flags = GPIOF_OUT_INIT_LOW, .label = "ap1-boot", }, @@ -115,7 +122,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_2g4_0_0[] = { { .name = "AP2_RESET", .pin = { - .gpio = AT91_PIN_PB13, + .gpio = M_AP2_NRESET, .flags = GPIOF_OUT_INIT_HIGH, .label = "ap2-reset", } @@ -123,7 +130,7 @@ static struct gpio_pin gpio_pins_mtcdt_mtac_lora_2g4_0_0[] = { { .name = "AP2_BOOT", .pin = { - .gpio = AT91_PIN_PC20, + .gpio = M_AP2_GPIO1, .flags = GPIOF_OUT_INIT_LOW, .label = "ap2-boot", }, @@ -283,13 +290,13 @@ static bool lora_setup(enum ap port) { if ((lora_hw_version == MTAC_LORA_0_0) || (lora_hw_version == MTAC_LORA_1_0)) { ap_lora_attrs_size = ATTRS_SIZE_0_0; - mtac_set_port_pins(port_index,gpio_pins_mtcdt_mtac_lora_0_0,subdir); + mtac_set_port_pins(port_index,gpio_pins_mtac_lora_0_0,subdir); } else if ((lora_hw_version == MTAC_LORA_2G4_0_0) || (lora_hw_version == MTAC_LORA_2G4_0_0)) { ap_lora_attrs_size = ATTRS_SIZE_2G4_0_0; - mtac_set_port_pins(port_index,gpio_pins_mtcdt_mtac_lora_2g4_0_0,subdir); + mtac_set_port_pins(port_index,gpio_pins_mtac_lora_2g4_0_0,subdir); } else { ap_lora_attrs_size = ATTRS_SIZE_1_5; - mtac_set_port_pins(port_index,gpio_pins_mtcdt_mtac_lora_1_5,subdir); + mtac_set_port_pins(port_index,gpio_pins_mtac_lora_1_5,subdir); } -- cgit v1.2.3