fixed some Wall Wextra warnings

master
Ondřej Hruška 7 years ago
parent c0679244ca
commit 0f86b3575c
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 14
      main.c

@ -8,7 +8,7 @@
// ----------- DEMO ----------------- // ----------- DEMO -----------------
void main(void) int main(void)
{ {
// The search algorithm stores its internal state in a struct. // The search algorithm stores its internal state in a struct.
@ -41,6 +41,8 @@ void main(void)
} }
printf("\n"); printf("\n");
} }
return 0;
} }
// ------------ SIMULATOR --------------- // ------------ SIMULATOR ---------------
@ -71,7 +73,7 @@ struct owunit units[UNITS_COUNT] = {
{.romcode = {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}}, {.romcode = {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}},
}; };
bool rom_device_reset(struct owunit *device) void rom_device_reset(struct owunit *device)
{ {
device->rompos = 0; device->rompos = 0;
device->state = 0; device->state = 0;
@ -81,16 +83,19 @@ bool rom_device_reset(struct owunit *device)
bool rom_device_read(struct owunit *device) bool rom_device_read(struct owunit *device)
{ {
if (!device->selected) return true; if (!device->selected) return true;
bool res = 0;
if (device->state == 0) { if (device->state == 0) {
device->state++; device->state++;
bool res = ow_code_getbit(device->romcode, device->rompos); res = ow_code_getbit(device->romcode, device->rompos);
return res; return res;
} }
if (device->state == 1) { if (device->state == 1) {
device->state++; device->state++;
bool res = !ow_code_getbit(device->romcode, device->rompos); res = !ow_code_getbit(device->romcode, device->rompos);
return res; return res;
} }
return res;
} }
void rom_device_write(struct owunit *device, bool selectedbit) void rom_device_write(struct owunit *device, bool selectedbit)
@ -132,5 +137,6 @@ void ow_write_bit(bool value)
void ow_write_u8(uint8_t value) void ow_write_u8(uint8_t value)
{ {
(void) value;
// Dummy, do nothing // Dummy, do nothing
} }

Loading…
Cancel
Save