mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Merge branch 'STM32F4LCD' into STM32F4LCD_oldfatfs
This commit is contained in:
commit
2bdea5c15e
@ -21,19 +21,21 @@ info = {
|
||||
'binary_name' : 'espruino',
|
||||
'build' : {
|
||||
'libraries' : [
|
||||
'GRAPHICS','LCD_SDL',
|
||||
'FILESYSTEM'
|
||||
'NET',
|
||||
'TENSORFLOW',
|
||||
'GRAPHICS',
|
||||
'FILESYSTEM',
|
||||
'CRYPTO','SHA256','SHA512',
|
||||
'TLS',
|
||||
'TELNET',
|
||||
],
|
||||
'makefile' : [
|
||||
# 'DEFINES+=-DFLASH_64BITS_ALIGNMENT=1', # For testing 64 bit flash writes
|
||||
# 'CFLAGS+=-m32', 'LDFLAGS+=-m32', 'DEFINES+=-DUSE_CALLFUNCTION_HACK', # For testing 32 bit builds
|
||||
'DEFINES+=-DESPR_UNICODE_SUPPORT=1',
|
||||
'DEFINES+=-DUSE_FONT_6X8 -DGRAPHICS_PALETTED_IMAGES -DGRAPHICS_ANTIALIAS -DESPR_PBF_FONTS -DESPR_GRAPHICS_INTERNAL -DESPR_GRAPHICS_SELF_INIT',
|
||||
'DEFINES+=-DUSE_FONT_6X8 -DGRAPHICS_PALETTED_IMAGES -DGRAPHICS_ANTIALIAS -DESPR_PBF_FONTS',
|
||||
'DEFINES+=-DSPIFLASH_BASE=0 -DSPIFLASH_LENGTH=FLASH_SAVED_CODE_LENGTH', # For Testing Flash Strings
|
||||
'LINUX=1',
|
||||
'INCLUDE += -I$(ROOT)/libs/pipboy',
|
||||
'WRAPPERSOURCES += libs/pipboy/avi.c libs/pipboy/stm32_i2s.c',
|
||||
'WRAPPERSOURCES += libs/pipboy/jswrap_pipboy.c'
|
||||
]
|
||||
}
|
||||
};
|
||||
@ -48,14 +50,11 @@ chip = {
|
||||
'spi' : 3,
|
||||
'i2c' : 3,
|
||||
'adc' : 0,
|
||||
'dac' : 0
|
||||
'dac' : 0,
|
||||
};
|
||||
|
||||
devices = {
|
||||
'USB' : {}, # to convince code that we have a USB port (it's used for the console ion Linux)
|
||||
'LCD' : {
|
||||
'width' : 480, 'height' : 320, 'bpp' : 16, 'controller' : 'sdl'
|
||||
}
|
||||
'USB' : {} # to convince code that we have a USB port (it's used for the console ion Linux)
|
||||
};
|
||||
|
||||
def get_pins():
|
||||
|
||||
65
boards/PIPBOY_LINUX.py
Normal file
65
boards/PIPBOY_LINUX.py
Normal file
@ -0,0 +1,65 @@
|
||||
#!/bin/false
|
||||
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
|
||||
#
|
||||
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
# ----------------------------------------------------------------------------------------
|
||||
# This file contains information for a specific board - the available pins, and where LEDs,
|
||||
# Buttons, and other in-built peripherals are. It is used to build documentation as well
|
||||
# as various source and header files for Espruino.
|
||||
# ----------------------------------------------------------------------------------------
|
||||
|
||||
import pinutils;
|
||||
info = {
|
||||
'name' : "Pipboy Linux Debug Compilation",
|
||||
'default_console' : "EV_USBSERIAL",
|
||||
'variables' : 5000, # 0 = resizable variables, rather than fixed
|
||||
'binary_name' : 'espruino_pb',
|
||||
'build' : {
|
||||
'libraries' : [
|
||||
'GRAPHICS','LCD_SDL',
|
||||
'FILESYSTEM'
|
||||
],
|
||||
'makefile' : [
|
||||
# 'DEFINES+=-DFLASH_64BITS_ALIGNMENT=1', # For testing 64 bit flash writes
|
||||
# 'CFLAGS+=-m32', 'LDFLAGS+=-m32', 'DEFINES+=-DUSE_CALLFUNCTION_HACK', # For testing 32 bit builds
|
||||
'DEFINES+=-DLINUX -DEMULATED',
|
||||
'DEFINES+=-DESPR_UNICODE_SUPPORT=1',
|
||||
'DEFINES+=-DUSE_FONT_6X8 -DGRAPHICS_PALETTED_IMAGES -DGRAPHICS_ANTIALIAS -DESPR_PBF_FONTS -DESPR_GRAPHICS_INTERNAL -DESPR_GRAPHICS_SELF_INIT',
|
||||
'DEFINES+=-DSPIFLASH_BASE=0 -DSPIFLASH_LENGTH=FLASH_SAVED_CODE_LENGTH', # For Testing Flash Strings
|
||||
'LINUX=1',
|
||||
'INCLUDE += -I$(ROOT)/libs/pipboy',
|
||||
'WRAPPERSOURCES += libs/pipboy/avi.c libs/pipboy/stm32_i2s.c',
|
||||
'WRAPPERSOURCES += libs/pipboy/jswrap_pipboy.c'
|
||||
]
|
||||
}
|
||||
};
|
||||
chip = {
|
||||
'part' : "LINUX",
|
||||
'family' : "LINUX",
|
||||
'package' : "",
|
||||
'ram' : 0,
|
||||
'flash' : 256, # size of file used to fake flash memory (kb)
|
||||
'speed' : -1,
|
||||
'usart' : 6,
|
||||
'spi' : 3,
|
||||
'i2c' : 3,
|
||||
'adc' : 0,
|
||||
'dac' : 0
|
||||
};
|
||||
|
||||
devices = {
|
||||
'USB' : {}, # to convince code that we have a USB port (it's used for the console ion Linux)
|
||||
'LCD' : {
|
||||
'width' : 480, 'height' : 320, 'bpp' : 16, 'controller' : 'sdl'
|
||||
}
|
||||
};
|
||||
|
||||
def get_pins():
|
||||
pins = pinutils.generate_pins(0,32)
|
||||
# just fake pins D0 .. D32
|
||||
return pins
|
||||
@ -45,12 +45,6 @@ info = {
|
||||
# 'DEFINES+=-DFSMC_BITBANG',
|
||||
'PRECOMPILED_OBJS+=$(ROOT)/targetlibs/stm32f4/lib/startup_stm32f40_41xxx.o',
|
||||
'TARGETSOURCES+=targetlibs/stm32f4/lib/stm32f4xx_fsmc.c',
|
||||
'INCLUDE += -I$(ROOT)/libs/pipboy',
|
||||
'WRAPPERSOURCES += libs/pipboy/avi.c libs/pipboy/stm32_i2s.c',
|
||||
'WRAPPERSOURCES += libs/pipboy/jswrap_pipboy.c',
|
||||
'WRAPPERSOURCES += libs/graphics/jswrap_font_monofonto_145.c',
|
||||
'WRAPPERSOURCES += libs/graphics/jswrap_font_monofonto_23.c',
|
||||
'WRAPPERSOURCES += libs/graphics/jswrap_font_monofonto_18.c',
|
||||
# 'USE_DFU=1'
|
||||
]
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ DSTATUS disk_initialize (
|
||||
//jsiConsolePrint("SD_Init\n");
|
||||
SD_Init();
|
||||
#ifndef STM32F4
|
||||
// FIXME: Do we even need this in EspruoinoBoard? seems like SD_GetCardInfo especially just wastes time
|
||||
// FIXME: Do we even need this in EspruinoBoard? seems like SD_GetCardInfo especially just wastes time
|
||||
//jsiConsolePrint("SD_GetCardInfo\n");
|
||||
SD_GetCardInfo(&SDCardInfo2);
|
||||
//jsiConsolePrint("SD_SelectDeselect\n");
|
||||
@ -38,10 +38,6 @@ DSTATUS disk_initialize (
|
||||
//jsiConsolePrint("SD_SetDeviceMode\n");
|
||||
SD_SetDeviceMode(SD_DMA_MODE);
|
||||
#endif
|
||||
/* jsiConsolePrintf("CardComdClasses %d\n", SDCardInfo2.SD_csd.CardComdClasses);
|
||||
jsiConsolePrintf("RdBlockLen %d\n", SDCardInfo2.SD_csd.RdBlockLen);
|
||||
jsiConsolePrintf("RdBlockMisalign %d\n", SDCardInfo2.SD_csd.RdBlockMisalign);
|
||||
jsiConsolePrintf("CardType %d\n", SDCardInfo2.CardType);*/
|
||||
|
||||
//jsiConsolePrint("NVIC_Init\n");
|
||||
NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn;
|
||||
|
||||
@ -489,57 +489,4 @@ bool jswrap_fs_mkdir(JsVar *path) {
|
||||
}
|
||||
|
||||
|
||||
/*JSON{
|
||||
"type" : "staticmethod",
|
||||
"class" : "fs",
|
||||
"name" : "video",
|
||||
"ifndef" : "SAVE_ON_FLASH",
|
||||
"generate" : "jswrap_fs_video",
|
||||
"params" : [
|
||||
["path","JsVar","The path of the file to read"]
|
||||
]
|
||||
}
|
||||
Read all data from a file and return as a string.
|
||||
|
||||
**Note:** The size of files you can load using this method is limited by the
|
||||
amount of available RAM. To read files a bit at a time, see the `File` class.
|
||||
*/
|
||||
void jswrap_fs_video(JsVar *path) {
|
||||
#ifndef LINUX
|
||||
volatile unsigned short *LCD_RAM = ((volatile unsigned short *) 0x60080000); /* RS = 1 (D13 -> A18) */
|
||||
volatile unsigned short *LCD_REG = ((volatile unsigned short *) 0x60000000);
|
||||
|
||||
char pathStr[JS_DIR_BUF_SIZE] = "";
|
||||
if (!jsfsGetPathString(pathStr, path)) return;
|
||||
|
||||
if (jsfsInit()) {
|
||||
BYTE ff_mode = FA_READ | FA_OPEN_EXISTING;
|
||||
FRESULT res;
|
||||
File_Handle file;
|
||||
const uint16_t buffer[2048];
|
||||
if ((res=f_open(&file, pathStr, ff_mode)) == FR_OK) {
|
||||
*LCD_REG = 0x2A;
|
||||
*LCD_RAM = 0;
|
||||
*LCD_RAM = 0;
|
||||
*LCD_RAM = 0;
|
||||
*LCD_RAM = 239;
|
||||
*LCD_REG = 0x2B;
|
||||
*LCD_RAM = 0;
|
||||
*LCD_RAM = 0;
|
||||
*LCD_RAM = 319>>8;
|
||||
*LCD_RAM = 319&0xFF;
|
||||
*LCD_REG = 0x2C;
|
||||
size_t actual = 1;
|
||||
while (actual && !jspIsInterrupted()) {
|
||||
res = f_read(&file, (uint8_t*)buffer, sizeof(buffer), &actual);
|
||||
for (size_t i=0;i<(actual>>1);i++) {
|
||||
*LCD_RAM = buffer[i];
|
||||
}
|
||||
}
|
||||
f_close(&file);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,5 +27,4 @@ bool jswrap_fs_unlink(JsVar *path);
|
||||
JsVar *jswrap_fs_stat(JsVar *path);
|
||||
bool jswrap_fs_mkdir(JsVar *path);
|
||||
void jswrap_fs_sync();
|
||||
void jswrap_fs_video(JsVar *path);
|
||||
JsVar *jswrap_fs_getfree(JsVar *path);
|
||||
@ -35,6 +35,7 @@ void STM32_I2S_Start() {};
|
||||
void STM32_I2S_Stop() {};
|
||||
void STM32_I2S_StreamEnded() {};
|
||||
uint16_t *STM32_I2S_GetSampleBufferPtr() { return 0; }
|
||||
STM32_I2S_Status STM32_I2S_GetStatus() { return STM32_I2S_STOPPED; }
|
||||
#else // not LINUX
|
||||
|
||||
#include "stm32f4xx_spi.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user