stm32f103-minimum: Use separated read_ops for GPIO interrupt pins

This commit is contained in:
Alan Carvalho de Assis 2017-06-11 07:20:18 -06:00 committed by Gregory Nutt
parent 6e0ec04084
commit b7ca90a721
2 changed files with 16 additions and 3 deletions

View File

@ -78,7 +78,7 @@ Board Features
2. The board uses Bluetooth® V4.1 module (SPBTLE-RF), which has built-in 2. The board uses Bluetooth® V4.1 module (SPBTLE-RF), which has built-in
BLE stack. Similar with wifi, you only use simple AT command to talk BLE stack. Similar with wifi, you only use simple AT command to talk
with this BLE module. with this BLE module.
3. STMicro provides contiki 6lowpan for mesh. 3. STMicro provides contiki 6lowpan for mesh.
http://www.st.com/en/embedded-software/osxcontiki6lp.html but mesh http://www.st.com/en/embedded-software/osxcontiki6lp.html but mesh

View File

@ -82,6 +82,7 @@ struct stm32gpint_dev_s
static int gpin_read(FAR struct gpio_dev_s *dev, FAR bool *value); static int gpin_read(FAR struct gpio_dev_s *dev, FAR bool *value);
static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value); static int gpout_read(FAR struct gpio_dev_s *dev, FAR bool *value);
static int gpout_write(FAR struct gpio_dev_s *dev, bool value); static int gpout_write(FAR struct gpio_dev_s *dev, bool value);
static int gpint_read(FAR struct gpio_dev_s *dev, FAR bool *value);
static int gpint_attach(FAR struct gpio_dev_s *dev, static int gpint_attach(FAR struct gpio_dev_s *dev,
pin_interrupt_t callback); pin_interrupt_t callback);
static int gpint_enable(FAR struct gpio_dev_s *dev, bool enable); static int gpint_enable(FAR struct gpio_dev_s *dev, bool enable);
@ -108,7 +109,7 @@ static const struct gpio_operations_s gpout_ops =
static const struct gpio_operations_s gpint_ops = static const struct gpio_operations_s gpint_ops =
{ {
.go_read = gpin_read, .go_read = gpint_read,
.go_write = NULL, .go_write = NULL,
.go_attach = gpint_attach, .go_attach = gpint_attach,
.go_enable = gpint_enable, .go_enable = gpint_enable,
@ -198,6 +199,18 @@ static int gpout_write(FAR struct gpio_dev_s *dev, bool value)
return OK; return OK;
} }
static int gpint_read(FAR struct gpio_dev_s *dev, FAR bool *value)
{
FAR struct stm32gpint_dev_s *stm32gpint = (FAR struct stm32gpint_dev_s *)dev;
DEBUGASSERT(stm32gpint != NULL && value != NULL);
DEBUGASSERT(stm32gpint->stm32gpio && stm32gpint->stm32gpio.id < BOARD_NGPIOINT);
gpioinfo("Reading int pin...\n");
*value = stm32_gpioread(g_gpiointinputs[stm32gpint->stm32gpio.id]);
return OK;
}
static int gpint_attach(FAR struct gpio_dev_s *dev, static int gpint_attach(FAR struct gpio_dev_s *dev,
pin_interrupt_t callback) pin_interrupt_t callback)
{ {
@ -289,7 +302,7 @@ int stm32_gpio_initialize(void)
(void)gpio_pin_register(&g_gpout[i].gpio, pincount); (void)gpio_pin_register(&g_gpout[i].gpio, pincount);
/* Configure the pin that will be used as output */ /* Configure the pin that will be used as output */
stm32_gpiowrite(g_gpiooutputs[i], 0);
stm32_configgpio(g_gpiooutputs[i]); stm32_configgpio(g_gpiooutputs[i]);
pincount++; pincount++;