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
#If you use a TQFP STM32F303.
#If you use a TQFP STM32F303. (x6, x8)
CFLAGS+=-I. -DTQFP32 -DHSE_VALUE=8000000
#From the nucleos(sp?)
#From the nucleos(sp?) (STM32F303xB/xC)
#CFLAGS+=-I. -DHSE_VALUE=25000000
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
#ifdef TQFP32
#define NUM_LIN_LEDS 20
#define USE_NUM_LIN_LEDS 20
#define DFREQ 12500 //XXX Incorrect.
#else
#define NUM_LIN_LEDS 24
#define USE_NUM_LIN_LEDS 24
#define DFREQ 12500
#endif
#include <stdint.h>
extern uint8_t RootNoteOffset; //From embeddedout.c
extern int UseNumLinLeds;
#define NUM_LIN_LEDS 100
#define USE_NUM_LIN_LEDS UseNumLinLeds
#define DFREQ 12500 //Unsure.
#endif

View file

@ -8,7 +8,8 @@
#include <DFT32.h>
#include <embeddednf.h>
#include <embeddedout.h>
#include "spi2812.h"
#include "adc.h"
gpio freepin;
@ -23,10 +24,15 @@ int16_t sampbuff[CIRCBUFSIZE];
volatile int samples;
void ADCCallback( uint16_t adcval )
int UseNumLinLeds = 20;
int Gain = 10;
void ADCCallback( int16_t adcval )
{
#ifdef TQFP32
sampbuff[last_samp_pos] = adcval*2.0;
sampbuff[last_samp_pos] = adcval*Gain;
#else
sampbuff[last_samp_pos] = adcval;
#endif
@ -102,10 +108,6 @@ int main(void)
wf++;
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();
wf = 0;
}