mirror of https://github.com/ARMmbed/mbed-os.git
ARM SSG/FM: Cope correctly with NC GPIO
parent
ad1acf9af7
commit
fd68691ce3
|
|
@ -27,11 +27,11 @@ uint32_t gpio_set(PinName pin)
|
||||||
// with the object created for the pin
|
// with the object created for the pin
|
||||||
void gpio_init(gpio_t *obj, PinName pin)
|
void gpio_init(gpio_t *obj, PinName pin)
|
||||||
{
|
{
|
||||||
|
obj->pin = pin;
|
||||||
if (pin == NC) {
|
if (pin == NC) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
int pin_value = 0;
|
int pin_value = 0;
|
||||||
obj->pin = pin;
|
|
||||||
if (pin <= 15) {
|
if (pin <= 15) {
|
||||||
pin_value = pin;
|
pin_value = pin;
|
||||||
} else if (pin >= 16 && pin <= 31) {
|
} else if (pin >= 16 && pin <= 31) {
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,13 @@ void gpio_init(gpio_t *obj, PinName pin)
|
||||||
{
|
{
|
||||||
struct arm_gpio_dev_t *gpio_dev;
|
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) {
|
if (pin >= EXP0 && pin <= EXP51) {
|
||||||
/* GPIO pins */
|
/* GPIO pins */
|
||||||
switch (GPIO_DEV_NUMBER(pin)) {
|
switch (GPIO_DEV_NUMBER(pin)) {
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ uint32_t gpio_set(PinName pin) {
|
||||||
// this links the board control bits for each pin
|
// this links the board control bits for each pin
|
||||||
// with the object created for the pin
|
// with the object created for the pin
|
||||||
void gpio_init(gpio_t *obj, PinName pin) {
|
void gpio_init(gpio_t *obj, PinName pin) {
|
||||||
|
obj->pin = pin;
|
||||||
if(pin == NC){ return;}
|
if(pin == NC){ return;}
|
||||||
else {
|
else {
|
||||||
int pin_value = 0;
|
int pin_value = 0;
|
||||||
obj->pin = pin;
|
|
||||||
if(pin <=15){
|
if(pin <=15){
|
||||||
pin_value = pin;
|
pin_value = pin;
|
||||||
}else if (pin >= 16 && pin <= 31){
|
}else if (pin >= 16 && pin <= 31){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue