no-OS
nhd_c12832a1z.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef __NHD_C12832A1Z_H__
41 #define __NHD_C12832A1Z_H__
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 
47 #include <stdint.h>
48 #include <stdlib.h>
49 #include "no_os_gpio.h"
50 
51 /******************************************************************************/
52 /********************** Macros and Constants Definitions **********************/
53 /******************************************************************************/
54 
55 #define NHD_C12832A1Z_RST_ON 0U
56 #define NHD_C12832A1Z_RST_OFF 1U
57 #define NHD_C12832A1Z_DC_DATA 1U
58 #define NHD_C12832A1Z_DC_CMD 0U
59 #define NHD_C12832A1Z_DISP_ON 0xAFU
60 #define NHD_C12832A1Z_DISP_OFF 0xAEU
61 #define NDH_C12832A1Z_ADC_NORMAL 0xA0U
62 #define NDH_C12832A1Z_ADC_REVERSE 0xA1U
63 #define NDH_C12832A1Z_COM_NORMAL 0xC0U
64 #define NDH_C12832A1Z_COM_REVERSE 0xC8U
65 #define NDH_C12832A1Z_LCD_BIAS 0xA2U
66 #define NDH_C12832A1Z_PWR_CTRL 0x2FU
67 #define NDH_C12832A1Z_RES_RATIO 0x21U
68 #define NDH_C12832A1Z_ELECTRIC_VOL 0x81U
69 #define NDH_C12832A1Z_ELECTRIC_VAL 0x20U
70 
71 #define NHD_C12832A1Z_REVERSE 0x1
72 #define NHD_C12832A1Z_BLINK 0x2
73 
74 #define NHD_C12832A1Z_BLINK_INTERVAL 500
75 
76 #define FB_FLUSH_DELAY 30
77 
78 #define NR_COLUMNS 128
79 #define NR_PAGES 4
80 #define NR_CHAR 64
81 #define PAGE_START_ADDR 0xB0
82 #define DISPLAY_START_OFFSET 0x40
83 
84 /******************************************************************************/
85 /*************************** Types Declarations *******************************/
86 /******************************************************************************/
87 
97  /* SPI descriptor*/
99 };
100 
110  /* SPI initial param */
112 };
113 
114 /******************************************************************************/
115 /************************ Functions Declarations ******************************/
116 /******************************************************************************/
117 
118 /* nhd_c12832a1z write command */
119 int nhd_c12832a1z_write_cmd(struct nhd_c12832a1z_dev *dev, uint8_t cmd);
120 
121 /* nhd_c12832a1z write data */
122 int nhd_c12832a1z_write_data(struct nhd_c12832a1z_dev *dev, uint8_t data);
123 
124 /* nhd_c12832a1z print string on LCD */
125 int nhd_c12832a1z_print_string(struct nhd_c12832a1z_dev *dev, char *msg);
126 
127 /* nhd_c12832a1z clear LCD */
129 
133 
135 int nhd_c12832a1z_remove(struct nhd_c12832a1z_dev *dev);
136 
137 #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:85
NHD_C12832A1Z_DC_CMD
#define NHD_C12832A1Z_DC_CMD
Definition: nhd_c12832a1z.h:58
NDH_C12832A1Z_PWR_CTRL
#define NDH_C12832A1Z_PWR_CTRL
Definition: nhd_c12832a1z.h:66
NHD_C12832A1Z_RST_ON
#define NHD_C12832A1Z_RST_ON
Definition: nhd_c12832a1z.h:55
nhd_c12832a1z_dev::reset_pin
struct no_os_gpio_desc * reset_pin
Definition: nhd_c12832a1z.h:96
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:165
nhd_c12832a1z_init_param
nhd_c12832a1z Initialization parameters.
Definition: nhd_c12832a1z.h:105
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:344
NHD_C12832A1Z_DISP_OFF
#define NHD_C12832A1Z_DISP_OFF
Definition: nhd_c12832a1z.h:60
NR_COLUMNS
#define NR_COLUMNS
Definition: nhd_c12832a1z.h:78
NHD_C12832A1Z_DC_DATA
#define NHD_C12832A1Z_DC_DATA
Definition: nhd_c12832a1z.h:57
NDH_C12832A1Z_COM_REVERSE
#define NDH_C12832A1Z_COM_REVERSE
Definition: nhd_c12832a1z.h:64
no_os_delay.h
Header file of Delay functions.
NHD_C12832A1Z_DISP_ON
#define NHD_C12832A1Z_DISP_ON
Definition: nhd_c12832a1z.h:59
device
Definition: ad9361_util.h:75
NDH_C12832A1Z_ELECTRIC_VAL
#define NDH_C12832A1Z_ELECTRIC_VAL
Definition: nhd_c12832a1z.h:69
NR_PAGES
#define NR_PAGES
Definition: nhd_c12832a1z.h:79
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:60
NDH_C12832A1Z_RES_RATIO
#define NDH_C12832A1Z_RES_RATIO
Definition: nhd_c12832a1z.h:67
no_os_error.h
Error codes definition.
NHD_C12832A1Z_RST_OFF
#define NHD_C12832A1Z_RST_OFF
Definition: nhd_c12832a1z.h:56
DISPLAY_START_OFFSET
#define DISPLAY_START_OFFSET
Definition: nhd_c12832a1z.h:82
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:473
nhd_c12832a1z_init_param::spi_ip
struct no_os_spi_init_param * spi_ip
Definition: nhd_c12832a1z.h:111
NDH_C12832A1Z_ADC_NORMAL
#define NDH_C12832A1Z_ADC_NORMAL
Definition: nhd_c12832a1z.h:61
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:364
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:110
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
nhd_c12832a1z_init_param::reset_pin_ip
struct no_os_gpio_init_param * reset_pin_ip
Definition: nhd_c12832a1z.h:109
PAGE_START_ADDR
#define PAGE_START_ADDR
Definition: nhd_c12832a1z.h:81
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:324
nhd_c12832a1z_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: nhd_c12832a1z.h:98
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
nhd_c12832a1z_dev
nhd_c12832a1z device structure.
Definition: nhd_c12832a1z.h:92
nhd_c12832a1z_clear_lcd
int nhd_c12832a1z_clear_lcd(struct nhd_c12832a1z_dev *dev)
nhd_c12832a1z clear LCD.
Definition: nhd_c12832a1z.c:428
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:55
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:473
NDH_C12832A1Z_ELECTRIC_VOL
#define NDH_C12832A1Z_ELECTRIC_VOL
Definition: nhd_c12832a1z.h:68
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:75
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:364
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:344
nhd_c12832a1z_remove
int nhd_c12832a1z_remove(struct nhd_c12832a1z_dev *dev)
nhd_c12832a1z remove allocated resources
Definition: nhd_c12832a1z.c:568
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:120
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:203
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
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:324
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:122
nhd_c12832a1z_init_param::dc_pin_ip
struct no_os_gpio_init_param * dc_pin_ip
Definition: nhd_c12832a1z.h:107
no_os_gpio.h
Header file of GPIO Interface.
NR_CHAR
#define NR_CHAR
Definition: nhd_c12832a1z.h:80
nhd_c12832a1z_clear_lcd
int nhd_c12832a1z_clear_lcd(struct nhd_c12832a1z_dev *dev)
nhd_c12832a1z clear LCD.
Definition: nhd_c12832a1z.c:428
NDH_C12832A1Z_LCD_BIAS
#define NDH_C12832A1Z_LCD_BIAS
Definition: nhd_c12832a1z.h:65
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:58
nhd_c12832a1z_dev::dc_pin
struct no_os_gpio_desc * dc_pin
Definition: nhd_c12832a1z.h:94
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:153
nhd_c12832a1z_remove
int nhd_c12832a1z_remove(struct nhd_c12832a1z_dev *dev)
nhd_c12832a1z remove allocated resources
Definition: nhd_c12832a1z.c:568
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
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:81