Skip to content

Commit 9242e2a

Browse files
authored
Split waveshare red/yellow drivers (#84)
1 parent 46f3ce9 commit 9242e2a

File tree

12 files changed

+507
-6
lines changed

12 files changed

+507
-6
lines changed

backend/app/tasks/deploy_frame.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,13 @@ def create_local_build_archive(frame: Frame, build_dir: str, build_id: str, nim_
317317
util_files = ["Debug.h", "DEV_Config.c", "DEV_Config.h"]
318318
for file in util_files:
319319
shutil.copy(os.path.join(source_dir, "src", "drivers", "waveshare", variant_folder, file), os.path.join(build_dir, file))
320-
variant_files = [f"{waveshare.variant}.nim", f"{waveshare.variant}.c", f"{waveshare.variant}.h"]
320+
321+
if waveshare.variant in ["EPD_2in9b", "EPD_2in9c", "EPD_2in13b", "EPD_2in13c", "EPD_4in2b", "EPD_4in2c", "EPD_5in83b", "EPD_5in83c", "EPD_7in5b", "EPD_7in5c"]:
322+
c_file = re.sub(r'[bc]', 'bc', waveshare.variant)
323+
variant_files = [f"{waveshare.variant}.nim", f"{c_file}.c", f"{c_file}.h"]
324+
else:
325+
variant_files = [f"{waveshare.variant}.nim", f"{waveshare.variant}.c", f"{waveshare.variant}.h"]
326+
321327
for file in variant_files:
322328
shutil.copy(os.path.join(source_dir, "src", "drivers", "waveshare", variant_folder, file), os.path.join(build_dir, file))
323329

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{.compile: "EPD_2in13bc.c".}
2+
## ***************************************************************************
3+
## | File : EPD_2in13bc.h
4+
## | Author : Waveshare team
5+
## | Function : 2.13inch e-paper b&c
6+
## | Info :
7+
## ----------------
8+
## | This version: V3.0
9+
## | Date : 2019-06-13
10+
## | Info :
11+
## -----------------------------------------------------------------------------
12+
## V3.0(2019-06-13):
13+
## 1.Change:
14+
## EPD_Reset() => EPD_2IN13BC_Reset()
15+
## EPD_SendCommand() => EPD_2IN13BC_SendCommand()
16+
## EPD_SendData() => EPD_2IN13BC_SendData()
17+
## EPD_WaitUntilIdle() => EPD_2IN13BC_ReadBusy()
18+
## EPD_Init() => EPD_2IN13BC_Init()
19+
## EPD_Clear() => EPD_2IN13BC_Clear()
20+
## EPD_Display() => EPD_2IN13BC_Display()
21+
## EPD_Sleep() => EPD_2IN13BC_Sleep()
22+
## 2.remove commands define:
23+
## #define PANEL_SETTING 0x00
24+
## #define POWER_SETTING 0x01
25+
## #define POWER_OFF 0x02
26+
## #define POWER_OFF_SEQUENCE_SETTING 0x03
27+
## #define POWER_ON 0x04
28+
## #define POWER_ON_MEASURE 0x05
29+
## #define BOOSTER_SOFT_START 0x06
30+
## #define DEEP_SLEEP 0x07
31+
## #define DATA_START_TRANSMISSION_1 0x10
32+
## #define DATA_STOP 0x11
33+
## #define DISPLAY_REFRESH 0x12
34+
## #define DATA_START_TRANSMISSION_2 0x13
35+
## #define VCOM_LUT 0x20
36+
## #define W2W_LUT 0x21
37+
## #define B2W_LUT 0x22
38+
## #define W2B_LUT 0x23
39+
## #define B2B_LUT 0x24
40+
## #define PLL_CONTROL 0x30
41+
## #define TEMPERATURE_SENSOR_CALIBRATION 0x40
42+
## #define TEMPERATURE_SENSOR_SELECTION 0x41
43+
## #define TEMPERATURE_SENSOR_WRITE 0x42
44+
## #define TEMPERATURE_SENSOR_READ 0x43
45+
## #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
46+
## #define LOW_POWER_DETECTION 0x51
47+
## #define TCON_SETTING 0x60
48+
## #define RESOLUTION_SETTING 0x61
49+
## #define GET_STATUS 0x71
50+
## #define AUTO_MEASURE_VCOM 0x80
51+
## #define READ_VCOM_VALUE 0x81
52+
## #define VCM_DC_SETTING 0x82
53+
## #define PARTIAL_WINDOW 0x90
54+
## #define PARTIAL_IN 0x91
55+
## #define PARTIAL_OUT 0x92
56+
## #define PROGRAM_MODE 0xA0
57+
## #define ACTIVE_PROGRAM 0xA1
58+
## #define READ_OTP_DATA 0xA2
59+
## #define POWER_SAVING 0xE3
60+
## V2.0(2018-11-13):
61+
## 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
62+
## 2.Change:EPD_Display(UBYTE *Image)
63+
## Need to pass parameters: pointer to cached data
64+
## #
65+
## # Permission is hereby granted, free of charge, to any person obtaining a copy
66+
## # of this software and associated documnetation files (the "Software"), to deal
67+
## # in the Software without restriction, including without limitation the rights
68+
## # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
69+
## # copies of the Software, and to permit persons to whom the Software is
70+
## # furished to do so, subject to the following conditions:
71+
## #
72+
## # The above copyright notice and this permission notice shall be included in
73+
## # all copies or substantial portions of the Software.
74+
## #
75+
## # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
76+
## # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77+
## # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
78+
## # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
79+
## # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
80+
## # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
81+
## # THE SOFTWARE.
82+
## #
83+
## ****************************************************************************
84+
85+
import
86+
DEV_Config
87+
88+
const
89+
EPD_2IN13BC_WIDTH* = 104
90+
EPD_2IN13BC_HEIGHT* = 212
91+
92+
proc EPD_2IN13BC_Init*() {.importc: "EPD_2IN13BC_Init".}
93+
proc EPD_2IN13BC_Clear*() {.importc: "EPD_2IN13BC_Clear".}
94+
proc EPD_2IN13BC_Display*(blackimage: ptr UBYTE; ryimage: ptr UBYTE) {.
95+
importc: "EPD_2IN13BC_Display".}
96+
proc EPD_2IN13BC_Sleep*() {.importc: "EPD_2IN13BC_Sleep".}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{.compile: "EPD_2in9bc.c".}
2+
## ***************************************************************************
3+
## | File : EPD_2in9bc.h
4+
## | Author : Waveshare team
5+
## | Function : 2.9inch e-paper b&c
6+
## | Info :
7+
## ----------------
8+
## | This version: V3.0
9+
## | Date : 2019-06-12
10+
## | Info :
11+
## -----------------------------------------------------------------------------
12+
## V3.0(2019-06-12):
13+
## 1.Change:
14+
## EPD_Reset() => EPD_2IN9BC_Reset()
15+
## EPD_SendCommand() => EPD_2IN9BC_SendCommand()
16+
## EPD_SendData() => EPD_2IN9BC_SendData()
17+
## EPD_WaitUntilIdle() => EPD_2IN9BC_ReadBusy()
18+
## EPD_Init() => EPD_2IN9BC_Init()
19+
## EPD_Clear() => EPD_2IN9BC_Clear()
20+
## EPD_Display() => EPD_2IN9BC_Display()
21+
## EPD_Sleep() => EPD_2IN9BC_Sleep()
22+
## 2.remove commands define:
23+
## #define PANEL_SETTING 0x00
24+
## #define POWER_SETTING 0x01
25+
## #define POWER_OFF 0x02
26+
## #define POWER_OFF_SEQUENCE_SETTING 0x03
27+
## #define POWER_ON 0x04
28+
## #define POWER_ON_MEASURE 0x05
29+
## #define BOOSTER_SOFT_START 0x06
30+
## #define DEEP_SLEEP 0x07
31+
## #define DATA_START_TRANSMISSION_1 0x10
32+
## #define DATA_STOP 0x11
33+
## #define DISPLAY_REFRESH 0x12
34+
## #define DATA_START_TRANSMISSION_2 0x13
35+
## #define PLL_CONTROL 0x30
36+
## #define TEMPERATURE_SENSOR_COMMAND 0x40
37+
## #define TEMPERATURE_SENSOR_CALIBRATION 0x41
38+
## #define TEMPERATURE_SENSOR_WRITE 0x42
39+
## #define TEMPERATURE_SENSOR_READ 0x43
40+
## #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
41+
## #define LOW_POWER_DETECTION 0x51
42+
## #define TCON_SETTING 0x60
43+
## #define TCON_RESOLUTION 0x61
44+
## #define GET_STATUS 0x71
45+
## #define AUTO_MEASURE_VCOM 0x80
46+
## #define VCOM_VALUE 0x81
47+
## #define VCM_DC_SETTING_REGISTER 0x82
48+
## #define PARTIAL_WINDOW 0x90
49+
## #define PARTIAL_IN 0x91
50+
## #define PARTIAL_OUT 0x92
51+
## #define PROGRAM_MODE 0xA0
52+
## #define ACTIVE_PROGRAM 0xA1
53+
## #define READ_OTP_DATA 0xA2
54+
## #define POWER_SAVING 0xE3
55+
## -----------------------------------------------------------------------------
56+
## V2.0(2018-11-06):
57+
## 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
58+
## 2.Change:EPD_Display(UBYTE *Image)
59+
## Need to pass parameters: pointer to cached data
60+
## 3.Change:
61+
## EPD_RST -> EPD_RST_PIN
62+
## EPD_DC -> EPD_DC_PIN
63+
## EPD_CS -> EPD_CS_PIN
64+
## EPD_BUSY -> EPD_BUSY_PIN
65+
## #
66+
## # Permission is hereby granted, free of charge, to any person obtaining a copy
67+
## # of this software and associated documnetation files (the "Software"), to deal
68+
## # in the Software without restriction, including without limitation the rights
69+
## # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
70+
## # copies of the Software, and to permit persons to whom the Software is
71+
## # furished to do so, subject to the following conditions:
72+
## #
73+
## # The above copyright notice and this permission notice shall be included in
74+
## # all copies or substantial portions of the Software.
75+
## #
76+
## # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77+
## # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78+
## # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79+
## # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80+
## # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
81+
## # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
82+
## # THE SOFTWARE.
83+
## #
84+
## ****************************************************************************
85+
86+
import
87+
DEV_Config
88+
89+
const
90+
EPD_2IN9BC_WIDTH* = 128
91+
EPD_2IN9BC_HEIGHT* = 296
92+
93+
proc EPD_2IN9BC_Init*() {.importc: "EPD_2IN9BC_Init".}
94+
proc EPD_2IN9BC_Clear*() {.importc: "EPD_2IN9BC_Clear".}
95+
proc EPD_2IN9BC_Display*(blackimage: ptr UBYTE; ryimage: ptr UBYTE) {.
96+
importc: "EPD_2IN9BC_Display".}
97+
proc EPD_2IN9BC_Sleep*() {.importc: "EPD_2IN9BC_Sleep".}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
{.compile: "EPD_4in2bc.c".}
2+
## ***************************************************************************
3+
## | File : EPD_4in2b.h
4+
## | Author : Waveshare team
5+
## | Function : 4.2inch e-paper b&c
6+
## | Info :
7+
## ----------------
8+
## | This version: V3.0
9+
## | Date : 2019-06-13
10+
## | Info :
11+
## -----------------------------------------------------------------------------
12+
## V3.0(2019-06-13):
13+
## 1.Change:
14+
## EPD_Reset() => EPD_4IN2BC_Reset()
15+
## EPD_SendCommand() => EPD_4IN2BC_SendCommand()
16+
## EPD_SendData() => EPD_4IN2BC_SendData()
17+
## EPD_WaitUntilIdle() => EPD_4IN2BC_ReadBusy()
18+
## EPD_Init() => EPD_4IN2BC_Init()
19+
## EPD_Clear() => EPD_4IN2BC_Clear()
20+
## EPD_Display() => EPD_4IN2BC_Display()
21+
## EPD_Sleep() => EPD_4IN2BC_Sleep()
22+
## 2.remove commands define:
23+
## #define PANEL_SETTING 0x00
24+
## #define POWER_SETTING 0x01
25+
## #define POWER_OFF 0x02
26+
## #define POWER_OFF_SEQUENCE_SETTING 0x03
27+
## #define POWER_ON 0x04
28+
## #define POWER_ON_MEASURE 0x05
29+
## #define BOOSTER_SOFT_START 0x06
30+
## #define DEEP_SLEEP 0x07
31+
## #define DATA_START_TRANSMISSION_1 0x10
32+
## #define DATA_STOP 0x11
33+
## #define DISPLAY_REFRESH 0x12
34+
## #define DATA_START_TRANSMISSION_2 0x13
35+
## #define VCOM_LUT 0x20
36+
## #define W2W_LUT 0x21
37+
## #define B2W_LUT 0x22
38+
## #define W2B_LUT 0x23
39+
## #define B2B_LUT 0x24
40+
## #define PLL_CONTROL 0x30
41+
## #define TEMPERATURE_SENSOR_CALIBRATION 0x40
42+
## #define TEMPERATURE_SENSOR_SELECTION 0x41
43+
## #define TEMPERATURE_SENSOR_WRITE 0x42
44+
## #define TEMPERATURE_SENSOR_READ 0x43
45+
## #define VCOM_AND_DATA_INTERVAL_SETTING 0x50
46+
## #define LOW_POWER_DETECTION 0x51
47+
## #define TCON_SETTING 0x60
48+
## #define RESOLUTION_SETTING 0x61
49+
## #define GET_STATUS 0x71
50+
## #define AUTO_MEASURE_VCOM 0x80
51+
## #define READ_VCOM_VALUE 0x81
52+
## #define VCM_DC_SETTING 0x82
53+
## #define PARTIAL_WINDOW 0x90
54+
## #define PARTIAL_IN 0x91
55+
## #define PARTIAL_OUT 0x92
56+
## #define PROGRAM_MODE 0xA0
57+
## #define ACTIVE_PROGRAM 0xA1
58+
## #define READ_OTP_DATA 0xA2
59+
## #define POWER_SAVING 0xE3
60+
## -----------------------------------------------------------------------------
61+
## V2.0(2018-11-09):
62+
## 1.Remove:ImageBuff[EPD_HEIGHT * EPD_WIDTH / 8]
63+
## 2.Change:EPD_Display(UBYTE *Image)
64+
## Need to pass parameters: pointer to cached data
65+
## #
66+
## # Permission is hereby granted, free of charge, to any person obtaining a copy
67+
## # of this software and associated documnetation files (the "Software"), to deal
68+
## # in the Software without restriction, including without limitation the rights
69+
## # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
70+
## # copies of the Software, and to permit persons to whom the Software is
71+
## # furished to do so, subject to the following conditions:
72+
## #
73+
## # The above copyright notice and this permission notice shall be included in
74+
## # all copies or substantial portions of the Software.
75+
## #
76+
## # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77+
## # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78+
## # FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79+
## # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80+
## # LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
81+
## # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
82+
## # THE SOFTWARE.
83+
## #
84+
## ****************************************************************************
85+
86+
import
87+
DEV_Config
88+
89+
const
90+
EPD_4IN2BC_WIDTH* = 400
91+
EPD_4IN2BC_HEIGHT* = 300
92+
93+
proc EPD_4IN2BC_Init*() {.importc: "EPD_4IN2BC_Init".}
94+
proc EPD_4IN2BC_Clear*() {.importc: "EPD_4IN2BC_Clear".}
95+
proc EPD_4IN2BC_Display*(blackimage: ptr UBYTE; ryimage: ptr UBYTE) {.
96+
importc: "EPD_4IN2BC_Display".}
97+
proc EPD_4IN2BC_Sleep*() {.importc: "EPD_4IN2BC_Sleep".}

0 commit comments

Comments
 (0)