Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
sif_il3820.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, Cascoda Ltd.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
36 #ifndef SIF_SIF_IL3820_H
37 #define SIF_SIF_IL3820_H
38 
39 #include <stdint.h>
40 #include "ca821x_error.h"
41 #include "cascoda_chili_config.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 #ifndef CASCODA_CHILI2_CONFIG
48 #error CASCODA_CHILI2_CONFIG has to be defined! Please include the file "cascoda_chili_config.h"
49 #endif
50 
51 /***********************************************************/
52 /********************* Pin connections *********************/
53 /***********************************************************/
54 /*
55  Pin config for M2351:
56  |---+- BUSY - Pin 31 (GPIO PB.5)
57  |---+- RST - Pin 15 (GPIO PA.15) on Chili2D, Pin 5 (GPIO PB.12) on Devboard
58  |---+- DC - Pin 34 (GPIO PB.2)
59  |---+- CS - GND
60  |---+- CLK - Pin 33 (GPIO PB.3)
61  |---+- DIN - Pin 32 (GPIO PB.4)
62  |---+- GND - (Pins 3/14/16/18-25/27/30)
63  |---+- VCC - Pin 13
64 
65 */
66 
67 /* Pin configuration */
68 #define SIF_IL3820_BUSY_PIN 31
69 
70 #if (CASCODA_CHILI2_CONFIG == 2)
71 #define SIF_IL3820_RST_PIN 5
72 #else
73 #define SIF_IL3820_RST_PIN 15
74 #endif
75 
76 #define SIF_IL3820_DC_PIN 34
77 //#define SIF_IL3820_CS_PIN 34
78 
79 /* BUSY Timeout in [ms] */
80 #define SIF_IL3820_BUSY_TIMEOUT 5000
81 
82 /* Display resolution */
83 #define SIF_IL3820_WIDTH 128
84 #define SIF_IL3820_HEIGHT 296
85 
86 /* QR code image array size */
87 #define ARRAY_SIZE (SIF_IL3820_HEIGHT * SIF_IL3820_WIDTH / 8)
88 
89 /* Display update mode */
90 typedef enum
91 {
95 
96 /* Clear or no clear */
97 typedef enum
98 {
102 
103 /* functions */
104 
105 /******************************************************************************/
106 /***************************************************************************/
112 
113 /******************************************************************************/
114 /***************************************************************************/
118 void SIF_IL3820_Deinitialise(void);
119 
120 /******************************************************************************/
121 /***************************************************************************/
125 void SIF_IL3820_ClearDisplay(void);
126 
127 /******************************************************************************/
128 /***************************************************************************/
133 
134 /******************************************************************************/
135 /***************************************************************************/
139 void SIF_IL3820_DeepSleep(void);
140 
141 /******************************************************************************/
142 /***************************************************************************/
153 ca_error SIF_IL3820_overlay_qr_code(const char *text, uint8_t *image, uint8_t scale, uint8_t x, uint8_t y);
154 
155 /******************************************************************************/
156 /***************************************************************************/
164 void SIF_IL3820_DisplayImage(const uint8_t *image, SIF_IL3820_Clear_Mode mode);
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
174 #endif
175 // SIF_SIF_IL3820_H
Global error declarations for use across the Cascoda SDK.
void SIF_IL3820_StrongClearDisplay(void)
Clears the display many times to make sure there is no ghost image.
Definition: sif_il3820.c:415
SIF_IL3820_Clear_Mode
Definition: sif_il3820.h:98
void SIF_IL3820_DisplayImage(const uint8_t *image, SIF_IL3820_Clear_Mode mode)
Follows Routines for clearing, waiting and displaying the image.
Definition: sif_il3820.c:447
ca_error SIF_IL3820_overlay_qr_code(const char *text, uint8_t *image, uint8_t scale, uint8_t x, uint8_t y)
Creates a QR code and overlays it on top of a pre-existing image at the given coordinates.
Definition: sif_il3820.c:430
SIF_IL3820_Update_Mode
Definition: sif_il3820.h:91
void SIF_IL3820_Deinitialise(void)
EINK De-Initialisation.
Definition: sif_il3820.c:348
void SIF_IL3820_ClearDisplay(void)
Clears the display.
Definition: sif_il3820.c:392
ca_error SIF_IL3820_Initialise(SIF_IL3820_Update_Mode mode)
EINK Initialisation.
Definition: sif_il3820.c:313
void SIF_IL3820_DeepSleep(void)
Enter deep sleep mode.
Definition: sif_il3820.c:422
@ WITH_CLEAR
Definition: sif_il3820.h:99
@ WITHOUT_CLEAR
Definition: sif_il3820.h:100
@ PARTIAL_UPDATE
Definition: sif_il3820.h:93
@ FULL_UPDATE
Definition: sif_il3820.h:92
ca_error
Cascoda error type.
Definition: ca821x_error.h:51