Skip to content

Instantly share code, notes, and snippets.

#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
extern void busy_loop(void);
extern volatile uint32_t LEDS;
extern volatile struct {
struct {
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
extern void busy_loop(void);
extern volatile uint32_t LEDS;
extern volatile struct {
#include <stdint.h>
#include <stdlib.h>
volatile uint32_t* LEDS = 0x10000;
extern void busy_loop(void);
#define DATA_AMOUNT 128
uint8_t big_honking_data[DATA_AMOUNT] = {0};
#include <stdint.h>
uint32_t* LEDS = 0x10000;
extern void wait(void);
void main(void) {
while (1) {
*LEDS += 1;
wait();
@agrif
agrif / zones.txt
Last active August 17, 2024 17:14
This file has been truncated, but you can view the full file.
Area {
name: "Dun Morogh",
intro: Sound {
volume: 0.0,
items: [],
},
day: Soundscape {
ambience: Sound {
volume: 0.69,
MP
4b8101005a7c0100c500468130812781
b0807d7fdb7f3c7f227f6b7eb57e817d
3a7eaf7de87c9a7d537d687c887c057d
ee7c0a7c657cc97cf37c827bd57bce7c
367ceb7cc07cf37cb27c267d817cf87b
c07c447c357d2e7d2f7d157d7a7ca57c
5d7d767d777d7c7d457d9b7c8a7cd17c
fd7ca27dd77dd37dbe7d877dfb7cc57c
107d957dbf7df97d387e427e237ef57d
@agrif
agrif / demo.bin.c
Created June 16, 2024 10:47
dp32g030 demo board program
#include "demo.bin.h"
void main_thunk(void)
{
// WARNING: Subroutine does not return
main();
}
#![no_std]
const CODE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/dp32g030-hal-flash.bin"));
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct HeaderFn<F>(*const core::marker::PhantomData<F>);
impl<F> HeaderFn<F> {
pub const fn from_addr(addr: usize) -> Self {
Self(addr as *const core::marker::PhantomData<F>)
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct HeaderFn<F>(*const core::marker::PhantomData<F>);
impl<F> HeaderFn<F> {
pub const fn from_addr(addr: usize) -> Self {
Self(addr as *const core::marker::PhantomData<F>)
}
pub fn as_addr(&self) -> usize {
self.0 as usize
const INITREGS: &[u16] = &[
0x0008, // 0x00 (r) : unknown 0
0x1080, // 0x01 (r) : chip id
// 0x02 (rw): power
// [ 15] DSMUTE = 0 (enable soft mute)
// [ 14] MUTE = 0 (disable mute)
// [ 13] MONO = 0 (stereo)
// [ 12] CKSEL = 0 (external clock)
// [ 11] reserved = 0
// [ 10] SKMODE = 0 (wrap)