x86, galileo: Refactor I2C and GPIO initialization
This patch revises the I2C and GPIO initialization code to always be run during platform boot rather than within each process that requires it. This patch also revises the gpio-output example to use a pin that is set as an output by the default pinmux configuration. Previously, it used a pin that was set as an output by the pinmux configuration that is in effect when the OS does not change the pinmux configuration.
This commit is contained in:
parent
3e64447631
commit
58874ea25d
10 changed files with 54 additions and 70 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015, Intel Corporation. All rights reserved.
|
||||
* Copyright (C) 2015-2016, Intel Corporation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -34,14 +34,11 @@
|
|||
#include "sys/ctimer.h"
|
||||
|
||||
#include "gpio.h"
|
||||
#include "i2c.h"
|
||||
#include "galileo-pinmux.h"
|
||||
|
||||
#define PIN_OUTPUT 5
|
||||
#define PIN_INTR 6
|
||||
|
||||
static struct ctimer timer;
|
||||
static struct quarkX1000_i2c_config i2c_config;
|
||||
|
||||
PROCESS(gpio_interrupt_process, "GPIO Interrupt Process");
|
||||
AUTOSTART_PROCESSES(&gpio_interrupt_process);
|
||||
|
@ -66,16 +63,6 @@ PROCESS_THREAD(gpio_interrupt_process, ev, data)
|
|||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
i2c_config.speed = QUARKX1000_I2C_SPEED_STANDARD;
|
||||
i2c_config.addressing_mode = QUARKX1000_I2C_ADDR_MODE_7BIT;
|
||||
|
||||
quarkX1000_i2c_init();
|
||||
quarkX1000_i2c_configure(&i2c_config);
|
||||
|
||||
/* use default pinmux configuration */
|
||||
galileo_pinmux_initialize();
|
||||
|
||||
quarkX1000_gpio_init();
|
||||
quarkX1000_gpio_config(PIN_OUTPUT, QUARKX1000_GPIO_OUT);
|
||||
quarkX1000_gpio_config(PIN_INTR, QUARKX1000_GPIO_INT | QUARKX1000_GPIO_ACTIVE_HIGH | QUARKX1000_GPIO_EDGE);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue