9 #define PULL_DELAY_MS (1U)
173 printfp (
"\"gpio\":{\r\n");
174 printfp (
"\"init\":");
179 printfp (
"\"pass\",\r\n");
183 printfp (
"\"fail\",\r\n");
186 printfp (
"\"configure\":");
191 printfp (
"\"pass\",\r\n");
195 printfp (
"\"fail\",\r\n");
198 printfp (
"\"toggle\":");
203 printfp (
"\"pass\"\r\n");
207 printfp (
"\"fail\"\r\n");
#define RD_ERROR_FATAL
Program should always reset after this.
uint32_t rd_status_t
bitfield for representing errors
#define RD_ERROR_CHECK(error, mask)
Shorthand macro for calling the rd_error_check with current file & line.
#define RD_SUCCESS
Internal Error.
#define RD_ERROR_SELFTEST
Self-test fail.
rd_status_t ri_gpio_uninit(void)
Uninitializes GPIO module. Call this to reset GPIO to High-Z mode. After uninitialization all GPIO pi...
rd_status_t ri_gpio_configure(const ri_gpio_id_t pin, const ri_gpio_mode_t mode)
Configure a pin of a port into a mode. If there are several ports the platform driver must implement ...
rd_status_t ri_gpio_test_configure(const ri_gpio_id_t input, const ri_gpio_id_t output)
Test configuring a pin of a port into a mode.
bool ri_gpio_run_integration_test(const rd_test_print_fp printfp, const ri_gpio_id_t input, const ri_gpio_id_t output)
Run all GPIO integration tests.
rd_status_t ri_gpio_toggle(const ri_gpio_id_t pin)
Toggle the state of a pin of a port. If there are several ports the platform driver must implement a ...
rd_status_t ri_gpio_test_init(void)
Test GPIO module initialization.
rd_status_t ri_gpio_init(void)
Initializes GPIO module. Call this before other GPIO functions. After initialization all GPIO pins sh...
rd_status_t ri_gpio_read(const ri_gpio_id_t pin, ri_gpio_state_t *const p_state)
Read state of a pin of a port into bool high If there are several ports the platform driver must impl...
rd_status_t ri_gpio_write(const ri_gpio_id_t pin, const ri_gpio_state_t state)
Write a pin of a port into given state If there are several ports the platform driver must implement ...
rd_status_t ri_gpio_test_toggle(const ri_gpio_id_t input, const ri_gpio_id_t output)
Test toggling the state of a pin of a port.
void(* rd_test_print_fp)(const char *const msg)
function pointer to print test information
Header to enable and disable module compilation.
Ruuvi error codes and error check function.
Functions for testing drivers.
uint16_t ri_gpio_id_t
port<<8 + pin
@ RI_GPIO_MODE_OUTPUT_STANDARD
Push-pull output, can be written.
@ RI_GPIO_MODE_INPUT_PULLUP
Input, can be read. Pulled up by internal resistor, value depends on IC.
@ RI_GPIO_MODE_INPUT_NOPULL
Input, can be read. No pull resistors.
@ RI_GPIO_MODE_INPUT_PULLDOWN
Input, can be read. Pulled dpwn by internal resistor, value depends on IC.
ri_gpio_state_t
States of GPIO pins.
@ RI_GPIO_LOW
GPIO electrically low.
@ RI_GPIO_HIGH
GPIO electrically high.
rd_status_t ri_delay_ms(uint32_t time)
Delay a given number of milliseconds.