~ruther/avr-shift-registers

ref: 999ecdc452b9f21d0f7b0c77b7500211f4680a0e avr-shift-registers/src/sr/data_position.c -rw-r--r-- 820 bytes
999ecdc4 — František Boháček chore: update toolchain project 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "shift_register_internal.h"
#include <stdlib.h>

const DataPosition data_position_create(volatile byte* pin, byte position) {
    DataPosition dp = { pin, position };
    return dp;
}

bool data_position_get_pin(const DataPosition position)
{
    return get_value(position.pin, position.position);
}

void data_position_set_port(const DataPosition position)
{
    set_value(position.pin + SR_PORT_OFFSET, position.position);
}

void data_position_reset_port(const DataPosition position)
{
    reset_value(position.pin + SR_PORT_OFFSET, position.position);
}

void data_position_set_ddr(const DataPosition position)
{
    set_value(position.pin + SR_DDR_OFFSET, position.position);
}

void data_position_reset_ddr(const DataPosition position)
{
    reset_value(position.pin + SR_DDR_OFFSET, position.position);
}