From f9c8c5da8de36b0f95bc92e37e15d299b434c03f Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 27 Jul 2016 21:06:48 +0200 Subject: more intel stuff. --- examples/intel-quark-d2000/schematic.h | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'examples') diff --git a/examples/intel-quark-d2000/schematic.h b/examples/intel-quark-d2000/schematic.h index 3ca8e86..62545f0 100644 --- a/examples/intel-quark-d2000/schematic.h +++ b/examples/intel-quark-d2000/schematic.h @@ -8,8 +8,45 @@ Generated from schematic for reference U1, part INTEL_QUARK_D2000 in library kic */ #include +#include +enum schematic_direction { + schematic_direction_out = 1, + schematic_direction_in = 2 +}; static const uint8_t SCHEMATIC_STATUS_LED = 15; + +static inline +qm_rc_t schematic_PUSH_BUTTON_direction(enum schematic_direction dir) { + qm_gpio_port_config_t cfg; + + qm_gpio_get_config(QM_GPIO_0, &cfg); + + if (dir == schematic_direction_out) { + cfg.direction |= BIT(SCHEMATIC_PUSH_BUTTON); + } else { + cfg.direction &= ~BIT(SCHEMATIC_PUSH_BUTTON); + } + + return qm_gpio_set_config(QM_GPIO_0, &cfg); +} + static const uint8_t SCHEMATIC_PUSH_BUTTON = 11; +static inline +qm_rc_t schematic_PUSH_BUTTON_direction(enum schematic_direction dir) { + qm_gpio_port_config_t cfg; + + qm_gpio_get_config(QM_GPIO_0, &cfg); + + if (dir == schematic_direction_out) { + cfg.direction |= BIT(SCHEMATIC_PUSH_BUTTON); + } else { + cfg.direction &= ~BIT(SCHEMATIC_PUSH_BUTTON); + } + + return qm_gpio_set_config(QM_GPIO_0, &cfg); +} + + #endif // SCHEMATIC_H -- cgit v1.2.3