##// END OF EJS Templates
Started SSD2119 driver based on ili9328 driver....
Started SSD2119 driver based on ili9328 driver. -IF more or less functionnal /!\ need to check FSMC config -Need to check mid point circle algo -need to generate good fonts! -Should merge ili and ssd driver in one since the interface is the same, we can detect the chip with Device Code. Added Stm32Discovery extension board bsp.

File last commit:

r58:dcfec4f56803 dev_alexis
r58:dcfec4f56803 dev_alexis
Show More
main.c
115 lines | 2.5 KiB | text/x-c | CLexer
#include <stdio.h>
#include <gpio.h>
#include <uart.h>
#include <stm32f4xx.h>
#include <bsp.h>
#include <core.h>
#include <spi.h>
void ads1278readOut(spi_t spidev,int32_t* data)
{
gpioset(ADC_FSYNC);
//delay_100us(1);
for(volatile int i=0;i<50;i++);
gpioclr(ADC_FSYNC);
for(int i=0;i<8;i++)
{
data[i]=spigetw(spidev)<<16;
data[i]+=spigetw(spidev)<<8;
data[i]+=spigetw(spidev);
if((data[i]&(1<<23)))data[i]-=(1<<24);
}
}
void pushData(int32_t* data)
{
// printf("%f\t%f\t%f\n",(6.0/(8*1000*1000)) *data[0],(6.0/(8*1000*1000))*data[1],(6.0/(8*1000*1000))*data[2]);
printf("%f\n",(6.0/(16*1000*1000)) *data[0]);
}
void pushData2(int32_t* data)
{
char buffer[29];
buffer[0] = 0xa5;
buffer[1] = 0x0f;
buffer[2] = 0x00;
buffer[27] = 0xf0;
buffer[28] = 0x5a;
for(int i=0;i<8;i++)
{
buffer[(i*3)+3] = (char)data[i]>>16;
buffer[(i*3)+4] = (char)data[i]>>8;
buffer[(i*3)+5] = (char)data[i];
}
uartputnc(uart1,buffer,29);
}
void sample()
{
int32_t data[8];
data[0]=0x712345;
char buffer[2+1+3+2];
buffer[0] = 0xa5;
buffer[1] = 0x0f;
buffer[2] = 0x00;
buffer[2+1+3] = 0xf0;
buffer[2+1+4] = 0x5a;
while(1)
{
//uartputnc(uart1,buffer,3);
uartputc(uart1,0xa5);
uartputc(uart1,0x0f);
uartputc(uart1,0x01);
uartputc(uart1,25);
for(int i=0;i<8;i++)
{
//ads1278readOut(spi1,data);
uartputc(uart1,(char)0x1);//(data[0])>>16);
uartputc(uart1,(char)0x2);//(data[0]>>8));
uartputc(uart1,(char)0x3);//(data[0]>>0));
}
uartputc(uart1,0xf0);
uartputc(uart1,0x5a);
}
}
int main()
{
int32_t data[8];
char test=0;
for(int i=0;i<500;i++)
{
ads1278readOut(spi1,data);
delay_100us(10);
}
sample();
//while(1)
//{
// uartputc(uart1,test++);
//}
// while(1)
// {
// ads1278readOut(spi1,data);
// gpioclr(LED2);
// //delay_100us(100);
//// for(volatile int i=0;i<100;i++);
// pushData(data);
// gpioset(LED2);
// //delay_100us(100);
// }
}