extern int board_init (void) { #ifdef CONFIG_STM_ASC_SERIAL configSerial (); #endif /* CONFIG_STM_ASC_SERIAL */ return 0; }
int main( void ) { // configure the system SystemInit(); configRedLed(); servos_Init(); mems_Init(); // configure the general UART configSerial(); // configure the mux select line muxControlInit(); // configure the analog sensors analogSensorsInit(); // create the LED task if(xTaskCreate(vLedTask, (signed portCHAR*) "LED",128,NULL, 1, &taskHandles[0]) != pdPASS) { //TODO: the task was not created, do something } // create the serialPort task if(xTaskCreate(vSerialTask, (signed portCHAR*) "SERIAL",1024,NULL, 1, &taskHandles[1]) != pdPASS) { //TODO: the task was not created, do something } // create the MUX task if(xTaskCreate(vMuxTask, (signed portCHAR*) "LED",128,NULL, 1, &taskHandles[2]) != pdPASS) { //TODO: the task was not created, do something } // create the demo task if(xTaskCreate(vDemoTask, (signed portCHAR*) "DEMO",1024,NULL, 1, &taskHandles[2]) != pdPASS) { } taskHandles[4] = 0; //TODO: will need to change when we know how many tasks there will be // enable the interrupts portENABLE_INTERRUPTS(); // start the scheduler vTaskStartScheduler(); // will only get here if there was insufficient memory to create the idle // task. The idle task is created within vTaskStartScheduler(). for( ;; ); return 0; // never gets here }
void *serialTask(void *params) { int fd, i; struct termios oldtio, newtio; int readCnt; char buffer[BUFFER_LENGTH]; char temp[BUFFER_LENGTH]; fd = open(SERIAL_PORT, O_RDWR | O_NOCTTY | O_NDELAY); if (fd <0) { printf("CubieCam/serialThread : Cannot Open %s\n", SERIAL_PORT); return 0; } tcgetattr(fd,&oldtio); memset(&newtio, 0x00, sizeof(newtio)); configSerial(&newtio); tcflush(fd,TCIFLUSH); tcsetattr(fd,TCSANOW,&newtio); printf("CubieCam/serialTask : Serial Port Opened\n"); while(1) { readCnt = read(fd, buffer, BUFFER_LENGTH); if(buffer[0] == STX) { i = 1; while(buffer[i]!=ETX) { temp[i-1] = buffer[i]; i++; } } if(port > 0 && readCnt > 10) { sendMessage(temp); } usleep(200000); } tcsetattr(fd,TCSANOW,&oldtio); close(fd); return 0; }
extern int board_init (void) { #ifdef CONFIG_STM_ASC_SERIAL configSerial (); #endif /* CONFIG_STM_ASC_SERIAL */ #ifdef CONFIG_DRIVER_NET_STM_GMAC fli7510_configure_ethernet (fli7510_ethernet_mii, 0, 0); #endif /* CONFIG_DRIVER_NET_STM_GMAC */ #if defined(CONFIG_SOFT_I2C) /* Configuration for the I2C bus */ configI2c(); #endif /* CONFIG_SOFT_I2C */ return 0; }
bool Babuino::withConfig() { //Serial.println("withConfig()"); _regs.pc = _storage.readByte(_regs.pc, _regs.opCode); switch (_regs.opCode) { case OP_CONFIG_AIN: //Serial.println("config.ain"); return true; case OP_CONFIG_AOUT: //Serial.println("config.aout"); return true; case OP_CONFIG_DIN: //Serial.println("config.din"); setPinDirections(INPUT); return true; case OP_CONFIG_DOUT: //Serial.println("config.dout"); setPinDirections(OUTPUT); return true; case OP_CONFIG_SERIAL: //Serial.println("config.serial"); configSerial(); return true; case OP_CONFIG_SEND: //Serial.println("config.send"); return true; } return false; }