Skip to content

Commit a6c4203

Browse files
committed
update to latest Meatloaf code
add serial console shell add display task for RGB LED STRIP/LCD support
1 parent 625dbb7 commit a6c4203

File tree

160 files changed

+17814
-6290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+17814
-6290
lines changed

components/libsmb2/examples/smb2-stat-sync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
9393
t = (time_t)st.smb2_ctime;
9494
printf("Ctime:%s", asctime(localtime(&t)));
9595
t = (time_t)st.smb2_btime;
96-
printf("Btime:%s", asctime(localtime(&t)));
96+
printf("Btime:%s", asctime(localtime(&t)));
9797

9898
smb2_disconnect_share(smb2);
9999
smb2_destroy_url(url);

include/cbm_defines.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ typedef enum
159159
#define TIMING_Tna 32 // Extra delay before first bit is sent
160160
#define TIMEOUT_Tne 250
161161

162-
#define TIMING_Ts 70 // BIT SET-UP TALKER 71us 20us 70us -
162+
#define TIMING_Ts 80 // BIT SET-UP TALKER 71us 20us 70us -
163163
#define TIMING_Ts0 40 // BIT SET-UP LISTENER PRE 57us 47us
164164
#define TIMING_Ts1 30 // BIT SET-UP LISTENER POST 18us 24us
165165
#define TIMING_Tv 20 // DATA VALID VIC20 76us 26us 20us 20us - (Tv and Tpr minimum must be 60μ s for external device to be a talker. )
@@ -204,14 +204,10 @@ typedef enum
204204
// Not Inverted
205205
#define IEC_ASSERTED true
206206
#define IEC_RELEASED false
207-
#define LOW 0x00
208-
#define HIGH 0x01
209207
#else
210208
// Inverted
211209
#define IEC_ASSERTED false
212210
#define IEC_RELEASED true
213-
#define LOW 0x01
214-
#define HIGH 0x00
215211
#endif
216212

217213
#endif // CBMDEFINES_H

include/debug.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626
#include "../lib/hardware/fnUART.h"
2727
#define Serial fnUartDebug
2828

29-
#define Debug_print(...) fnUartDebug.print( __VA_ARGS__ )
30-
#define Debug_printf(...) fnUartDebug.printf( __VA_ARGS__ )
31-
#define Debug_println(...) fnUartDebug.println( __VA_ARGS__ )
32-
#define Debug_printv(format, ...) {fnUartDebug.printf( ANSI_YELLOW "[%s:%u] %s(): " ANSI_GREEN_BOLD format ANSI_RESET "\r\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);}
29+
#define Debug_print(...) printf( __VA_ARGS__ )
30+
#define Debug_printf(format, ...) { printf( format, ##__VA_ARGS__ ); }
31+
#define Debug_println(...) { printf( __VA_ARGS__ ); printf( "\r\n" ); }
32+
#define Debug_printv(format, ...) { printf( ANSI_YELLOW "[%s:%d] %s(): " ANSI_GREEN_BOLD format ANSI_RESET "\r\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);}
3333

3434
#define HEAP_CHECK(x) Debug_printf("HEAP CHECK %s " x "\r\n", heap_caps_check_integrity_all(true) ? "PASSED":"FAILED")
35+
#define DEBUG_MEM_LEAK {Debug_printv("Heap[%lu] Low[%lu] Task[%u]", esp_get_free_heap_size(), esp_get_free_internal_heap_size(), uxTaskGetStackHighWaterMark(NULL));}
3536
#else
3637
// Use util_debug_printf() helper function
3738
#include <utils.h>

include/esp-idf-arduino.h

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// -----------------------------------------------------------------------------
2+
// Copyright (C) 2024 David Hansel
3+
//
4+
// This program is free software; you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation; either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have receikved a copy of the GNU General Public License
15+
// along with this program; if not, write to the Free Software Foundation,
16+
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+
// -----------------------------------------------------------------------------
18+
19+
#ifndef IECESPIDF_H
20+
#define IECESPIDF_H
21+
22+
#include <stdint.h>
23+
#include <memory.h>
24+
#include <esp_timer.h>
25+
#include <driver/gpio.h>
26+
#include <soc/gpio_reg.h>
27+
#include "hal/gpio_hal.h"
28+
#include <freertos/FreeRTOS.h>
29+
30+
#define ARDUINO 2024
31+
#define ESP32
32+
33+
#define PROGMEM
34+
35+
#pragma GCC diagnostic ignored "-Wunused-function"
36+
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
37+
#pragma GCC diagnostic ignored "-Wvolatile"
38+
39+
typedef void (*interruptFcn)(void *);
40+
41+
#define INPUT 0x0
42+
#define OUTPUT 0x1
43+
#define INPUT_PULLUP 0x2
44+
#define LOW 0x0
45+
#define HIGH 0x1
46+
#define FALLING GPIO_INTR_NEGEDGE
47+
#define RISING GPIO_INTR_POSEDGE
48+
#define bit(n) (1<<(n))
49+
#define digitalWrite(pin, v) gpio_set_level((gpio_num_t) pin, v);
50+
#define pinMode(pin, mode) { gpio_reset_pin((gpio_num_t) pin); gpio_set_direction((gpio_num_t)pin, mode==OUTPUT ? GPIO_MODE_OUTPUT : GPIO_MODE_INPUT); if( mode==INPUT_PULLUP ) gpio_pullup_en((gpio_num_t) pin); }
51+
#define digitalPinToGPIONumber(digitalPin) (digitalPin)
52+
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin)&31))
53+
#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
54+
#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
55+
#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
56+
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin)>31)?1:0)
57+
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p))<SOC_GPIO_PIN_COUNT)?digitalPinToGPIONumber(p):NOT_AN_INTERRUPT)
58+
59+
#define noInterrupts() portDISABLE_INTERRUPTS()
60+
#define interrupts() portENABLE_INTERRUPTS()
61+
#define micros() ((uint32_t) esp_timer_get_time())
62+
#define PSTR(x) x
63+
#define strncmp_P strncmp
64+
#define strcmp_P strcmp
65+
#define min(x, y) ((x)<(y) ? (x) : (y))
66+
#define max(x, y) ((x)>(y) ? (x) : (y))
67+
68+
static void delayMicroseconds(uint32_t n)
69+
{
70+
uint32_t s = micros();
71+
while((micros()-s)<n);
72+
}
73+
74+
static void attachInterrupt(uint8_t pin, interruptFcn userFunc, gpio_int_type_t intr_type)
75+
{
76+
static bool interrupt_initialized = false;
77+
78+
if (pin >= SOC_GPIO_PIN_COUNT) return;
79+
80+
if (!interrupt_initialized) {
81+
esp_err_t err = gpio_install_isr_service(0 /* ESP_INTR_FLAG_IRAM */);
82+
interrupt_initialized = (err == ESP_OK) || (err == ESP_ERR_INVALID_STATE);
83+
}
84+
85+
gpio_set_intr_type((gpio_num_t)pin, intr_type);
86+
gpio_isr_handler_add((gpio_num_t)pin, userFunc, NULL);
87+
88+
gpio_hal_context_t gpiohal;
89+
gpiohal.dev = GPIO_LL_GET_HW(GPIO_PORT_0);
90+
gpio_hal_input_enable(&gpiohal, pin);
91+
}
92+
93+
static void detachInterrupt(uint8_t pin)
94+
{
95+
gpio_isr_handler_remove((gpio_num_t)pin);
96+
gpio_set_intr_type((gpio_num_t)pin, GPIO_INTR_DISABLE);
97+
}
98+
99+
#endif

include/pinmap.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
#include "pinmap/atari2600.h"
3131

3232

33+
/* LED Strip NEW */
34+
#define RGB_LED_DATA_PIN PIN_LED_RGB
35+
#define RGB_LED_BRIGHTNESS 15 // max mA the LED can use determines brightness
36+
#define RGB_LED_COUNT 5
37+
#define RGB_LED_TYPE WS2812B
38+
#define RGB_LED_ORDER GRB
39+
3340
#ifndef PIN_DEBUG
3441
#define PIN_DEBUG PIN_IEC_SRQ
3542
#endif

include/pinmap/fujiloaf-rev0.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
#ifndef PINMAP_FUJILOAF_REV0_H
33
#define PINMAP_FUJILOAF_REV0_H
44

5+
// https://www.espressif.com.cn/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf
6+
57
#ifdef PINMAP_FUJILOAF_REV0
8+
9+
// ESP32-WROVER-E-N16R8
10+
#define FLASH_SIZE 16
11+
#define PSRAM_SIZE 8
12+
613
/* SD Card */
714
#define PIN_CARD_DETECT GPIO_NUM_35 // fnSystem.h
815
#define PIN_CARD_DETECT_FIX GPIO_NUM_35 // fnSystem.h
@@ -29,20 +36,11 @@
2936
#define PIN_LED_WIFI GPIO_NUM_2 // led.cpp
3037
#define PIN_LED_BUS GPIO_NUM_12 // 4 FN
3138
#define PIN_LED_BT GPIO_NUM_NC // No BT LED
32-
33-
/* LED Strip NEW */
34-
#define LEDSTRIP_DATA_PIN GPIO_NUM_4
35-
#define LEDSTRIP_COUNT 5
36-
#define LEDSTRIP_BRIGHTNESS 15 // max mA the LED can use determines brightness
37-
#define LEDSTRIP_TYPE WS2812B
38-
#define LEDSTRIP_RGB_ORDER GRB
39-
// LED order on the strip starting with 0
40-
#define LEDSTRIP_WIFI_NUM 0
41-
#define LEDSTRIP_BUS_NUM 4
42-
#define LEDSTRIP_BT_NUM 2
39+
#define PIN_LED_RGB GPIO_NUM_4
4340

4441
/* Audio Output */
4542
#define PIN_DAC1 GPIO_NUM_25 // samlib.h
43+
#define PIN_I2S GPIO_NUM_25
4644

4745
// Reset line is available
4846
#define IEC_HAS_RESET

include/pinmap/iec-nugget.h

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
#ifndef PINMAP_IEC_NUGGET_H
22
#define PINMAP_IEC_NUGGET_H
33

4+
// https://www.wemos.cc/en/latest/d32/d32_pro.html
5+
// https://www.wemos.cc/en/latest/_static/files/sch_d32_pro_v2.0.0.pdf
6+
// https://www.espressif.com.cn/sites/default/files/documentation/esp32-wrover-e_esp32-wrover-ie_datasheet_en.pdf
7+
48
#ifdef PINMAP_IEC_NUGGET
59

10+
// ESP32-WROVER-E-N16R8
11+
#define FLASH_SIZE 16
12+
#define PSRAM_SIZE 8
13+
614
/* SD Card */
7-
// pins 12-15 are used to interface with the JTAG debugger
8-
// so leave them alone if we're using JTAG
9-
#ifndef JTAG
10-
#define PIN_CARD_DETECT GPIO_NUM_15 // fnSystem.h
15+
#define PIN_CARD_DETECT GPIO_NUM_12 // fnSystem.h
1116
#define PIN_CARD_DETECT_FIX GPIO_NUM_15 // fnSystem.h
12-
#endif
1317

1418
#define PIN_SD_HOST_CS GPIO_NUM_4 // LOLIN D32 Pro
1519
#define PIN_SD_HOST_MISO GPIO_NUM_19
@@ -21,39 +25,42 @@
2125
#define PIN_UART0_TX GPIO_NUM_1
2226
#define PIN_UART1_RX GPIO_NUM_9
2327
#define PIN_UART1_TX GPIO_NUM_10
24-
#define PIN_UART2_RX GPIO_NUM_33
25-
#define PIN_UART2_TX GPIO_NUM_21
28+
#define PIN_UART2_RX GPIO_NUM_NC
29+
#define PIN_UART2_TX GPIO_NUM_NC
2630

2731
/* Buttons */
28-
#define PIN_BUTTON_A GPIO_NUM_NC // keys.cpp
32+
#define PIN_BUTTON_A GPIO_NUM_0 // keys.cpp
2933
#define PIN_BUTTON_B GPIO_NUM_NC
3034
#define PIN_BUTTON_C GPIO_NUM_NC
3135

