You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was holding off on posting here for a while, but I've banged my head against the wall for so long that I need a bit of guidance.
Like Guy, I had been working on a similar project since last summer, but decided to try to switch over to the PocketBeagle instead of a Raspberry Pi (mainly due to it's alleged support for very low power sleep modes).
Getting things like Wi-Fi/Bluetooth/SPI displays working on this was a battle and a half, but I managed to work through them. One thing I'm still stuck on, however, is the clickwheel code.
From what I can tell, he's got a few callback functions triggered to run whenever either the clock or data line changes, then does a bit of bit-banging. What I'm struggling with is the switch to the IOBB library to get similar behavior up and running on a PocketBeagle.
// Nate added these for PocketBeagle to make hack-y callback functions
int CURRENTCLOCKSTATE = 0;
int CURRENTDATASTATE = 0;
int PASTCLOCKSTATE = 0;
int PASTDATASTATE = 0;
iolib_init();
iolib_setdir(1, 28, DigitalIn); // Set clock pin GPIO13 (P1,28) as input
iolib_setdir(1, 26, DigitalIn); // Set data pin GPIO12 (P1,26) as input
// Back to Guy's code
if ( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0 ) {
perror("socket creation failed");
exit(EXIT_FAILURE);
}
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(PORT);
servaddr.sin_addr.s_addr = INADDR_ANY;
// I also removed the pulses/haptic code, as I wasn't planning on integrating that
while(running) {
CURRENTCLOCKSTATE = (is_low(1, 28)) ? 0 : 1;
CURRENTDATASTATE = (is_low(1, 26)) ? 0 : 1;
//printf("Did clock state change?");
if(CURRENTCLOCKSTATE != PASTCLOCKSTATE) {
printf("Clock state changed!\n");
onClockEdge(28, CURRENTCLOCKSTATE); // Runs his original functions
PASTCLOCKSTATE = CURRENTCLOCKSTATE;
}
//printf("Did data state change?");
if(CURRENTDATASTATE != PASTDATASTATE) {
printf("Data state changed!\n");
onDataEdge(26, CURRENTDATASTATE); // Runs his original functions
PASTDATASTATE = CURRENTDATASTATE;
}
}
The idea is that I'm creating my own callback functions if the current data/clock pin state changes compared to the previous one. However, it perpetually reads the state of those pins as 0, which makes me think I'm just not polling correctly.
I'm not a programmer by trade (especially not this low level of programming), and unfortunately I've exhausted my list of resources for i2c reading/bit-banging.
The text was updated successfully, but these errors were encountered:
Hey everyone,
I was holding off on posting here for a while, but I've banged my head against the wall for so long that I need a bit of guidance.
Like Guy, I had been working on a similar project since last summer, but decided to try to switch over to the PocketBeagle instead of a Raspberry Pi (mainly due to it's alleged support for very low power sleep modes).
Getting things like Wi-Fi/Bluetooth/SPI displays working on this was a battle and a half, but I managed to work through them. One thing I'm still stuck on, however, is the clickwheel code.
From what I can tell, he's got a few callback functions triggered to run whenever either the clock or data line changes, then does a bit of bit-banging. What I'm struggling with is the switch to the IOBB library to get similar behavior up and running on a PocketBeagle.
The idea is that I'm creating my own callback functions if the current data/clock pin state changes compared to the previous one. However, it perpetually reads the state of those pins as 0, which makes me think I'm just not polling correctly.
I'm not a programmer by trade (especially not this low level of programming), and unfortunately I've exhausted my list of resources for i2c reading/bit-banging.
The text was updated successfully, but these errors were encountered: