Compare commits

...

2 Commits

Author SHA1 Message Date
steve 7c9b978012 add Display::statusf() 2023-10-20 13:18:38 +01:00
steve 2c2d8146d2 minor updates 2023-10-20 13:01:15 +01:00
5 changed files with 47 additions and 26 deletions

3
acia.h
View File

@ -9,6 +9,7 @@ public:
uint8_t read(Memory::address);
ACIA(serialio &s): _serial(&s) {}
void set_device(serialio *s) { _serial = s; }
// status bits
//
@ -55,6 +56,6 @@ protected:
virtual void write_data(uint8_t);
private:
class serialio *_serial;
serialio *_serial;
};
#endif

View File

@ -1,3 +1,4 @@
#include <stdarg.h>
#include <stdint.h>
#include "hardware.h"
#include "memory.h"
@ -150,6 +151,15 @@ void Display::status(const char *s) {
#endif
}
void Display::statusf(const char *fmt, ...) {
va_list args;
char buf[80];
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
status(buf);
}
void Display::drawPixel(unsigned x, unsigned y, colour_t col) {
x += _xoff;
y += _yoff;

View File

@ -34,6 +34,7 @@ public:
void clear();
void status(const char *s);
void statusf(const char *fmt, ...);
void drawPixel(unsigned x, unsigned y, colour_t col);
void drawString(const char *s, unsigned x, unsigned y);

View File

@ -29,6 +29,38 @@ bool flash_file::seek(uint32_t pos)
#endif
}
bool flash_file::more()
{
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
return files[_fd].available() > 0;
#else
return false;
#endif
}
uint8_t flash_file::read() {
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
return files[_fd].read();
#else
return 0xff;
#endif
}
flash_file::operator bool() const {
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
return files[_fd];
#else
return false;
#endif
}
void flash_file::write(uint8_t b) {
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
files[_fd].write(b);
files[_fd].flush();
#endif
}
bool flash_filer::start()
{
#if defined(USE_LITTLEFS)
@ -50,30 +82,6 @@ void flash_filer::stop()
#endif
}
bool flash_file::more()
{
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
return files[_fd].available() > 0;
#else
return false;
#endif
}
uint8_t flash_file::read() {
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
return files[_fd].read();
#else
return 0xff;
#endif
}
void flash_file::write(uint8_t b) {
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
files[_fd].write(b);
files[_fd].flush();
#endif
}
const char *flash_filer::advance() {
#if defined(USE_SPIFFS) || defined(USE_LITTLEFS)
bool rewound = false;

View File

@ -1,7 +1,7 @@
#ifndef __FLASH_FILER_H__
#define __FLASH_FILER_H__
#define MAX_FILES 3
#define MAX_FILES 5
class flash_file: virtual public serialio {
public:
@ -12,6 +12,7 @@ public:
virtual void write(uint8_t);
bool seek(uint32_t pos);
operator bool() const;
private:
const uint8_t _fd;