Skip to content

Commit c516cba

Browse files
authored
Merge branch 'master' into qr-code
2 parents 15154a7 + 59d1de0 commit c516cba

File tree

21 files changed

+188
-259
lines changed

21 files changed

+188
-259
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ fujinet_releases/*
5858
*~
5959
*.orig
6060
*.rej
61+
*.lst
6162

6263
# espressif managed components
6364
managed_components

coding-standard.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ class FormatError(Enum):
4646
IllegalTabs = auto()
4747
CodingStandardViolation = auto()
4848

49+
class TabsOk(Enum):
50+
Nope = auto() # Calling it "None" seems confusing
51+
Leading = auto()
52+
AllTabs = auto()
53+
4954
ErrorStrings = {
5055
FormatError.TrailingWhitespace: "Trailing whitespace",
5156
FormatError.IllegalTabs: "Tab characters",
@@ -140,9 +145,11 @@ def __init__(self, path, contents=None):
140145
if contents is None:
141146
raise ValueError("Contents not provided")
142147

143-
self.allowLeadingTab = False
148+
self.allowTabs = TabsOk.Nope
144149
if self.isMakefile:
145-
self.allowLeadingTab = True
150+
self.allowTabs = TabsOk.Leading
151+
elif self.isAssembly:
152+
self.allowTabs = TabsOk.AllTabs
146153

147154
return
148155

@@ -153,7 +160,7 @@ def splitLeadingTab(self, line):
153160
"""
154161
prefix = ""
155162
suffix = line
156-
if self.allowLeadingTab:
163+
if self.allowTabs == TabsOk.Leading:
157164
if line and line[0] == '\t':
158165
prefix = line[:1]
159166
suffix = line[1:]
@@ -177,7 +184,7 @@ def fixupWhitespace(self):
177184
lines = []
178185
for line in self.contents:
179186
line = line.rstrip()
180-
if "\t" in line:
187+
if self.allowTabs != TabsOk.AllTabs and "\t" in line:
181188
prefix, suffix = self.splitLeadingTab(line)
182189
while "\t" in suffix:
183190
column = suffix.index("\t")
@@ -243,9 +250,6 @@ def checkFormatting(self, repo):
243250
else:
244251
formatted = self.fixupWhitespace()
245252

246-
elif self.isMakefile:
247-
formatted = self.fixupWhitespace()
248-
249253
else:
250254
formatted = self.fixupWhitespace()
251255

@@ -268,7 +272,7 @@ def classifyErrors(self):
268272
trailingStart = len(line.rstrip())
269273
line = line[:trailingStart]
270274
prefix, suffix = self.splitLeadingTab(line)
271-
if "\t" in suffix:
275+
if self.allowTabs != TabsOk.AllTabs and "\t" in suffix:
272276
errors.add(FormatError.IllegalTabs)
273277
break
274278

@@ -317,6 +321,12 @@ def isMakefile(self):
317321
return True
318322
return False
319323

324+
@property
325+
def isAssembly(self):
326+
if self.path.suffix in [".asm", ".s"]:
327+
return True
328+
return False
329+
320330
@property
321331
def isPython(self):
322332
if self.path.suffix == ".py" or self.contents[0].startswith("#!/usr/bin/env python"):
0 Bytes
Binary file not shown.

include/fujiDeviceID.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef FUJI_DEVICES_H
2+
#define FUJI_DEVICES_H
3+
4+
enum fujiDeviceID_t {
5+
FUJI_DEVICEID_FUJINET = 0x70,
6+
7+
FUJI_DEVICEID_DISK = 0x31,
8+
FUJI_DEVICEID_DISK_LAST = 0x3F,
9+
FUJI_DEVICEID_PRINTER = 0x40,
10+
FUJI_DEVICEID_PRINTER_LAST = 0x43,
11+
FUJI_DEVICEID_VOICE = 0x43,
12+
FUJI_DEVICEID_CLOCK = 0x45,
13+
FUJI_DEVICEID_SIO2BT_SMART = 0x45, // Doubles as APETime and "High Score Submission" to URL
14+
FUJI_DEVICEID_ASPEQT = 0x46,
15+
FUJI_DEVICEID_SIO2BT_NET = 0x4E,
16+
FUJI_DEVICEID_TYPE3POLL = 0x4F,
17+
FUJI_DEVICEID_SERIAL = 0x50,
18+
FUJI_DEVICEID_SERIAL_LAST = 0x53,
19+
FUJI_DEVICEID_CPM = 0x5A,
20+
FUJI_DEVICEID_CASSETTE = 0x5F,
21+
FUJI_DEVICEID_PCLINK = 0x6F,
22+
FUJI_DEVICEID_NETWORK = 0x71,
23+
FUJI_DEVICEID_NETWORK_LAST = 0x78,
24+
FUJI_DEVICEID_MIDI = 0x99,
25+
};
26+
27+
#endif /* FUJI_DEVICES_H */

lib/bus/comlynx/comlynx.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class virtualDevice
174174
* @brief Do any tasks that can only be done when the bus is quiet
175175
*/
176176
virtual void comlynx_idle();
177-
177+
178178
/**
179179
* @brief send current status of device
180180
*/
@@ -189,7 +189,7 @@ class virtualDevice
189189
* @brief send status response
190190
*/
191191
virtual void comlynx_response_status();
192-
192+
193193
/**
194194
* @brief command frame, used by network protocol, ultimately
195195
*/
@@ -234,7 +234,7 @@ class virtualDevice
234234
*/
235235
uint8_t id() { return _devnum; }
236236

237-
237+
238238
};
239239

240240
/**
@@ -247,7 +247,7 @@ class systemBus
247247
virtualDevice *_activeDev = nullptr;
248248
lynxFuji *_fujiDev = nullptr;
249249
lynxPrinter *_printerDev = nullptr;
250-
250+
251251

252252
void _comlynx_process_cmd();
253253
void _comlynx_process_queue();
@@ -272,15 +272,15 @@ class systemBus
272272
//int64_t comlynx_idle_time = 1000;
273273

274274
int numDevices();
275-
void addDevice(virtualDevice *pDevice, uint8_t device_id);
275+
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
276276
void remDevice(virtualDevice *pDevice);
277-
void remDevice(uint8_t device_id);
278-
bool deviceExists(uint8_t device_id);
279-
void enableDevice(uint8_t device_id);
280-
void disableDevice(uint8_t device_id);
281-
virtualDevice *deviceById(uint8_t device_id);
282-
void changeDeviceId(virtualDevice *pDevice, uint8_t device_id);
283-
bool deviceEnabled(uint8_t device_id);
277+
void remDevice(FujiDeviceID device_id);
278+
bool deviceExists(FujiDeviceID device_id);
279+
void enableDevice(FujiDeviceID device_id);
280+
void disableDevice(FujiDeviceID device_id);
281+
virtualDevice *deviceById(FujiDeviceID device_id);
282+
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
283+
bool deviceEnabled(FujiDeviceID device_id);
284284
QueueHandle_t qComlynxMessages = nullptr;
285285
void setUDPHost(const char *newhost, int port); // Set new host/ip & port for UDP Stream
286286

lib/bus/cx16_i2c/cx16_i2c.h

Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,68 +9,37 @@
99
#include <string>
1010
#include <driver/i2c.h>
1111

12-
#define CX16_DEVICEID_DISK 0x31
13-
#define CX16_DEVICEID_DISK_LAST 0x3F
14-
15-
#define CX16_DEVICEID_PRINTER 0x40
16-
#define CX16_DEVICEID_PRINTER_LAST 0x43
17-
18-
#define CX16_DEVICEID_FN_VOICE 0x43
19-
20-
#define CX16_DEVICEID_APETIME 0x45
21-
22-
#define CX16_DEVICEID_TYPE3POLL 0x4F
23-
24-
#define CX16_DEVICEID_RS232 0x50
25-
#define CX16_DEVICEID_RS2323_LAST 0x53
26-
27-
#define CX16_DEVICEID_CASSETTE 0x5F
28-
29-
#define CX16_DEVICEID_FUJINET 0x70
30-
#define CX16_DEVICEID_FN_NETWORK 0x71
31-
#define CX16_DEVICEID_FN_NETWORK_LAST 0x78
32-
33-
#define CX16_DEVICEID_MIDI 0x99
34-
35-
#define CX16_DEVICEID_SIO2BT_NET 0x4E
36-
#define CX16_DEVICEID_SIO2BT_SMART 0x45 // Doubles as APETime and "High Score Submission" to URL
37-
#define CX16_DEVICEID_APE 0x45
38-
#define CX16_DEVICEID_ASPEQT 0x46
39-
#define CX16_DEVICEID_PCLINK 0x6F
40-
41-
#define CX16_DEVICEID_CPM 0x5A
42-
43-
#define I2C_SLAVE_TX_BUF_LEN 255
12+
#define I2C_SLAVE_TX_BUF_LEN 255
4413
#define I2C_SLAVE_RX_BUF_LEN 32
4514
#define I2C_DEVICE_ID 0x70
4615

4716
/**
4817
* | Address | R/W | Description
4918
* |--- |--- |---
5019
* | 0 | W | Device ID
51-
* | 1 | W | Command
52-
* | 2 | W | Aux1
53-
* | 3 | W | Aux2
20+
* | 1 | W | Command
21+
* | 2 | W | Aux1
22+
* | 3 | W | Aux2
5423
* | 4 | W | Checksum of addresses 0-3
5524
* | 5 | R | (A)CK/(N)ACK
5625
* | 6 | R | (C)OMPLETE/(E)RROR
5726
* | 7 | R/W | Payload Length (LO)
5827
* | 8 | R/W | Payload Length (HI)
59-
* | 9 | R/W | Payload Data (auto-increment)
60-
*
28+
* | 9 | R/W | Payload Data (auto-increment)
29+
*
6130
* Any write to address 0 will zero out all other addresses.
6231
* Read to address 0 to perform command
63-
*
32+
*
6433
* So the sequence to perform a command to the fujinet:
65-
*
34+
*
6635
* 1. Write addresses 0-4 for command frame.
6736
* 2. if a write payload is needed, write length lo/hi, then write payload data for # of bytes in length
6837
* 3. READ from address 0 to perform command.
6938
* 4. Check ACK/NAK
7039
* 5. Check COMPLETE/ERROR
71-
*
40+
*
7241
* Alternatively, to perform a command from fujinet to the CX16:
73-
*
42+
*
7443
* 1. Write addresses 0-4 for the command frame.
7544
* 2. If a read payload is expected, write length lo/hi.
7645
* 3. READ from address 0 to perform command.
@@ -129,7 +98,7 @@ class virtualDevice
12998
/**
13099
* @brief The passed in command frame, copied.
131100
*/
132-
cmdFrame_t cmdFrame;
101+
cmdFrame_t cmdFrame;
133102

