3535
3636#define I2C_INST i2c0
3737
38- static constexpr uint32_t kDeviceInfoAddr {0x0 };
39- static constexpr uint32_t kEdgeCountAddr {0x800 };
38+ static constexpr std:: uint32_t kDeviceInfoAddr {0x0 };
39+ static constexpr std:: uint32_t kEdgeCountAddr {0x800 };
4040
4141// Board ID (this is set only once and stored here).
4242static char board_id[PICO_UNIQUE_BOARD_ID_SIZE_BYTES * 2 + 1 ];
@@ -47,8 +47,8 @@ static DeviceInfoBlock data;
4747// EEPROM peripheral.
4848static AT24CM02 eeprom{I2C_INST, true };
4949
50- static volatile uint32_t edgecount;
51- static uint32_t last_edgecount;
50+ static volatile std:: uint32_t edgecount;
51+ static std:: uint32_t last_edgecount;
5252static volatile ::absolute_time_t last_edge_time;
5353
5454[[noreturn]] static void Panic () noexcept {
@@ -59,14 +59,15 @@ static volatile ::absolute_time_t last_edge_time;
5959}
6060
6161static void StoreDeviceInfo () noexcept {
62- if (!eeprom.Write (kDeviceInfoAddr , reinterpret_cast <const uint8_t *>(&data),
62+ if (!eeprom.Write (kDeviceInfoAddr ,
63+ reinterpret_cast <const std::uint8_t *>(&data),
6364 sizeof (data))) {
6465 Panic ();
6566 }
6667}
6768
6869static void LoadDeviceInfo () noexcept {
69- if (!eeprom.Read (kDeviceInfoAddr , reinterpret_cast <uint8_t *>(&data),
70+ if (!eeprom.Read (kDeviceInfoAddr , reinterpret_cast <std:: uint8_t *>(&data),
7071 sizeof (data))) {
7172 Panic ();
7273 }
@@ -81,16 +82,16 @@ static void ValidateDeviceInfo() noexcept {
8182 }
8283}
8384
84- static void StoreEdgeCount (uint32_t ec) noexcept {
85- if (!eeprom.Write (kEdgeCountAddr , reinterpret_cast <const uint8_t *>(&ec),
85+ static void StoreEdgeCount (std:: uint32_t ec) noexcept {
86+ if (!eeprom.Write (kEdgeCountAddr , reinterpret_cast <const std:: uint8_t *>(&ec),
8687 sizeof (ec))) {
8788 Panic ();
8889 }
8990}
9091
9192static void LoadEdgeCount () noexcept {
92- uint32_t ec;
93- if (!eeprom.Read (kEdgeCountAddr , reinterpret_cast <uint8_t *>(&ec),
93+ std:: uint32_t ec;
94+ if (!eeprom.Read (kEdgeCountAddr , reinterpret_cast <std:: uint8_t *>(&ec),
9495 sizeof (ec))) {
9596 Panic ();
9697 }
@@ -217,8 +218,7 @@ int main(void) {
217218
218219 // Falling edges increase the edge count.
219220 ::gpio_set_irq_enabled_with_callback (
220- PIN_SWITCH, GPIO_IRQ_EDGE_FALL, true ,
221- [](uint, uint32_t ) {
221+ PIN_SWITCH, GPIO_IRQ_EDGE_FALL, true , [](::uint, std::uint32_t ) {
222222 const auto now = ::get_absolute_time ();
223223 const auto diff = ::absolute_time_diff_us (last_edge_time, now);
224224 // 50ms debounce
@@ -229,7 +229,7 @@ int main(void) {
229229 });
230230
231231 char rdbuf[512 ] = {0 };
232- size_t idx = 0 ;
232+ std:: size_t idx = 0 ;
233233 int c;
234234 while (1 ) {
235235 c = ::getchar_timeout_us (10 );
0 commit comments