#include #include #include "pico/stdlib.h" #include "hardware/pwm.h" #include "hardware/pio.h" #include "hardware/timer.h" #include "hardware/clocks.h" #include "lcd.h" #include "dsp.h" #include "si5351.h" /* Monitor definitions */ #define ENDSTDIN 255 #define CR 13 #define LF 10 #define CMD_LEN 32 uint8_t display1[16]; uint8_t display2[16]; /* LED TIMER definition and callback */ struct repeating_timer led_timer; bool led_callback(struct repeating_timer *t) { static bool led_state; gpio_put(PICO_DEFAULT_LED_PIN, led_state); led_state = (led_state?false:true); return true; } uint8_t si5351_reg[200]; char delim[] = " "; #define NCMD 3 char *shell[NCMD] = {"si", "fa", "fb"}; void mon_parse(char* s) { char *p; int base, nreg, i; p = strtok(s, delim); // Get command part of string for (i=0; i "); int c, i=0; char mon_cmd[CMD_LEN+1]; while (1) { /* Check for monitor input */ c = getchar_timeout_us(100000); // 1 try per 100 msec switch (c) { case PICO_ERROR_TIMEOUT: // just go-on break; case CR: // CR or LF: case LF: // need to parse command string putchar((char)c); // echo character if (i==0) break; // already did a parse, only do it once mon_cmd[i] = 0; // terminate command string i=0; // reset index mon_parse(mon_cmd); // process command printf("Pico> "); // prompt break; default: if ((c<32)||(c>=128)) break; // Alfanumeric? putchar((char)c); // echo character mon_cmd[i] = (char)c; // store in command string if (i