aboutsummaryrefslogtreecommitdiff
path: root/examples/intel-quark-d2000
diff options
context:
space:
mode:
Diffstat (limited to 'examples/intel-quark-d2000')
-rw-r--r--examples/intel-quark-d2000/schematic.h37
1 files changed, 37 insertions, 0 deletions
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 <stddef.h>
+#include <qm_gpio.h>
+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