Skip to content

Commit

Permalink
Add scrollbars and new svgs for pico
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris030 committed Aug 6, 2024
1 parent c074417 commit aa2357f
Show file tree
Hide file tree
Showing 8 changed files with 35,997 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lessons/01.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<!-- For syntax highlighting -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
<!-- <link rel="stylesheet" href="reveal.js/plugin/highlight/monokai.css"> -->

<link rel="stylesheet" href="res/scrollbar.css">
</head>

<body>
Expand Down Expand Up @@ -266,13 +268,13 @@ <h2 data-id="title">Buzzer</h2>

<!-- Buzzer #3 -->
<section data-auto-animate data-auto-animate-id="buzzer">
<h2 data-id="title">Buzzer</h2>
<h2 data-id="title">PWM</h2>
<img src="res/01/sine.svg" alt="sine">
</section>

<!-- Buzzer #4 -->
<section data-auto-animate data-auto-animate-id="buzzer">
<h2 data-id="title">Buzzer</h2>
<h2 data-id="title">PWM</h2>
<img src="res/01/sine.svg" alt="sine">
<img src="res/01/square.svg" alt="square">
</section>
Expand Down
2 changes: 2 additions & 0 deletions lessons/02.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<!-- For syntax highlighting -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
<!-- <link rel="stylesheet" href="reveal.js/plugin/highlight/monokai.css"> -->

<link rel="stylesheet" href="res/scrollbar.css">
</head>

<body>
Expand Down
15 changes: 10 additions & 5 deletions lessons/03.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<!-- For syntax highlighting -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
<!-- <link rel="stylesheet" href="reveal.js/plugin/highlight/monokai.css"> -->

<link rel="stylesheet" href="res/scrollbar.css">
</head>

<body>
Expand Down Expand Up @@ -62,7 +64,7 @@ <h2>I²C</h2>
<section data-auto-animate data-auto-animate-id="i2c">
<h2>I²C</h2>
<pre data-id="code"><code data-trim data-noescape class="hljs python"
data-line-numbers="5-6|8-11|13-14|16-21|23-31|33-40|55-57|59-60|42-43|62-63|45-46|48-53|65-67">
data-line-numbers="5-6|8-11|13-14|16-21|23-31|33-40|57-60|62-63|42-44|65-66|50-55|46-48|68-70">
from machine import I2C, Pin
from time import sleep_ms
import struct
Expand Down Expand Up @@ -105,10 +107,12 @@ <h2>I²C</h2>
self.set_gain(gain)

def _write8(self, reg: int, value: int):
self._i2c.writeto_mem(self._addr, CMD_BIT | reg, (value & 0xFF).to_bytes(1, 'little'))
self._i2c.writeto_mem(self._addr, CMD_BIT | reg,
(value & 0xFF).to_bytes(1, 'little'))

def _read8(self, reg: int) -> int:
return struct.unpack('&lt;B', self._i2c.readfrom_mem(self._addr, CMD_BIT | reg, 1))[0]
return struct.unpack('&lt;B', self._i2c.readfrom_mem(
self._addr, CMD_BIT | reg, 1))[0]

def _write_bits(self, reg: int, value: int, mask: int):
old = self._read8(reg)
Expand All @@ -118,7 +122,8 @@ <h2>I²C</h2>
self._write8(reg, new)

def get_data(self) -> tuple[int, int, int, int]:
color_bytes = self._i2c.readfrom_mem(self._addr, CMD_BIT | REG_CDATAL, 4 * 2)
color_bytes = self._i2c.readfrom_mem(self._addr,
CMD_BIT | REG_CDATAL, 4 * 2)
return struct.unpack('&lt;HHHH', color_bytes)

def set_integration_time(self, it: int):
Expand All @@ -132,7 +137,7 @@ <h2>I²C</h2>
self._led_pin.value(state)
</code></pre>
</section>
2

<!-- <end> -->
<section>
<h2 style="font-family: monospace;">&lt;\&gt;</h2>
Expand Down
Binary file modified lessons/res/01/ca.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions lessons/res/scrollbar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
:root {
--sb-track-color: #232E33;
--sb-thumb-color: #6BAF8D;
--sb-size: 14px;
}

body::-webkit-scrollbar {
width: var(--sb-size)
}

body::-webkit-scrollbar-track {
background: var(--sb-track-color);
border-radius: 3px;
}

body::-webkit-scrollbar-thumb {
background: var(--sb-thumb-color);
border-radius: 3px;

}

@supports selector(::-webkit-scrollbar) {
body {
scrollbar-color: var(--sb-thumb-color) var(--sb-track-color);
}
}
Loading

0 comments on commit aa2357f

Please sign in to comment.