green led on 0xf7 (#619)

* green led on 0xf7

* add python interface

Co-authored-by: Robbe Derks <robbe.derks@gmail.com>
This commit is contained in:
George Hotz 2021-01-05 05:51:58 -08:00 committed by GitHub
parent 72d6b6de69
commit e035fa1d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -614,6 +614,10 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
case 0xf6:
siren_enabled = (setup->b.wValue.w != 0U);
break;
// **** 0xf7: set green led enabled
case 0xf7:
green_led_enabled = (setup->b.wValue.w != 0U);
break;
default:
puts("NO HANDLER ");
puth(setup->b.bRequest);
@ -701,7 +705,7 @@ void TIM1_BRK_TIM9_IRQ_Handler(void) {
fan_tick();
// set green LED to be controls allowed
current_board->set_led(LED_GREEN, controls_allowed);
current_board->set_led(LED_GREEN, controls_allowed | green_led_enabled);
// turn off the blue LED, turned on by CAN
// unless we are in power saving mode

View File

@ -14,3 +14,4 @@ bool is_enumerated = 0;
uint32_t heartbeat_counter = 0;
uint32_t uptime_cnt = 0;
bool siren_enabled = false;
bool green_led_enabled = false;

View File

@ -676,3 +676,7 @@ class Panda(object):
# ****************** Siren *****************
def set_siren(self, enabled):
self._handle.controlWrite(Panda.REQUEST_OUT, 0xf6, int(enabled), 0, b'')
# ****************** Debug *****************
def set_green_led(self, enabled):
self._handle.controlWrite(Panda.REQUEST_OUT, 0xf7, int(enabled), 0, b'')