Skip to content

Commit

Permalink
framework
Browse files Browse the repository at this point in the history
  • Loading branch information
trentgill committed May 7, 2024
1 parent 51a3af8 commit 571f0b4
Show file tree
Hide file tree
Showing 15 changed files with 133 additions and 158 deletions.
2 changes: 1 addition & 1 deletion lib/ashapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#define MAX_DIV_LIST_LEN 24

#define ASHAPER_CHANNELS 4
#define ASHAPER_CHANNELS 8

typedef struct{
int index;
Expand Down
2 changes: 1 addition & 1 deletion lib/casl.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// dynamics should be available for SHAPEs (though not mutables)
// switch to a pooled memory store to enable more complex ASLs to borrow memory from cheap ones

#define SELVES_COUNT 4
#define SELVES_COUNT 8
static Casl* _selves[SELVES_COUNT];


Expand Down
11 changes: 5 additions & 6 deletions lib/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <stdio.h>
#include "stm32f7xx_hal.h" // HAL_Delay()

#include "../ll/adda.h" // _Init(), _Start(), _GetADCValue(), IO_block_t
#include "slopes.h" // S_init(), S_step_v()
#include "ashapes.h" // AShaper_init(), AShaper_v()
#include "detect.h" // Detect_init(), Detect(), Detect_ix_to_p()
Expand Down Expand Up @@ -39,10 +38,10 @@ void IO_Start( void )
// DSP process
IO_block_t* IO_BlockProcess( IO_block_t* b )
{
for( int j=0; j<IN_CHANNELS; j++ ){
Detect_t* d = Detect_ix_to_p(j);
(*d->modefn)( d, b->in[j][b->size-1] );
}
// for( int j=0; j<IN_CHANNELS; j++ ){
// Detect_t* d = Detect_ix_to_p(j);
// (*d->modefn)( d, b->in[j][b->size-1] );
// }
for( int j=0; j<SLOPE_CHANNELS; j++ ){
S_step_v( j
, b->out[j]
Expand All @@ -55,7 +54,7 @@ IO_block_t* IO_BlockProcess( IO_block_t* b )
, b->size
);
}
public_update();
// public_update();
return b;
}
float IO_GetADC( uint8_t channel )
Expand Down
3 changes: 3 additions & 0 deletions lib/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
#include <stm32f7xx.h>
#include <stdbool.h>

#include "../ll/adda.h" // _Init(), _Start(), _GetADCValue(), IO_block_t

void IO_Init( int adc_timer_ix );
void IO_Start( void );

void IO_Process( void );
IO_block_t* IO_BlockProcess( IO_block_t* b );

float IO_GetADC( uint8_t channel );
void IO_SetADCaction( uint8_t channel, const char* mode );
Expand Down
6 changes: 3 additions & 3 deletions lib/l_crowlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ void l_crowlib_init(lua_State* L){
// for chan = 1, #output do
// output[chan] = Output.new( chan )
// end
lua_createtable(L, 4, 0); // 4 array elements
lua_createtable(L, 8, 0); // 8 array elements
lua_setglobal(L, "output"); // -> @0

lua_getglobal(L, "output"); // @1
for(int i=1; i<=4; i++){
for(int i=1; i<=8; i++){
lua_getglobal(L, "Output"); // @2
lua_getfield(L, 2, "new"); // Output.new @3
lua_pushinteger(L, i); // push the key
Expand Down Expand Up @@ -226,7 +226,7 @@ int l_crowlib_crow_reset( lua_State* L ){
lua_settop(L, 0);

lua_getglobal(L, "output"); // @1
for(int i=1; i<=4; i++){
for(int i=1; i<=8; i++){
lua_settop(L, 1); // _G.output is TOS @1
lua_pushinteger(L, i); // @2
lua_gettable(L, 1); // replace @2 with: output[n]
Expand Down
8 changes: 8 additions & 0 deletions lib/l_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ static int l_tp_debug_led(lua_State* L){
return 0;
}

static int l_tp_cherry_led(lua_State* L){
TP_cherry_led( luaL_checkinteger(L, 1)
, luaL_checkinteger(L, 2) );
lua_settop(L, 0);
return 0;
}

static int l_tp_cherry_state(lua_State* L){
int index = luaL_checkinteger(L, 1);
lua_pushinteger( L, TP_cherry_state(index) );
Expand Down Expand Up @@ -76,6 +83,7 @@ static const struct luaL_Reg lib_test[]=
, { "tp_dout" , l_tp_dout }
, { "tp_get_module_id" , l_tp_get_module_id }
, { "tp_debug_led" , l_tp_debug_led }
, { "tp_cherry_led" , l_tp_cherry_led }
, { "tp_cherry_state" , l_tp_cherry_state }
, { "tp_dacmux1" , l_tp_dac_mux_1 }
, { "tp_dacmux2" , l_tp_dac_mux_2 }
Expand Down
2 changes: 1 addition & 1 deletion lib/slopes.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <stdint.h>

// need an Init() fn. send SR as an argument
#define SAMPLE_RATE 48000
#define SAMPLE_RATE 22500
#define iSAMPLE_RATE (1.0/(float)SAMPLE_RATE)
#define SAMPLES_PER_MS ((float)SAMPLE_RATE/1000.0)

Expand Down
4 changes: 3 additions & 1 deletion ll/adda.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ void ADDA_Start( void )
DAC_Start();
}

#include "tp.h"
static IO_block_t b = { .size = ADDA_BLOCK_SIZE };
void ADDA_BlockProcess( uint16_t* dac_pickle_ptr )
void ADDA_BlockProcess( uint32_t* dac_pickle_ptr )
{
// ADC_UnpickleBlock( b.in[0]
// , ADDA_BLOCK_SIZE
Expand All @@ -57,6 +58,7 @@ void ADDA_BlockProcess( uint16_t* dac_pickle_ptr )
, b.out[0]
, ADDA_BLOCK_SIZE
);
TP_debug_led(1, 0);
}

float ADDA_GetADCValue( uint8_t channel )
Expand Down
4 changes: 2 additions & 2 deletions ll/adda.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <stm32f7xx.h>

#define ADDA_BLOCK_SIZE 32
#define ADDA_BLOCK_SIZE 2
#define ADDA_DAC_CHAN_COUNT 8
#define ADDA_ADC_CHAN_COUNT 2

Expand All @@ -14,7 +14,7 @@ typedef struct{

uint16_t ADDA_Init( int adc_timer_ix );
void ADDA_Start( void );
void ADDA_BlockProcess( uint16_t* dac_pickle_ptr );
void ADDA_BlockProcess( uint32_t* dac_pickle_ptr );

float ADDA_GetADCValue( uint8_t channel );

Expand Down
Loading

0 comments on commit 571f0b4

Please sign in to comment.