Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't pull KSDK FSL libraries into apps #1886

Merged
merged 1 commit into from
Jun 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#include "gpio_api.h"
#include "pinmap.h"
#include "fsl_port.h"
#include "fsl_gpio.h"

static GPIO_Type * const gpio_addrs[] = GPIO_BASE_PTRS;

uint32_t gpio_set(PinName pin) {
MBED_ASSERT(pin != (PinName)NC);
Expand All @@ -41,7 +44,6 @@ void gpio_mode(gpio_t *obj, PinMode mode) {
void gpio_dir(gpio_t *obj, PinDirection direction) {
MBED_ASSERT(obj->pin != (PinName)NC);
uint32_t port = obj->pin >> GPIO_PORT_SHIFT;
GPIO_Type *gpio_addrs[] = GPIO_BASE_PTRS;
uint32_t pin_num = obj->pin & 0xFF;
GPIO_Type *base = gpio_addrs[port];

Expand All @@ -54,3 +56,19 @@ void gpio_dir(gpio_t *obj, PinDirection direction) {
break;
}
}

void gpio_write(gpio_t *obj, int value) {
MBED_ASSERT(obj->pin != (PinName)NC);
uint32_t port = obj->pin >> GPIO_PORT_SHIFT;
uint32_t pin = obj->pin & 0xFF;

GPIO_WritePinOutput(gpio_addrs[port], pin, value);
}

int gpio_read(gpio_t *obj) {
MBED_ASSERT(obj->pin != (PinName)NC);
uint32_t port = obj->pin >> GPIO_PORT_SHIFT;
uint32_t pin = obj->pin & 0xFF;

return (int)GPIO_ReadPinInput(gpio_addrs[port], pin);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#ifndef MBED_GPIO_OBJECT_H
#define MBED_GPIO_OBJECT_H

#include "mbed_assert.h"
#include "fsl_gpio.h"

#ifdef __cplusplus
extern "C" {
#endif
Expand All @@ -27,24 +24,6 @@ typedef struct {
PinName pin;
} gpio_t;

static inline void gpio_write(gpio_t *obj, int value) {
MBED_ASSERT(obj->pin != (PinName)NC);
uint32_t port = obj->pin >> GPIO_PORT_SHIFT;
uint32_t pin = obj->pin & 0xFF;
GPIO_Type *gpio_addrs[] = GPIO_BASE_PTRS;

GPIO_WritePinOutput(gpio_addrs[port], pin, value);
}

static inline int gpio_read(gpio_t *obj) {
MBED_ASSERT(obj->pin != (PinName)NC);
uint32_t port = obj->pin >> GPIO_PORT_SHIFT;
uint32_t pin = obj->pin & 0xFF;
GPIO_Type *gpio_addrs[] = GPIO_BASE_PTRS;

return (int)GPIO_ReadPinInput(gpio_addrs[port], pin);
}

static inline int gpio_is_connected(const gpio_t *obj) {
return obj->pin != (PinName)NC;
}
Expand Down