no-OS
nhd_c12832a1z.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef __NHD_C12832A1Z_H__
35 #define __NHD_C12832A1Z_H__
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 
41 #include <stdint.h>
42 #include <stdlib.h>
43 #include "no_os_gpio.h"
44 
45 /******************************************************************************/
46 /********************** Macros and Constants Definitions **********************/
47 /******************************************************************************/
48 
49 #define NHD_C12832A1Z_RST_ON 0U
50 #define NHD_C12832A1Z_RST_OFF 1U
51 #define NHD_C12832A1Z_DC_DATA 1U
52 #define NHD_C12832A1Z_DC_CMD 0U
53 #define NHD_C12832A1Z_DISP_ON 0xAFU
54 #define NHD_C12832A1Z_DISP_OFF 0xAEU
55 #define NDH_C12832A1Z_ADC_NORMAL 0xA0U
56 #define NDH_C12832A1Z_ADC_REVERSE 0xA1U
57 #define NDH_C12832A1Z_COM_NORMAL 0xC0U
58 #define NDH_C12832A1Z_COM_REVERSE 0xC8U
59 #define NDH_C12832A1Z_LCD_BIAS 0xA2U
60 #define NDH_C12832A1Z_PWR_CTRL 0x2FU
61 #define NDH_C12832A1Z_RES_RATIO 0x21U
62 #define NDH_C12832A1Z_ELECTRIC_VOL 0x81U
63 #define NDH_C12832A1Z_ELECTRIC_VAL 0x20U
64 
65 #define NHD_C12832A1Z_REVERSE 0x1
66 #define NHD_C12832A1Z_BLINK 0x2
67 
68 #define NHD_C12832A1Z_BLINK_INTERVAL 500
69 
70 #define FB_FLUSH_DELAY 30
71 
72 #define NR_COLUMNS 128
73 #define NR_PAGES 4
74 #define NR_CHAR 64
75 #define PAGE_START_ADDR 0xB0
76 #define DISPLAY_START_OFFSET 0x40
77 
78 /******************************************************************************/
79 /*************************** Types Declarations *******************************/
80 /******************************************************************************/
81 
91  /* SPI descriptor*/
93 };
94 
104  /* SPI initial param */
106 };
107 
108 /******************************************************************************/
109 /************************ Functions Declarations ******************************/
110 /******************************************************************************/
111 
112 /* nhd_c12832a1z write command */
113 int nhd_c12832a1z_write_cmd(struct nhd_c12832a1z_dev *dev, uint8_t cmd);
114 
115 /* nhd_c12832a1z write data */
116 int nhd_c12832a1z_write_data(struct nhd_c12832a1z_dev *dev, uint8_t data);
117 
118 /* nhd_c12832a1z print string on LCD */
119 int nhd_c12832a1z_print_string(struct nhd_c12832a1z_dev *dev, char *msg);
120 
121 /* nhd_c12832a1z clear LCD */
123 
127 
129 int nhd_c12832a1z_remove(struct nhd_c12832a1z_dev *dev);
130 
131 #endif //__NHD_C12832A1Z_H__
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
NHD_C12832A1Z_DC_CMD
#define NHD_C12832A1Z_DC_CMD
Definition: nhd_c12832a1z.h:52
NDH_C12832A1Z_PWR_CTRL
#define NDH_C12832A1Z_PWR_CTRL
Definition: nhd_c12832a1z.h:60
NHD_C12832A1Z_RST_ON
#define NHD_C12832A1Z_RST_ON
Definition: nhd_c12832a1z.h:49
nhd_c12832a1z_dev::reset_pin
struct no_os_gpio_desc * reset_pin
Definition: nhd_c12832a1z.h:90
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
nhd_c12832a1z_init_param
nhd_c12832a1z Initialization parameters.
Definition: nhd_c12832a1z.h:99
no_os_spi.h
Header file of SPI Interface.
nhd_c12832a1z.h
Header file of nhd_c12832a1z.
nhd_c12832a1z_write_data
int nhd_c12832a1z_write_data(struct nhd_c12832a1z_dev *dev, uint8_t data)
nhd_c12832a1z write data.
Definition: nhd_c12832a1z.c:338
NHD_C12832A1Z_DISP_OFF
#define NHD_C12832A1Z_DISP_OFF
Definition: nhd_c12832a1z.h:54
NR_COLUMNS
#define NR_COLUMNS
Definition: nhd_c12832a1z.h:72
NHD_C12832A1Z_DC_DATA
#define NHD_C12832A1Z_DC_DATA
Definition: nhd_c12832a1z.h:51
NDH_C12832A1Z_COM_REVERSE
#define NDH_C12832A1Z_COM_REVERSE
Definition: nhd_c12832a1z.h:58
no_os_delay.h
Header file of Delay functions.
NHD_C12832A1Z_DISP_ON
#define NHD_C12832A1Z_DISP_ON
Definition: nhd_c12832a1z.h:53
device
Definition: ad9361_util.h:69
NDH_C12832A1Z_ELECTRIC_VAL
#define NDH_C12832A1Z_ELECTRIC_VAL
Definition: nhd_c12832a1z.h:63
NR_PAGES
#define NR_PAGES
Definition: nhd_c12832a1z.h:73
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
NDH_C12832A1Z_RES_RATIO
#define NDH_C12832A1Z_RES_RATIO
Definition: nhd_c12832a1z.h:61
no_os_error.h
Error codes definition.
NHD_C12832A1Z_RST_OFF
#define NHD_C12832A1Z_RST_OFF
Definition: nhd_c12832a1z.h:50
DISPLAY_START_OFFSET
#define DISPLAY_START_OFFSET
Definition: nhd_c12832a1z.h:76
nhd_c12832a1z_init
int nhd_c12832a1z_init(struct nhd_c12832a1z_dev **device, struct nhd_c12832a1z_init_param init_param)
Initializes nhd_c12832a1z for display screening.
Definition: nhd_c12832a1z.c:467
nhd_c12832a1z_init_param::spi_ip
struct no_os_spi_init_param * spi_ip
Definition: nhd_c12832a1z.h:105
NDH_C12832A1Z_ADC_NORMAL
#define NDH_C12832A1Z_ADC_NORMAL
Definition: nhd_c12832a1z.h:55
nhd_c12832a1z_print_string
int nhd_c12832a1z_print_string(struct nhd_c12832a1z_dev *dev, char *msg)
nhd_c12832a1z print string on LCD.
Definition: nhd_c12832a1z.c:358
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
nhd_c12832a1z_init_param::reset_pin_ip
struct no_os_gpio_init_param * reset_pin_ip
Definition: nhd_c12832a1z.h:103
PAGE_START_ADDR
#define PAGE_START_ADDR
Definition: nhd_c12832a1z.h:75
nhd_c12832a1z_write_cmd
int nhd_c12832a1z_write_cmd(struct nhd_c12832a1z_dev *dev, uint8_t cmd)
nhd_c12832a1z write command.
Definition: nhd_c12832a1z.c:318
nhd_c12832a1z_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: nhd_c12832a1z.h:92
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
nhd_c12832a1z_dev
nhd_c12832a1z device structure.
Definition: nhd_c12832a1z.h:86
nhd_c12832a1z_clear_lcd
int nhd_c12832a1z_clear_lcd(struct nhd_c12832a1z_dev *dev)
nhd_c12832a1z clear LCD.
Definition: nhd_c12832a1z.c:422
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
nhd_c12832a1z_init
int nhd_c12832a1z_init(struct nhd_c12832a1z_dev **device, struct nhd_c12832a1z_init_param init_param)
Initializes nhd_c12832a1z for display screening.
Definition: nhd_c12832a1z.c:467
NDH_C12832A1Z_ELECTRIC_VOL
#define NDH_C12832A1Z_ELECTRIC_VOL
Definition: nhd_c12832a1z.h:62
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
nhd_c12832a1z_print_string
int nhd_c12832a1z_print_string(struct nhd_c12832a1z_dev *dev, char *msg)
nhd_c12832a1z print string on LCD.
Definition: nhd_c12832a1z.c:358
nhd_c12832a1z_write_data
int nhd_c12832a1z_write_data(struct nhd_c12832a1z_dev *dev, uint8_t data)
nhd_c12832a1z write data.
Definition: nhd_c12832a1z.c:338
nhd_c12832a1z_remove
int nhd_c12832a1z_remove(struct nhd_c12832a1z_dev *dev)
nhd_c12832a1z remove allocated resources
Definition: nhd_c12832a1z.c:562
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
nhd_c12832a1z_write_cmd
int nhd_c12832a1z_write_cmd(struct nhd_c12832a1z_dev *dev, uint8_t cmd)
nhd_c12832a1z write command.
Definition: nhd_c12832a1z.c:318
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
nhd_c12832a1z_init_param::dc_pin_ip
struct no_os_gpio_init_param * dc_pin_ip
Definition: nhd_c12832a1z.h:101
no_os_gpio.h
Header file of GPIO Interface.
NR_CHAR
#define NR_CHAR
Definition: nhd_c12832a1z.h:74
nhd_c12832a1z_clear_lcd
int nhd_c12832a1z_clear_lcd(struct nhd_c12832a1z_dev *dev)
nhd_c12832a1z clear LCD.
Definition: nhd_c12832a1z.c:422
NDH_C12832A1Z_LCD_BIAS
#define NDH_C12832A1Z_LCD_BIAS
Definition: nhd_c12832a1z.h:59
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
nhd_c12832a1z_dev::dc_pin
struct no_os_gpio_desc * dc_pin
Definition: nhd_c12832a1z.h:88
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
nhd_c12832a1z_remove
int nhd_c12832a1z_remove(struct nhd_c12832a1z_dev *dev)
nhd_c12832a1z remove allocated resources
Definition: nhd_c12832a1z.c:562
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75