|
|
@ -23,7 +23,7 @@
|
|
|
|
#include <wiringPiI2C.h>
|
|
|
|
#include <wiringPiI2C.h>
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t solve_challenge(uint8_t arg) {
|
|
|
|
uint8_t solve_challenge(uint8_t arg) {
|
|
|
|
return (arg >> 3) ^ (arg << 3);
|
|
|
|
return (arg >> 3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t parse_int(const char *s) { // Convert string to hex
|
|
|
|
uint8_t parse_int(const char *s) { // Convert string to hex
|
|
|
@ -67,8 +67,11 @@ int main(int argc, char *argv[]) {
|
|
|
|
delay(1);
|
|
|
|
delay(1);
|
|
|
|
|
|
|
|
|
|
|
|
challenge = wiringPiI2CRead(fd);
|
|
|
|
challenge = wiringPiI2CRead(fd);
|
|
|
|
|
|
|
|
printf("Received %d\n", challenge);
|
|
|
|
response = solve_challenge(challenge);
|
|
|
|
response = solve_challenge(challenge);
|
|
|
|
wiringPiI2CWrite(fd, response);
|
|
|
|
printf("Sending %d\n", response);
|
|
|
|
|
|
|
|
delay(100);
|
|
|
|
|
|
|
|
wiringPiI2CWrite(fd, (uint8_t)response);
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|