Skip to content

FreeRTOS and multiple wiegand tasks #499

Answered by UncleRus
Exboom asked this question in Q&A
Discussion options

You must be logged in to vote

Try something like this:

#define READERS_COUNT 4  // for example

static QueueHandle_t queue = NULL;

// Single data packet
typedef struct
{
    int reader_idx;
    uint8_t data[BUF_SIZE];
    size_t bits;
} data_packet_t;

// struct to hold reader description
typedef struct {
    gpio_num_t d0, d1;
    wiegand_order_t bit_order, byte_order;
} reader_descr_t;

// array to describe all readers
// replace GPIO_NUM_xx with real GPIOs
static const reader_descr_t readers_descr[READERS_COUNT] = {
    { .d0 = GPIO_NUM_xx, .d1 = GPIO_NUM_xx, .bit_order = WIEGAND_MSB_FIRST, .byte_order = WIEGAND_LSB_FIRST },
    { .d0 = GPIO_NUM_xx, .d1 = GPIO_NUM_xx, .bit_order = WIEGAND_MSB_FIRST, .byte_order = W…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by UncleRus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants