ARM SSG/FM: Cope correctly with NC GPIO

pull/10489/head
Kevin Bracey 2019-04-29 18:08:59 +03:00
parent ad1acf9af7
commit fd68691ce3
3 changed files with 9 additions and 2 deletions

View File

@ -27,11 +27,11 @@ uint32_t gpio_set(PinName pin)
// with the object created for the pin
void gpio_init(gpio_t *obj, PinName pin)
{
obj->pin = pin;
if (pin == NC) {
return;
} else {
int pin_value = 0;
obj->pin = pin;
if (pin <= 15) {
pin_value = pin;
} else if (pin >= 16 && pin <= 31) {

View File

@ -101,6 +101,13 @@ void gpio_init(gpio_t *obj, PinName pin)
{
struct arm_gpio_dev_t *gpio_dev;
if (pin == NC) {
obj->pin_number = NC;
obj->gpio_dev = NULL;
obj->mps2_io_dev = NULL;
return;
}
if (pin >= EXP0 && pin <= EXP51) {
/* GPIO pins */
switch (GPIO_DEV_NUMBER(pin)) {

View File

@ -25,10 +25,10 @@ uint32_t gpio_set(PinName pin) {
// this links the board control bits for each pin
// with the object created for the pin
void gpio_init(gpio_t *obj, PinName pin) {
obj->pin = pin;
if(pin == NC){ return;}
else {
int pin_value = 0;
obj->pin = pin;
if(pin <=15){
pin_value = pin;
}else if (pin >= 16 && pin <= 31){