@@ -52,18 +52,12 int bsp_init() | |||||
52 |
|
52 | |||
53 | void bsp_GPIO_init() |
|
53 | void bsp_GPIO_init() | |
54 | { |
|
54 | { | |
55 |
gpio_t gpio1 = gpioopen(P |
|
55 | gpio_t gpio1 = gpioopen(PC6);//gpioopen(LED1); //PD9 D=> 0x0300 9 => 0x0009 | |
56 |
gpio_t gpio2 = gpioopen(P |
|
56 | gpio_t gpio2 = gpioopen(PC7);//gpioopen(LED2); | |
57 | gpio_t gpio3 = gpioopen(PD14);//gpioopen(LED2); |
|
|||
58 | gpio_t gpio4 = gpioopen(PD15);//gpioopen(LED2); |
|
|||
59 | gpiosetspeed(&gpio1,gpiohighspeed); |
|
57 | gpiosetspeed(&gpio1,gpiohighspeed); | |
60 | gpiosetspeed(&gpio2,gpiohighspeed); |
|
58 | gpiosetspeed(&gpio2,gpiohighspeed); | |
61 | gpiosetspeed(&gpio3,gpiohighspeed); |
|
|||
62 | gpiosetspeed(&gpio4,gpiohighspeed); |
|
|||
63 | gpiosetdir(&gpio1,gpiooutdir); |
|
59 | gpiosetdir(&gpio1,gpiooutdir); | |
64 | gpiosetdir(&gpio3,gpiooutdir); |
|
|||
65 | gpiosetdir(&gpio2,gpiooutdir); |
|
60 | gpiosetdir(&gpio2,gpiooutdir); | |
66 | gpiosetdir(&gpio4,gpiooutdir); |
|
|||
67 | } |
|
61 | } | |
68 |
|
62 | |||
69 | void bsp_uart_init() |
|
63 | void bsp_uart_init() | |
@@ -72,13 +66,13 void bsp_uart_init() | |||||
72 | { |
|
66 | { | |
73 | //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t)); |
|
67 | //uart_t* uart1 = (uart_t*)malloc(sizeof(uart_t)); | |
74 | streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice)); |
|
68 | streamdevice* fd1 = (streamdevice*)malloc(sizeof(streamdevice)); | |
75 |
uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200, |
|
69 | uart_t uart = uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,LED2,LED1,-1,-1); | |
76 | uartmkstreamdev(uart,fd1); |
|
70 | uartmkstreamdev(uart,fd1); | |
77 | __opnfiles__[1] = fd1; |
|
71 | __opnfiles__[1] = fd1; | |
78 | } |
|
72 | } | |
79 | else |
|
73 | else | |
80 | { |
|
74 | { | |
81 |
uartopenandconfig( |
|
75 | uartopenandconfig(uart3,uartparitynone | uart8bits | uartonestop,115200,LED2,LED1,-1,-1); | |
82 | } |
|
76 | } | |
83 | } |
|
77 | } | |
84 |
|
78 |
@@ -73,7 +73,7 int main() | |||||
73 | printf("Sys Tick=%d\n\r",SysTick->VAL); |
|
73 | printf("Sys Tick=%d\n\r",SysTick->VAL); | |
74 | printf("Sys Tick=%d\n\r",SysTick->VAL); |
|
74 | printf("Sys Tick=%d\n\r",SysTick->VAL); | |
75 | ili9328paintFilRect(&lcd0,1,1,3,3,LCD_COLOR_BLACK,1,LCD_COLOR_WHITE); |
|
75 | ili9328paintFilRect(&lcd0,1,1,3,3,LCD_COLOR_BLACK,1,LCD_COLOR_WHITE); | |
76 |
while(1) |
|
76 | while(1)monkDemo(); //randBoxesDemo(); | |
77 | if(-1==ina226open(&ina33VSens,i2c2,INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS|INA226_AVERAGES_16|INA226_BUS_CONV_8244us|INA226_SHUNT_CONV_8244us,0,1,15,1000000)) |
|
77 | if(-1==ina226open(&ina33VSens,i2c2,INA226_MODE_SHUNT_VOLTAGE_CONTINUOUS|INA226_AVERAGES_16|INA226_BUS_CONV_8244us|INA226_SHUNT_CONV_8244us,0,1,15,1000000)) | |
78 | { |
|
78 | { | |
79 | printf("Can't open 3.3V monitor\n\r"); |
|
79 | printf("Can't open 3.3V monitor\n\r"); |
@@ -3,7 +3,8 CONFIG += console | |||||
3 | CONFIG -= qt |
|
3 | CONFIG -= qt | |
4 |
|
4 | |||
5 | #BSP = BEAGLESYNTH |
|
5 | #BSP = BEAGLESYNTH | |
6 | BSP = SOLAR_LFR_PSU |
|
6 | #BSP = SOLAR_LFR_PSU | |
|
7 | BSP=M4Stick | |||
7 | include($$(libuc2)/bsp/cfg/$$BSP/bsp.pri) |
|
8 | include($$(libuc2)/bsp/cfg/$$BSP/bsp.pri) | |
8 | #include($$(libuc2)/rules/stm32f4-arm-none-eabi-gcc/rules.pri) |
|
9 | #include($$(libuc2)/rules/stm32f4-arm-none-eabi-gcc/rules.pri) | |
9 |
|
10 |
@@ -4,21 +4,19 | |||||
4 | #include <uart.h> |
|
4 | #include <uart.h> | |
5 | #include <stm32f4xx.h> |
|
5 | #include <stm32f4xx.h> | |
6 | #include <bsp.h> |
|
6 | #include <bsp.h> | |
7 |
|
7 | #include <core.h> | ||
8 |
|
8 | |||
9 | extern streamdevice* __opnfiles__[]; |
|
9 | extern streamdevice* __opnfiles__[]; | |
10 |
|
10 | |||
11 | int main() |
|
11 | int main() | |
12 | { |
|
12 | { | |
13 | //gpioset(PSU_DISABLE); |
|
|||
14 |
|
|
13 | while(1) | |
15 | { |
|
14 | { | |
16 | for(volatile int i=0;i<1024*2048;i++); |
|
|||
17 | gpioset(LED1); |
|
15 | gpioset(LED1); | |
18 | gpioclr(LED2); |
|
16 | gpioclr(LED2); | |
19 | for(volatile int i=0;i<1024*2048;i++); |
|
|||
20 | gpioclr(LED1); |
|
17 | gpioclr(LED1); | |
21 | gpioset(LED2); |
|
18 | gpioset(LED2); | |
|
19 | printf("Hello\n\r"); | |||
22 | } |
|
20 | } | |
23 | printf("hello world\n\r"); |
|
21 | printf("hello world\n\r"); | |
24 | return 0; |
|
22 | return 0; |
@@ -12,7 +12,7 extern int main(); | |||||
12 | void cpu_init() |
|
12 | void cpu_init() | |
13 | { |
|
13 | { | |
14 | extern uint32_t currentCpuFreq; |
|
14 | extern uint32_t currentCpuFreq; | |
15 |
currentCpuFreq = 1 |
|
15 | currentCpuFreq = 16*1000*1000; | |
16 | enable_FPU(); |
|
16 | enable_FPU(); | |
17 | RCC->CR |= (uint32_t)0x00000001; |
|
17 | RCC->CR |= (uint32_t)0x00000001; | |
18 | FLASH->ACR = FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS; |
|
18 | FLASH->ACR = FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS; |
General Comments 0
You need to be logged in to leave comments.
Login now