Skip to content
Snippets Groups Projects
Commit 663c22a6 authored by q3k's avatar q3k
Browse files

code style

parent 5f851420
Branches
No related tags found
No related merge requests found
Pipeline #1553 passed
......@@ -127,7 +127,7 @@ int epic_disp_update()
struct disp_framebuffer *epic_disp_framebuffer()
{
return (struct disp_framebuffer*)LCD_Framebuffer();
return (struct disp_framebuffer *)LCD_Framebuffer();
}
int epic_disp_open()
......
/*****************************************************************************
* | File : DEV_Config.c
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V1.0
* | Date : 2018-11-22
* | Info :
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "DEV_Config.h"
#include "spi.h"
#define SPI SPI2
//const gpio_cfg_t DEV_CS_PIN = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
//const gpio_cfg_t DEV_BL_PIN = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
static spi_req_t req = {.rx_data = NULL, .bits=8, .width = SPI17Y_WIDTH_1, .ssel = 0, .deass = 1, .ssel_pol = SPI17Y_POL_LOW, .tx_num = 0, .rx_num = 0};
/********************************************************************************/
void lcd_write_async(uint8_t *data, int size, lcd_write_cb_t wr_callback)
{
req.tx_data = data;
req.len = size;
req.callback = wr_callback;
SPI_MasterTransAsync(SPI, &req);
}
void lcd_write(uint8_t *data, int size)
{
req.tx_data = data;
req.len = size;
SPI_MasterTrans(SPI, &req);
}
void lcd_irq_init(void)
{
NVIC_EnableIRQ(SPI2_IRQn);
}
void SPI2_IRQHandler(void)
{
SPI_Handler(SPI);
}
/*****************************************************************************
* | File : DEV_Config.c
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V1.0
* | Date : 2018-11-22
* | Info :
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#include "DEV_Config.h"
#include "spi.h"
#define SPI SPI2
//const gpio_cfg_t DEV_CS_PIN = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
//const gpio_cfg_t DEV_BL_PIN = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
static spi_req_t req = { .rx_data = NULL,
.bits = 8,
.width = SPI17Y_WIDTH_1,
.ssel = 0,
.deass = 1,
.ssel_pol = SPI17Y_POL_LOW,
.tx_num = 0,
.rx_num = 0 };
/********************************************************************************/
void lcd_write_async(uint8_t *data, int size, lcd_write_cb_t wr_callback)
{
req.tx_data = data;
req.len = size;
req.callback = wr_callback;
SPI_MasterTransAsync(SPI, &req);
}
void lcd_write(uint8_t *data, int size)
{
req.tx_data = data;
req.len = size;
SPI_MasterTrans(SPI, &req);
}
void lcd_irq_init(void)
{
NVIC_EnableIRQ(SPI2_IRQn);
}
void SPI2_IRQHandler(void)
{
SPI_Handler(SPI);
}
......@@ -37,12 +37,12 @@ static uint8_t update_in_progress;
static inline frame_t *frame(void)
{
return &frames[active_frame];
return &frames[active_frame];
}
static void update_cb(void *spi_req, int error_code)
{
update_in_progress = 0;
update_in_progress = 0;
}
/*******************************************************************************
......@@ -322,20 +322,21 @@ static void LCD_Set(uint8_t *data, int len)
{
LCD_SetCursor(0, 0, 160 - 1, 80 - 1);
DEV_Digital_Write(DEV_DC_PIN, 1);
update_in_progress = 1;
lcd_write_async(data, len, update_cb);
update_in_progress = 1;
lcd_write_async(data, len, update_cb);
}
int LCD_Update(void)
{
if (update_in_progress)
return 1;
if (update_in_progress)
return 1;
LCD_Set(frame()->raw, FRAME_SIZE);
active_frame = !active_frame;
return 0;
LCD_Set(frame()->raw, FRAME_SIZE);
active_frame = !active_frame;
return 0;
}
frame_t *LCD_Framebuffer(void) {
frame_t *LCD_Framebuffer(void)
{
return frame();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment