Nexus Embedded Platform 0.1.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
gpio.h
Go to the documentation of this file.
1
8#ifndef NEXUS_GPIO_H
9#define NEXUS_GPIO_H
10
11#include "nexus/core/status.h"
12#ifdef __cplusplus
13extern "C" {
14#endif
16
23typedef struct {
24 nx_result_t (*write)(void* context, uint32_t set_mask, uint32_t reset_mask);
25 nx_result_t (*read)(const void* context, uint32_t* value);
26 nx_result_t (*toggle)(void* context, uint32_t mask);
28
36 void* context;
37};
38
54nx_result_t nx_gpio_port_write(const nx_gpio_port_t* port, uint32_t set_mask,
55 uint32_t reset_mask);
65nx_result_t nx_gpio_port_read(const nx_gpio_port_t* port, uint32_t* value);
78#ifdef __cplusplus
79}
80#endif
81
82#endif
nx_result_t nx_gpio_port_read(const nx_gpio_port_t *port, uint32_t *value)
Read one input snapshot restricted to the binding mask.
nx_result_t nx_gpio_port_write(const nx_gpio_port_t *port, uint32_t set_mask, uint32_t reset_mask)
Atomically set/reset one port's authorized output mask.
nx_result_t nx_gpio_port_toggle(const nx_gpio_port_t *port, uint32_t mask)
Toggle authorized outputs under the single-writer contract.
struct nx_gpio_port nx_gpio_port_t
Definition gpio.h:15
Small vendor-independent result vocabulary.
nx_result_t
Operation result; success at submission means admission only.
Definition status.h:21
Shared read-only methods using one provider state.
Definition gpio.h:23
nx_result_t(* write)(void *context, uint32_t set_mask, uint32_t reset_mask)
Definition gpio.h:24
nx_result_t(* toggle)(void *context, uint32_t mask)
Definition gpio.h:26
nx_result_t(* read)(const void *context, uint32_t *value)
Definition gpio.h:25
Immutable interface pointing to caller-owned state.
Definition gpio.h:34
void * context
Definition gpio.h:36
const nx_gpio_ops_t * ops
Definition gpio.h:35