blob: 23e44e96bc3597fb4f466b2f41761e91ebe74444 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
void init_supervia(struct supervia *sv) {
memset(sv, 0, sizeof(struct supervia));
}
void shift_out8(struct supervia *sv, int id) {
uint8_t bitpos = 7-sv->sr[id].ocount;
for (int i = 0; i < 8; i++) {
if (sv->sr[id].dir & (1 << i)) {
uint8_t bit = (sv->sr[id].data.u8[i] >> bitpos) & 1;
sv->sr[id].bits |= (bit << i);
}
}
sv->sr[id].ocount++;
sv->sr[id].ocount %= 8;
}
|