/** * linkbox_hpd.c * * Controls the GPIO port for Hot Plug Detect (HPD). * * Copyright (c) 2022 Bigscreen, Inc. */ #include #include #include "displayboard.h" #include "linkbox_hpd.h" bool linkbox_active_level = true; void linkbox_hpd_set_active_level(bool new_active_level) { linkbox_active_level = new_active_level; } void linkbox_hpd_set_inactive(void) { Pio* portbase = arch_ioport_pin_to_base(PIN_USBCC_EN); if(linkbox_active_level) { // For active high case, clear the output pin (set low) portbase->PIO_CODR = arch_ioport_pin_to_mask(PIN_USBCC_EN); } else { // For active low, do the opposite (set high) portbase->PIO_SODR = arch_ioport_pin_to_mask(PIN_USBCC_EN); } } void linkbox_hpd_set_active(void) { Pio* portbase = arch_ioport_pin_to_base(PIN_USBCC_EN); if(linkbox_active_level) { // For active high case, set the output pin (set high) portbase->PIO_SODR = arch_ioport_pin_to_mask(PIN_USBCC_EN); } else { // For active low, do the opposite (set low) portbase->PIO_CODR = arch_ioport_pin_to_mask(PIN_USBCC_EN); } }