Skip to content

Commit

Permalink
Linux/Pico: WIP: Makefile, include libs after objects for Raspbian bu…
Browse files Browse the repository at this point in the history
…ild compatibility (sets --as-needed).
  • Loading branch information
Aviancer committed Mar 22, 2022
1 parent 0d0d909 commit cba115f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TARGET = amouse
all: serial.o utils.o mouse.o ${TARGET}

${TARGET}: ${SRC_DIR}/${TARGET}.c
${CC} ${CFLAGS} ${INCLUDES} -o ${BIN_DIR}/${TARGET} ${C_SOURCES} ${C_SHARED}
${CC} ${CFLAGS} -o ${BIN_DIR}/${TARGET} ${C_SOURCES} ${C_SHARED} ${INCLUDES}

utils.o: ${SRC_DIR}/../../shared/utils.c ${SRC_DIR}/../../shared/utils.h
${CC} ${CFLAGS} -c ${SRC_DIR}/../../shared/utils.c -o ${SRC_DIR}/include/utils.o
Expand Down
19 changes: 15 additions & 4 deletions pico/amouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ int main() {
// CTS Pin
//gpio_init(UART_CTS_PIN); // DEBUG
//gpio_set_dir(UART_CTS_PIN, GPIO_IN); // DEBUG
gpio_set_irq_enabled_with_callback(UART_CTS_PIN, GPIO_IRQ_EDGE_FALL, true, &someother_callback);
//gpio_set_irq_enabled_with_callback(UART_CTS_PIN, GPIO_IRQ_EDGE_FALL, true, &someother_callback);

// Set initial serial timer targets
time_tx_target = time_us_32() + U_SERIALDELAY_3B;
Expand All @@ -215,17 +215,17 @@ int main() {
time_rx_target = time_us_32() + U_FULL_SECOND;
}

if(init_req) { // DEBUG
/*if(init_req) { // DEBUG
mouse_ident(0, mouse_options.wheel); // TODO mouse_options.wheel.
mouse.pc_state = CTS_TOGGLED;
gpio_put(LED_PIN, true);
led_state = true;
init_req = false;
}
}*/

// Mouse handling

//cts_pin = gpio_get(UART_CTS_PIN);
cts_pin = gpio_get(UART_CTS_PIN);

// ### Check if mouse driver trying to initialize
/*if(cts_pin) { // Computers RTS is low, with MAX3232 this shows reversed as high instead? Check spec.
Expand All @@ -241,6 +241,17 @@ int main() {
led_state = false;
}*/

if(cts_pin) { // Computers RTS low, only pin we care about for MS drivers, etc.
if(mouse.pc_state == CTS_UNINIT) { mouse.pc_state = CTS_LOW_INIT; }
else if(mouse.pc_state == CTS_TOGGLED) { mouse.pc_state = CTS_LOW_RUN; }
}

// Mouse initiaizing request detected
if(!cts_pin && (mouse.pc_state != CTS_UNINIT && mouse.pc_state != CTS_TOGGLED)) {
mouse.pc_state = CTS_TOGGLED;
mouse_ident(0, mouse_options.wheel);
}


/*** Mouse update loop ***/

Expand Down

0 comments on commit cba115f

Please sign in to comment.