11 static uint8_t num_int_trigs = 0;
36 if ( ( (cfg.
input % 32) + ( (cfg.
input >> 8) * 32)) > interrupt_table_size
37 || ( (cfg.
output % 32) + ( (cfg.
input >> 8) * 32)) > interrupt_table_size)
118 if ( ( (cfg.
input % 32) + ( (cfg.
input >> 8) * 32)) > interrupt_table_size
119 || ( (cfg.
output % 32) + ( (cfg.
input >> 8) * 32)) > interrupt_table_size)
154 if (
RD_SUCCESS != status || 1 != num_int_trigs)
168 if (
RD_SUCCESS != status || 1 != num_int_trigs)
184 || ( (1 != num_int_trigs) && (2 != num_int_trigs)))
200 if (
RD_SUCCESS != status || 2 != num_int_trigs)
250 printfp (
"\"gpio_interrupt\":{\r\n");
251 printfp (
"\"init\":");
256 printfp (
"\"pass\",\r\n");
260 printfp (
"\"fail\",\r\n");
263 printfp (
"\"enable\":");
268 printfp (
"\"pass\"\r\n");
272 printfp (
"\"fail\"\r\n");
#define RD_ERROR_NULL
Null Pointer.
#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_NO_MEM
No Memory for operation.
#define RD_ERROR_SELFTEST
Self-test fail.
#define RD_ERROR_INVALID_STATE
Invalid state, operation disallowed in this state.
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_interrupt_enable(const ri_gpio_id_t pin, const ri_gpio_slope_t slope, const ri_gpio_mode_t mode, const ri_gpio_interrupt_fp_t handler)
Enable interrupt on a pin.
rd_status_t ri_gpio_interrupt_test_init(const rd_test_gpio_cfg_t cfg)
Test GPIO interrupt initialization.
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 ...
#define RI_GPIO_INTERRUPT_TEST_TABLE_SIZE
Fixed 64 interrupt table size, adjust this if some device has more than 2 ports with 32 gpios each.
rd_status_t ri_gpio_interrupt_init(ri_gpio_interrupt_fp_t *const interrupt_table, const uint16_t max_interrupts)
Initialize interrupt functionality to GPIO. Takes address of interrupt table as a pointer to avoid ty...
void(* ri_gpio_interrupt_fp_t)(const ri_gpio_evt_t)
rd_status_t ri_gpio_interrupt_test_enable(const rd_test_gpio_cfg_t cfg)
Test enabling interrupt on a pin.
rd_status_t ri_gpio_interrupt_uninit(void)
Uninitialize interrupt functionality of GPIO.
rd_status_t ri_gpio_interrupt_disable(const ri_gpio_id_t pin)
Disable interrupt on a pin.
rd_status_t ri_gpio_init(void)
Initializes GPIO module. Call this before other GPIO functions. After initialization all GPIO pins sh...
bool ri_gpio_interrupt_run_integration_test(const rd_test_print_fp printfp, const ri_gpio_id_t input, const ri_gpio_id_t output)
Run all GPIO interrupt integration tests.
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 ...
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.
structure to configure GPIO test with input and output. These GPIOs must be physically connected on b...
ri_gpio_id_t input
Input pin used in test. Must be interrupt-capable.
ri_gpio_id_t output
Output pin used in test. Must be PWM-capable.