Update colorchord on the STM32f303

This commit is contained in:
CNLohr 2020-08-05 13:28:14 -04:00
parent 2146a5c3f5
commit bb2cb0dd9e
4 changed files with 35 additions and 18 deletions

View file

@ -32,10 +32,10 @@ CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) \
CFLAGS+=-DDEBUG CFLAGS+=-DDEBUG
#If you use a TQFP STM32F303. #If you use a TQFP STM32F303. (x6, x8)
CFLAGS+=-I. -DTQFP32 -DHSE_VALUE=8000000 CFLAGS+=-I. -DTQFP32 -DHSE_VALUE=8000000
#From the nucleos(sp?) #From the nucleos(sp?) (STM32F303xB/xC)
#CFLAGS+=-I. -DHSE_VALUE=25000000 #CFLAGS+=-I. -DHSE_VALUE=25000000
AFLAGS = $(MCFLAGS) AFLAGS = $(MCFLAGS)

View file

@ -0,0 +1,16 @@
# ColorChord running on an STM32F303
## Step 1: Get the necessiary build enivronment
```
sudo apt-get install build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi openocd
```
## Step 2: Build
```
make
```
Note: Step 2 being called "build" is a misnomer. If you have your board plugged in, it will also flash.

View file

@ -3,15 +3,14 @@
#define CCEMBEDDED #define CCEMBEDDED
#ifdef TQFP32 #include <stdint.h>
#define NUM_LIN_LEDS 20
#define USE_NUM_LIN_LEDS 20 extern uint8_t RootNoteOffset; //From embeddedout.c
#define DFREQ 12500 //XXX Incorrect. extern int UseNumLinLeds;
#else
#define NUM_LIN_LEDS 24 #define NUM_LIN_LEDS 100
#define USE_NUM_LIN_LEDS 24 #define USE_NUM_LIN_LEDS UseNumLinLeds
#define DFREQ 12500 #define DFREQ 12500 //Unsure.
#endif
#endif #endif

View file

@ -8,7 +8,8 @@
#include <DFT32.h> #include <DFT32.h>
#include <embeddednf.h> #include <embeddednf.h>
#include <embeddedout.h> #include <embeddedout.h>
#include "spi2812.h"
#include "adc.h"
gpio freepin; gpio freepin;
@ -23,10 +24,15 @@ int16_t sampbuff[CIRCBUFSIZE];
volatile int samples; volatile int samples;
void ADCCallback( uint16_t adcval )
int UseNumLinLeds = 20;
int Gain = 10;
void ADCCallback( int16_t adcval )
{ {
#ifdef TQFP32 #ifdef TQFP32
sampbuff[last_samp_pos] = adcval*2.0; sampbuff[last_samp_pos] = adcval*Gain;
#else #else
sampbuff[last_samp_pos] = adcval; sampbuff[last_samp_pos] = adcval;
#endif #endif
@ -102,10 +108,6 @@ int main(void)
wf++; wf++;
if( wf == 128 ) if( wf == 128 )
{ {
//uint8_t rdat[20] = { 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff };
//static int countup;
//rdat[5] = sampbuff[last_samp_pos] ;//countup++;
//SendSPI2812( rdat, 4 );
NewFrame(); NewFrame();
wf = 0; wf = 0;
} }