boart test board
Dependencies: USBDevice mbed-dev lwip
Fork of USBSerial_HelloWorld by
Diff: main.cpp
- Revision:
- 12:d15a7d7feb12
- Parent:
- 11:eeb36b2beeda
- Child:
- 13:d838b256c7e0
--- a/main.cpp Mon Jul 23 15:13:13 2018 +0000 +++ b/main.cpp Mon Jul 23 21:44:55 2018 +0000 @@ -2,24 +2,56 @@ #include "USBSerial.h" -static USBSerial pc; +static USBSerial pc(0xFFFF, 0x0002, 0x0001); -static DigitalOut BEEP(PB_11); -//static PwmOut BEEP(PB_11); +//static DigitalOut beep(PB_11); +static PwmOut beep(PB_11); -static DigitalOut DIN(PA_7); -static DigitalOut DIN_LIGHT(PB_1); -static DigitalOut UD_PWM(PD_12); -static DigitalOut LR_PWM(PD_13); + /**TIM3 GPIO Configuration + PA7 ------> TIM3_CH2 + PB0 ------> TIM3_CH3 !!!! + PB1 ------> TIM3_CH4 + PB4 ------> TIM3_CH1 + */ + /**TIM4 GPIO Configuration + PD12 ------> TIM4_CH1 + PD13 ------> TIM4_CH2 + */ + +static DigitalIn button(PE_2); +static DigitalIn opn_sw(PD_7); +static DigitalOut din(PA_7); +static DigitalOut din_light(PB_1); +static DigitalOut ud_pwm(PD_12); +static DigitalOut lr_pwm(PD_13); //PwmOut UD_PWM(PD_12); //PwmOut LR_PWM(PD_13); -static Serial WIFI2(PB_10, PC_5); +//static Serial bt(PG_9, PG_14, 9600); // tx, rx USART6 +static Serial rfid(PD_5, PD_6, 9600); // tx, rx USART2 work +//static Serial wifi(PA_9, PA_10, 9600); // tx, rx USART1 +static Serial fifi2(PB_10, PC_5, 9600); // tx, rx USART3 work + +#define I2CADDR1 0x5F // 0xbe +#define I2CADDR2 0x6B // 0xd6 + + static I2C i2c(PB_9, PB_8); int main(void) { + + //wifi.baud(115200); + //wifi2.baud(115200); + + beep.period((float) 0.001); //set la periode a 1khz + beep.write(50); // duty + din = 1; + din_light = 1; + ud_pwm = 1; + lr_pwm = 1; + int i = 1; int devices_found; uint8_t curr_addr; @@ -28,10 +60,10 @@ pc.printf("Program begin\r\n"); wait(1); - while(1) { + while(0) { devices_found = 0; - BEEP = !BEEP; + //beep = !beep; for (i = 0; i < 128; i++) { curr_addr = i << 1; @@ -46,23 +78,15 @@ wait(2); } - WIFI2.baud(115200); - //BEEP.period((float) 0.00001); //set la periode a 1khz - //BEEP.write(50); // duty - DIN = 1; - DIN_LIGHT = 1; - UD_PWM = 1; - LR_PWM = 1; - while(1) { - BEEP = 1; - //BEEP.period((float) 0.001); //set la periode a 1khz - pc.printf("I am a virtual serial port - phase a1\r\n"); + //beep = 1; + //beep.period((float) 0.001); //set la periode a 1khz + pc.printf("I am a virtual serial port - phase a1, btn=%d\r\n", (int) opn_sw.read()); wait(1) ; - BEEP = 0; + //beep = 0; //BEEP.period((float) 0.002); //set la periode a 1khz - pc.printf("I am a virtual serial port - phase a2\r\n"); + pc.printf("I am a virtual serial port - phase a2, btn=%d\r\n", (int) opn_sw.read()); wait(1) ; }