diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/BlinkApp/BlinkApp.cpp | 4 | ||||
| -rw-r--r-- | src/drivers/st7789.cpp | 5 | ||||
| -rw-r--r-- | src/drivers/st7789.h | 14 | ||||
| -rw-r--r-- | src/main.cpp | 26 | ||||
| -rw-r--r-- | src/sdk_config.h | 126 |
5 files changed, 163 insertions, 12 deletions
diff --git a/src/BlinkApp/BlinkApp.cpp b/src/BlinkApp/BlinkApp.cpp index 544cd34..2eac9d8 100644 --- a/src/BlinkApp/BlinkApp.cpp +++ b/src/BlinkApp/BlinkApp.cpp @@ -17,7 +17,9 @@ void BlinkApp::Process(void *instance) { NRF_LOG_INFO("BlinkApp task started!"); while (1) { NRF_LOG_INFO("BlinkApp task running!"); - bsp_board_led_invert(0); +// nrf_gpio_pin_toggle(22); +// nrf_gpio_pin_toggle(23); +// nrf_gpio_pin_toggle(14); vTaskDelay(1000); } } diff --git a/src/drivers/st7789.cpp b/src/drivers/st7789.cpp new file mode 100644 index 0000000..6e2fb68 --- /dev/null +++ b/src/drivers/st7789.cpp @@ -0,0 +1,5 @@ +// +// Created by jf on 12/2/19. +// + +#include "st7789.h" diff --git a/src/drivers/st7789.h b/src/drivers/st7789.h new file mode 100644 index 0000000..dc3f083 --- /dev/null +++ b/src/drivers/st7789.h @@ -0,0 +1,14 @@ +// +// Created by jf on 12/2/19. +// + +#ifndef PINETIME_ST7789_H +#define PINETIME_ST7789_H + + +class st7789 { + +}; + + +#endif //PINETIME_ST7789_H diff --git a/src/main.cpp b/src/main.cpp index 9ce22d3..c04cc84 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,8 @@ #include <legacy/nrf_drv_clock.h> #include <libraries/timer/app_timer.h> #include <libraries/gpiote/app_gpiote.h> +#include <libraries/gfx/nrf_lcd.h> +#include "nrf_gfx.h" #if NRF_LOG_ENABLED @@ -43,6 +45,25 @@ static void bsp_event_handler(bsp_event_t event) } } +extern const nrf_lcd_t nrf_lcd_st7735; +static nrf_lcd_t const * p_lcd = &nrf_lcd_st7735; +static void gfx_initialization(void) +{ + nrf_gpio_cfg_output(14); + nrf_gpio_cfg_output(22); + nrf_gpio_cfg_output(23); + nrf_gpio_pin_clear(14); + nrf_gpio_pin_set(22); + nrf_gpio_pin_set(23); + + APP_ERROR_CHECK(nrf_gfx_init(p_lcd)); + nrf_gfx_rect_t rect; + rect.height = 10; + rect.width = 10; + rect.x = 10; + rect.y = 10; + nrf_gfx_rect_draw(p_lcd, &rect, 2, 0xffffffff, true); +} void SystemTask(void *) { APP_GPIOTE_INIT(2); @@ -51,6 +72,9 @@ void SystemTask(void *) { bsp_board_init(BSP_INIT_LEDS|BSP_INIT_BUTTONS); bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS, bsp_event_handler); + gfx_initialization(); + + blinkApp.Start(); while (1) { @@ -58,6 +82,8 @@ void SystemTask(void *) { } } + + int main(void) { logger.Init(); nrf_drv_clock_init(); diff --git a/src/sdk_config.h b/src/sdk_config.h index 90c3744..46a4094 100644 --- a/src/sdk_config.h +++ b/src/sdk_config.h @@ -4384,13 +4384,13 @@ // <e> NRFX_SPIM_ENABLED - nrfx_spim - SPIM peripheral driver //========================================================== #ifndef NRFX_SPIM_ENABLED -#define NRFX_SPIM_ENABLED 0 +#define NRFX_SPIM_ENABLED 1 #endif // <q> NRFX_SPIM0_ENABLED - Enable SPIM0 instance - + #ifndef NRFX_SPIM0_ENABLED -#define NRFX_SPIM0_ENABLED 0 +#define NRFX_SPIM0_ENABLED 1 #endif // <q> NRFX_SPIM1_ENABLED - Enable SPIM1 instance @@ -4435,7 +4435,7 @@ // <e> NRFX_SPIM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_SPIM_CONFIG_LOG_ENABLED -#define NRFX_SPIM_CONFIG_LOG_ENABLED 0 +#define NRFX_SPIM_CONFIG_LOG_ENABLED 1 #endif // <o> NRFX_SPIM_CONFIG_LOG_LEVEL - Default Severity level @@ -4575,7 +4575,7 @@ // <0=> Default // <1=> Black -// <2=> Red +// <2=> Red < // <3=> Green // <4=> Yellow // <5=> Blue @@ -6456,7 +6456,7 @@ // <e> SPI_ENABLED - nrf_drv_spi - SPI/SPIM peripheral driver - legacy layer //========================================================== #ifndef SPI_ENABLED -#define SPI_ENABLED 0 +#define SPI_ENABLED 1 #endif // <o> SPI_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority @@ -6488,7 +6488,7 @@ // <e> SPI0_ENABLED - Enable SPI0 instance //========================================================== #ifndef SPI0_ENABLED -#define SPI0_ENABLED 0 +#define SPI0_ENABLED 1 #endif // <q> SPI0_USE_EASY_DMA - Use EasyDMA @@ -8142,7 +8142,11 @@ #ifndef NRF_GFX_ENABLED -#define NRF_GFX_ENABLED 0 +#define NRF_GFX_ENABLED 1 +#endif + +#ifndef ST7735_ENABLED +#define ST7735_ENABLED 1 #endif // <q> NRF_MEMOBJ_ENABLED - nrf_memobj - Linked memory allocator module @@ -9617,7 +9621,7 @@ // <e> SPI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef SPI_CONFIG_LOG_ENABLED -#define SPI_CONFIG_LOG_ENABLED 0 +#define SPI_CONFIG_LOG_ENABLED 1 #endif // <o> SPI_CONFIG_LOG_LEVEL - Default Severity level @@ -12933,6 +12937,106 @@ #endif -// <<< end of configuration section >>> -#endif //SDK_CONFIG_H + +// <o> ST7735_SCK_PIN - Pin number <0-47> + + +#ifndef ST7735_SCK_PIN +#define ST7735_SCK_PIN 2 +#endif + +// <o> ST7735_MISO_PIN - Pin number <0-47> + + +#ifndef ST7735_MISO_PIN +#define ST7735_MISO_PIN 4 +#endif + +// <o> ST7735_MOSI_PIN - Pin number <0-47> + + +#ifndef ST7735_MOSI_PIN +#define ST7735_MOSI_PIN 3 +#endif + +// <o> ST7735_SS_PIN - Pin number <0-47> + + +#ifndef ST7735_SS_PIN +#define ST7735_SS_PIN 25 +#endif + +// <o> ST7735_IRQ_PRIORITY - Interrupt priority + + +// <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 + +#ifndef ST7735_IRQ_PRIORITY +#define ST7735_IRQ_PRIORITY 3 +#endif + +// </h> +//========================================================== + + +// <o> ST7735_SPI_INSTANCE + +// <0=> 0 +// <1=> 1 +// <2=> 2 + +#ifndef ST7735_SPI_INSTANCE +#define ST7735_SPI_INSTANCE 0 +#endif + +#ifndef ST7735_SPI_MODE +#define ST7735_SPI_MODE 3 +#endif + +#ifndef ST7735_SPI_FREQUENCY +#define ST7735_SPI_FREQUENCY 8000000 +#endif + +// <o> ST7735_TAB_COLOR - Color of the tab attached to the screen. + +// <0=> INITR_GREENTAB +// <1=> INITR_REDTAB +// <2=> INITR_BLACKTAB +// <3=> INITR_144GREENTAB + +#ifndef ST7735_TAB_COLOR +#define ST7735_TAB_COLOR 2 +#endif + +// <o> ST7735_DC_PIN - Pin number <0-47> + + +#ifndef ST7735_DC_PIN +#define ST7735_DC_PIN 18 +#endif + +// <o> ST7735_HEIGHT - ST7735 height <0-162> + + +#ifndef ST7735_HEIGHT +#define ST7735_HEIGHT 160 +#endif + +// <o> ST7735_WIDTH - ST7735 width <0-132> + + +#ifndef ST7735_WIDTH +#define ST7735_WIDTH 128 +#endif + +// <<< end of configuration section >>> +#endif //SDK_CONFIG_H
\ No newline at end of file |