134103
/**
135104
* @brief Message queue
@@ -337,7 +306,7 @@ class systemBus
337306
* @param pDevice Pointer to virtualDevice
338307
* @param device_id The ID to assign to virtualDevice
339308
*/
340-
void addDevice(virtualDevice *pDevice, int device_id);
309+
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
341310

342311
/**
343312
* @brief Remove device from bus
@@ -350,14 +319,14 @@ class systemBus
350319
* @param device_id ID of device to return.
351320
* @return pointer to virtualDevice
352321
*/
353-
virtualDevice *deviceById(int device_id);
322+
virtualDevice *deviceById(FujiDeviceID device_id);
354323

355324
/**
356325
* @brief Change ID of a particular virtualDevice
357326
* @param pDevice pointer to virtualDevice
358-
* @param device_id new device ID
327+
* @param device_id new device ID
359328
*/
360-
void changeDeviceId(virtualDevice *pDevice, int device_id);
329+
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
361330

362331
/**
363332
* @brief Are we shutting down?

lib/bus/h89/h89.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class virtualDevice
5656
virtual void reset() {};
5757

5858
/**
59-
* @brief All H89 devices repeatedly call this routine to fan out to other methods for each command.
59+
* @brief All H89 devices repeatedly call this routine to fan out to other methods for each command.
6060
* This is typcially implemented as a switch() statement.
6161
*/
6262
virtual void process(uint32_t commanddata, uint8_t checksum) = 0;
63-
63+
6464
/**
6565
* @brief send current status of device
6666
*/
@@ -97,20 +97,20 @@ class systemBus
9797

9898
public:
9999
void setup(); // one time setup
100-
void service(); // this runs in a loop
100+
void service(); // this runs in a loop
101101
void shutdown(); // shutdown
102102
void reset(); // reset
103103

104104
int numDevices();
105-
void addDevice(virtualDevice *pDevice, uint8_t device_id);
105+
void addDevice(virtualDevice *pDevice, FujiDeviceID device_id);
106106
void remDevice(virtualDevice *pDevice);
107-
void remDevice(uint8_t device_id);
108-
bool deviceExists(uint8_t device_id);
109-
void enableDevice(uint8_t device_id);
110-
void disableDevice(uint8_t device_id);
111-
bool enabledDeviceStatus(uint8_t device_id);
112-
virtualDevice *deviceById(uint8_t device_id);
113-
void changeDeviceId(virtualDevice *pDevice, uint8_t device_id);
107+
void remDevice(FujiDeviceID device_id);
108+
bool deviceExists(FujiDeviceID device_id);
109+
void enableDevice(FujiDeviceID device_id);
110+
void disableDevice(FujiDeviceID device_id);
111+
bool enabledDeviceStatus(FujiDeviceID device_id);
112+
virtualDevice *deviceById(FujiDeviceID device_id);
113+
void changeDeviceId(virtualDevice *pDevice, FujiDeviceID device_id);
114114
QueueHandle_t qH89Messages = nullptr;
115115

116116
bool shuttingDown = false; // TRUE if we are in shutdown process

0 commit comments

Comments
 (0)