license: added MPL header to all source files
This commit is contained in:
parent
2d83f43cfb
commit
c577c23f1f
7 changed files with 108 additions and 100 deletions
13
Board.cpp
13
Board.cpp
|
|
@ -1,9 +1,10 @@
|
||||||
/*
|
// © 2025 A.M. Rowsell <amr@frzn.dev>
|
||||||
* File: Board.cpp
|
|
||||||
* Author: amr
|
// 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
|
||||||
* Created on July 30, 2025, 9:20 PM
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
// defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
#include "Board.hpp"
|
#include "Board.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
13
Board.hpp
13
Board.hpp
|
|
@ -1,9 +1,10 @@
|
||||||
/*
|
// © 2025 A.M. Rowsell <amr@frzn.dev>
|
||||||
* File: Board.hpp
|
|
||||||
* Author: amr
|
// 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
|
||||||
* Created on July 30, 2025, 9:20 PM
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
// defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
#ifndef BOARD_HPP
|
#ifndef BOARD_HPP
|
||||||
#define BOARD_HPP
|
#define BOARD_HPP
|
||||||
|
|
|
||||||
13
NeoPixel.cpp
13
NeoPixel.cpp
|
|
@ -1,9 +1,10 @@
|
||||||
/*
|
// © 2025 A.M. Rowsell <amr@frzn.dev>
|
||||||
* File: NeoPixel.cpp
|
|
||||||
* Author: amr
|
// 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
|
||||||
* Created on July 30, 2025, 9:35 PM
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
// defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
#include "NeoPixel.hpp"
|
#include "NeoPixel.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
13
NeoPixel.hpp
13
NeoPixel.hpp
|
|
@ -1,9 +1,10 @@
|
||||||
/*
|
// © 2025 A.M. Rowsell <amr@frzn.dev>
|
||||||
* File: NeoPixel.hpp
|
|
||||||
* Author: amr
|
// 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
|
||||||
* Created on July 30, 2025, 9:35 PM
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
// defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
#ifndef NEOPIXEL_HPP
|
#ifndef NEOPIXEL_HPP
|
||||||
#define NEOPIXEL_HPP
|
#define NEOPIXEL_HPP
|
||||||
|
|
|
||||||
13
Piece.cpp
13
Piece.cpp
|
|
@ -1,9 +1,10 @@
|
||||||
/*
|
// © 2025 A.M. Rowsell <amr@frzn.dev>
|
||||||
* File: Piece.cpp
|
|
||||||
* Author: amr
|
// 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
|
||||||
* Created on July 30, 2025, 9:21 PM
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
// defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
#include "Piece.hpp"
|
#include "Piece.hpp"
|
||||||
|
|
||||||
|
|
|
||||||
13
Piece.hpp
13
Piece.hpp
|
|
@ -1,9 +1,10 @@
|
||||||
/*
|
// © 2025 A.M. Rowsell <amr@frzn.dev>
|
||||||
* File: Piece.hpp
|
|
||||||
* Author: amr
|
// 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
|
||||||
* Created on July 30, 2025, 9:21 PM
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
|
// defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
#ifndef PIECE_HPP
|
#ifndef PIECE_HPP
|
||||||
#define PIECE_HPP
|
#define PIECE_HPP
|
||||||
|
|
|
||||||
20
main.cpp
20
main.cpp
|
|
@ -6,10 +6,9 @@
|
||||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||||
// defined by the Mozilla Public License, v. 2.0.
|
// defined by the Mozilla Public License, v. 2.0.
|
||||||
|
|
||||||
// PIC32MX270F256B Configuration Bit Settings
|
// PIC32MX270F256B Configuration Bit Settings
|
||||||
|
|
||||||
// 'C' source line config statements
|
// 'C' source line config statements
|
||||||
|
|
||||||
// DEVCFG3
|
// DEVCFG3
|
||||||
#pragma config USERID = 0xBEEF // Enter Hexadecimal value (Enter Hexadecimal value)
|
#pragma config USERID = 0xBEEF // Enter Hexadecimal value (Enter Hexadecimal value)
|
||||||
#pragma config PMDL1WAY = OFF // Peripheral Module Disable Configuration (Allow multiple reconfigurations)
|
#pragma config PMDL1WAY = OFF // Peripheral Module Disable Configuration (Allow multiple reconfigurations)
|
||||||
|
|
@ -61,6 +60,7 @@
|
||||||
volatile uint8_t spi_rx_buffer[8];
|
volatile uint8_t spi_rx_buffer[8];
|
||||||
|
|
||||||
// dummy open to get rid of linker error
|
// dummy open to get rid of linker error
|
||||||
|
|
||||||
extern "C" int open(const char *buf, int flags, int mode) {
|
extern "C" int open(const char *buf, int flags, int mode) {
|
||||||
// Always return failure — no file system.
|
// Always return failure — no file system.
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -68,20 +68,20 @@ extern "C" int open(const char *buf, int flags, int mode) {
|
||||||
|
|
||||||
void sendChar(uint8_t c) {
|
void sendChar(uint8_t c) {
|
||||||
U1TXREG = c;
|
U1TXREG = c;
|
||||||
while(!U1STAbits.TRMT); // wait for transmission
|
while (!U1STAbits.TRMT); // wait for transmission
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t appInfo(uint8_t *msg, uint16_t len) {
|
uint8_t appInfo(uint8_t *msg, uint16_t len) {
|
||||||
uint16_t offset = 0;
|
uint16_t offset = 0;
|
||||||
do {
|
do {
|
||||||
sendChar(*(msg+offset));
|
sendChar(*(msg + offset));
|
||||||
offset++;
|
offset++;
|
||||||
} while(--len);
|
} while (--len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pin mapping:
|
* Pin mapping:
|
||||||
*
|
*
|
||||||
* UART: (for debug)
|
* UART: (for debug)
|
||||||
|
|
@ -101,13 +101,14 @@ uint8_t appInfo(uint8_t *msg, uint16_t len) {
|
||||||
*/
|
*/
|
||||||
#define SL_TRIS TRISAbits.TRISA0
|
#define SL_TRIS TRISAbits.TRISA0
|
||||||
#define SL_LAT LATAbits.LATA0
|
#define SL_LAT LATAbits.LATA0
|
||||||
|
|
||||||
uint8_t initSystem(void) {
|
uint8_t initSystem(void) {
|
||||||
|
|
||||||
/* set up GPIO */
|
/* set up GPIO */
|
||||||
SYSKEY = 0x0;
|
SYSKEY = 0x0;
|
||||||
SYSKEY = 0xAA996655;
|
SYSKEY = 0xAA996655;
|
||||||
SYSKEY = 0x556699AA;
|
SYSKEY = 0x556699AA;
|
||||||
CFGCON &= ~(1<<13); // unlock PPS
|
CFGCON &= ~(1 << 13); // unlock PPS
|
||||||
|
|
||||||
SDI1R = 0b0110; // RC8
|
SDI1R = 0b0110; // RC8
|
||||||
RPC0R = 0b0001; // U1TX
|
RPC0R = 0b0001; // U1TX
|
||||||
|
|
@ -147,7 +148,7 @@ uint8_t initSystem(void) {
|
||||||
DCH0SSA = KVA_TO_PA(&SPI1BUF); // Source: SPI1BUF
|
DCH0SSA = KVA_TO_PA(&SPI1BUF); // Source: SPI1BUF
|
||||||
DCH0DSA = KVA_TO_PA(spi_rx_buffer); // Destination: receive buffer
|
DCH0DSA = KVA_TO_PA(spi_rx_buffer); // Destination: receive buffer
|
||||||
DCH0SSIZ = 1; // Source size = 1 byte
|
DCH0SSIZ = 1; // Source size = 1 byte
|
||||||
DCH0DSIZ = sizeof(spi_rx_buffer); // Destination size = 8 bytes
|
DCH0DSIZ = sizeof (spi_rx_buffer); // Destination size = 8 bytes
|
||||||
DCH0CSIZ = 1; // Cell transfer size = 1 byte
|
DCH0CSIZ = 1; // Cell transfer size = 1 byte
|
||||||
|
|
||||||
DCH0ECONbits.CHSIRQ = _SPI1_VECTOR; // Trigger on SPI1 receive
|
DCH0ECONbits.CHSIRQ = _SPI1_VECTOR; // Trigger on SPI1 receive
|
||||||
|
|
@ -191,12 +192,13 @@ extern "C" int main(void) {
|
||||||
Board gameBoard;
|
Board gameBoard;
|
||||||
NeoPixel boardLights(64);
|
NeoPixel boardLights(64);
|
||||||
|
|
||||||
while(1) {
|
while (1) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// === Interrupt Service Routine for DMA0 (RX complete) ===
|
// === Interrupt Service Routine for DMA0 (RX complete) ===
|
||||||
|
|
||||||
extern "C" void __ISR(_DMA0_VECTOR, IPL3SOFT) DMA0Handler(void) {
|
extern "C" void __ISR(_DMA0_VECTOR, IPL3SOFT) DMA0Handler(void) {
|
||||||
__builtin_disable_interrupts(); // stop additional ints from firing
|
__builtin_disable_interrupts(); // stop additional ints from firing
|
||||||
if (DCH0INTbits.CHBCIF) {
|
if (DCH0INTbits.CHBCIF) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue