sysctl: add som wake command

This commit is contained in:
Lukas F. Hartmann 2024-01-17 13:29:54 +01:00
parent 66039d0102
commit 2b0733f901
No known key found for this signature in database
GPG Key ID: 376511EB67AD7BAF
1 changed files with 14 additions and 0 deletions

View File

@ -696,6 +696,10 @@ void turn_som_power_off() {
gpio_put(PIN_PWREN_LATCH, 0);
}
void som_wake() {
uart_puts(uart0, "wake\r\n");
}
#define ST_EXPECT_DIGIT_0 0
#define ST_EXPECT_DIGIT_1 1
#define ST_EXPECT_DIGIT_2 2
@ -824,6 +828,9 @@ void handle_commands(char chr) {
else if (remote_cmd == 'w') {
// TODO
// wake SoC
som_wake();
sprintf(uart_buffer,"system: wake\r\n");
uart_puts(UART_ID, uart_buffer);
}
else if (remote_cmd == 'c') {
// TODO
@ -883,6 +890,13 @@ int main() {
//irq_set_enabled(UART_IRQ, true);
//uart_set_irq_enables(UART_ID, true, false); // bool rx_has_data, bool tx_needs_data
uart_init(uart0, BAUD_RATE);
uart_set_format(uart0, DATA_BITS, STOP_BITS, PARITY);
uart_set_hw_flow(uart0, false, false);
uart_set_fifo_enabled(uart0, true);
gpio_set_function(PIN_SOM_UART_TX, GPIO_FUNC_UART);
gpio_set_function(PIN_SOM_UART_RX, GPIO_FUNC_UART);
gpio_set_function(PIN_SDA, GPIO_FUNC_I2C);
gpio_set_function(PIN_SCL, GPIO_FUNC_I2C);
bi_decl(bi_2pins_with_func(PIN_SDA, PIN_SCL, GPIO_FUNC_I2C));