/**
* Pi Pico PIO driving a 4-digit seven segment display example.
*
* Copyright (C) 2021, Uri Shaked
*/
#include "hardware/pll.h"
#include "hardware/clocks.h"
#include "hardware/structs/pll.h"
#include "hardware/structs/clocks.h"
//#include "segment.pio.h"
#include "display.h"
enum { // enum untagged (senza tag type)
character,
integer,
floating_point
} vartype; // Define one
void setup() {
clock_configure(clk_sys,
CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX,
CLOCKS_CLK_SYS_CTRL_AUXSRC_VALUE_CLKSRC_PLL_USB,
48 * MHZ,
48 * MHZ);
// Turn off PLL sys for good measure
pll_deinit(pll_sys);
// CLK peri is clocked from clk_sys so need to change clk_peri's freq
clock_configure(clk_peri,
0,
CLOCKS_CLK_PERI_CTRL_AUXSRC_VALUE_CLK_SYS,
48 * MHZ,
48 * MHZ);
// Re init uart now that clk_peri has changed
//stdio_init_all();
Serial1.begin(115200);
Serial1.println("Raspberry Pi Pico PIO 7-Segment Example");
Serial1.print("sizeof(vartype): ");
Serial1.println(sizeof(vartype));
display_init();
display_sprint("-2.25", 0);
delay(1000);
display_fnprint(-20.25);
delay(1000);
float t = 95.0;
const float limit = 98.50;
while (true) {
delay(100);
display_fnprint(t);
t += 0.1;
if (t > limit) break;
}
}
int i = 0;
void loop() {
delay(1);
}