1
0
Fork 0

Adds P8 smart watch

Signed-off-by: Steve Amor <steveamor@users.noreply.github.com>
wasp-os
SteveAmor 2020-05-09 17:34:11 +01:00 committed by Daniel Thompson
parent 71f37dd5b2
commit 9148e76c41
3 changed files with 137 additions and 2 deletions

View File

@ -634,6 +634,75 @@ void st7789_state(int state)
uint8_t linebuffer[2*240]; uint8_t linebuffer[2*240];
#ifdef _P8_NRF52832_H
// 1-bit RLE, generated from p8dfu.png, 767 bytes
static const uint8_t rle[] = {
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0x9c, 0x8, 0x8, 0x3,
0x2b, 0x3, 0xac, 0xd, 0x6, 0x3, 0x2b, 0x3, 0xab, 0xe, 0x6, 0x3,
0x2b, 0x3, 0xab, 0x4, 0x8, 0x2, 0x6, 0x3, 0x2b, 0x3, 0xaa, 0x4,
0x11, 0x3, 0x2b, 0x3, 0xaa, 0x3, 0x10, 0xb, 0x6, 0x7, 0xb, 0x3,
0x3, 0x4, 0x1, 0xb, 0xa4, 0x3, 0x10, 0xb, 0x4, 0xb, 0x9, 0x3,
0x1, 0x6, 0x1, 0xb, 0xa4, 0x3, 0x10, 0xb, 0x4, 0xc, 0x8, 0xa,
0x1, 0xb, 0xa4, 0x4, 0x11, 0x3, 0xa, 0x2, 0x7, 0x4, 0x7, 0x6,
0x7, 0x3, 0xab, 0x5, 0xf, 0x3, 0x14, 0x3, 0x7, 0x4, 0x9, 0x3,
0xac, 0x9, 0xa, 0x3, 0x15, 0x3, 0x6, 0x4, 0x9, 0x3, 0xad, 0xa,
0x8, 0x3, 0x15, 0x3, 0x6, 0x3, 0xa, 0x3, 0xb0, 0x8, 0x7, 0x3,
0xd, 0xb, 0x6, 0x3, 0xa, 0x3, 0xb4, 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, 0x0, 0xff, 0x0, 0xff, 0x0,
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0x85,
};
#else
// 1-bit RLE, generated from res/pinedfu.png, 1085 bytes // 1-bit RLE, generated from res/pinedfu.png, 1085 bytes
const uint8_t rle[] = { const uint8_t rle[] = {
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
@ -728,6 +797,7 @@ void st7789_state(int state)
0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0, 0xff, 0x0,
0xff, 0x0, 0xff, 0x0, 0x85, 0xff, 0x0, 0xff, 0x0, 0x85,
}; };
#endif
// draw 240 x 240 // draw 240 x 240
st7789_send(CASET, (uint8_t *) "\x00\x00\x00\xef", 4); st7789_send(CASET, (uint8_t *) "\x00\x00\x00\xef", 4);
@ -751,10 +821,15 @@ void st7789_state(int state)
if (bp >= sizeof(linebuffer)) { if (bp >= sizeof(linebuffer)) {
/* currently we have a single image which we clip to show different modes */ /* currently we have a single image which we clip to show different modes */
if (topclip) { if (topclip) {
if (y < 48) if (y < 48) {
memset(linebuffer, 0, sizeof(linebuffer)); memset(linebuffer, 0, sizeof(linebuffer));
else } else if (y < 76) {
#ifdef BUTTON_ON_RIGHT
memset(linebuffer+2*(240-54), 0, 54*2);
#else
memset(linebuffer, 0, 64*2); memset(linebuffer, 0, 64*2);
#endif
}
} }
if (bottomclip) { if (bottomclip) {
memset(linebuffer+2*(240-64), 0, 64*2); memset(linebuffer+2*(240-64), 0, 64*2);

View File

@ -0,0 +1,58 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2018 Ha Thach for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation 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
* furnished 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 FOR 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.
*/
#ifndef _P8_NRF52832_H
#define _P8_NRF52832_H
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 0
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 1
#define BUTTON_1 17
#define BUTTON_PULL NRF_GPIO_PIN_NOPULL
#define BUTTON_ACTIVE 1
#define BUTTON_ON_RIGHT
/*------------------------------------------------------------------*/
/* UART
*------------------------------------------------------------------*/
#define RX_PIN_NUMBER 15 /* not connected */
#define TX_PIN_NUMBER 11
#define CTS_PIN_NUMBER 0
#define RTS_PIN_NUMBER 0
#define HWFC false
#define ST7789_SPI_DISPLAY
// Used as model string in OTA mode
#define BLEDIS_MANUFACTURER "COLMI P8"
#define BLEDIS_MODEL "P8"
#define BLEDIS_DEVICE_NAME "P8DFU"
#endif // _P8_NRF52832_H

View File

@ -0,0 +1,2 @@
# nrf52 is nrf52832
MCU_SUB_VARIANT = nrf52