3236
/* LEDs */
33-
#define PIN_LED_WIFI GPIO_NUM_5 // led.cpp
34-
#define PIN_LED_BUS GPIO_NUM_2 // 4 FN
35-
36-
// pins 12-15 are used to interface with the JTAG debugger
37-
// so leave them alone if we're using JTAG
38-
#ifndef JTAG
37+
#define PIN_LED_WIFI GPIO_NUM_2 // led.cpp
38+
#define PIN_LED_BUS GPIO_NUM_5
3939
#define PIN_LED_BT GPIO_NUM_13
40-
#else
41-
#define PIN_LED_BT GPIO_NUM_5 // LOLIN D32 PRO
42-
#endif
40+
#define PIN_LED_RGB GPIO_NUM_13
4341

4442
/* Audio Output */
4543
#define PIN_DAC1 GPIO_NUM_25 // samlib.h
4644

4745
/* Commodore IEC Pins */
48-
//#define IEC_HAS_RESET // Reset line is available
46+
// CLK & DATA lines in/out are split between two pins
47+
//#define IEC_SPLIT_LINES
48+
49+
// Line values are inverted (7406 Hex Inverter Buffer)
50+
//#define IEC_INVERTED_LINES
4951

50-
#define PIN_IEC_RESET GPIO_NUM_34
51-
#define PIN_IEC_ATN GPIO_NUM_32
52-
#define PIN_IEC_CLK_IN GPIO_NUM_33
53-
#define PIN_IEC_CLK_OUT GPIO_NUM_33
54-
#define PIN_IEC_DATA_IN GPIO_NUM_14
55-
#define PIN_IEC_DATA_OUT GPIO_NUM_14
56-
#define PIN_IEC_SRQ GPIO_NUM_27
52+
// Reset line is available
53+
#define IEC_HAS_RESET
54+
// WIRING
55+
// C64 DIN6 D32Pro TFT
56+
#define PIN_IEC_ATN GPIO_NUM_32 // ATN 3 A T-LED 32 10 (PURPLE)
57+
#define PIN_IEC_CLK_IN GPIO_NUM_33 // CLK 4 A T-RST 33 8 (BROWN)
58+
#define PIN_IEC_CLK_OUT GPIO_NUM_33 //
59+
#define PIN_IEC_DATA_IN GPIO_NUM_14 // DATA 5 T-CS 14 2 (BLACK)
60+
#define PIN_IEC_DATA_OUT GPIO_NUM_14 //
61+
#define PIN_IEC_SRQ GPIO_NUM_27 // SRQ 1 T-DC 27 7 (ORANGE)
62+
#define PIN_IEC_RESET GPIO_NUM_34 // RESET 6 A 34 N/C
63+
// GND 2 GND 9 (GREY)
5764

5865
/* Modem/Parallel Switch */
5966
/* Unused with Nugget */

lib/FileSystem/fnFileSMB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int FileHandlerSMB::seek(long int off, int whence)
4444
Debug_printf("%s\n", smb2_get_error(_smb));
4545
return -1;
4646
}
47-
Debug_printf("new pos is %lu\n", new_pos);
47+
Debug_printf("new pos is %llu\n", new_pos);
4848
return 0;
4949
}
5050

lib/FileSystem/fnFsLittleFS.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,6 @@ bool FileSystemLittleFS::start()
249249
Debug_printv(" partition size: %u, used: %u, free: %u\r\n", total, used, total-used);
250250
*/
251251
#endif
252-
253-
// Create SYSTEM DIR if it doesn't exist
254-
//create_path( SYSTEM_DIR );
255252
}
256253

257254
return _started;

lib/FileSystem/fnFsSD.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,6 @@ bool FileSystemSDFAT::start()
685685
Debug_printf(" partition type: %s\r\n", partition_type());
686686
Debug_printf(" partition size: %llu, used: %llu\r\n", total_bytes(), used_bytes());
687687
*/
688-
689-
// Create SYSTEM DIR if it doesn't exist
690-
//create_path( SYSTEM_DIR );
691688
}
692689
else
693690
{

0 commit comments

Comments
 (0)