/* * * mur.sat * * Somewhen in the year 2012, mur.at will have a nano satellite launched * into a low earth orbit (310 km above the surface of our planet). The * satellite itself is a TubeSat personal satellite kit, developed and * launched by interorbital systems. mur.sat is a joint venture of mur.at, * ESC im Labor and realraum. * * Please visit the project hompage at sat.mur.at for further information. * * * Copyright (C) 2012 Bernhard Tittelbach * * This file is part of mur.sat. * * mur.sat is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * mur.sat is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with mur.sat. If not, see . * */ #include #include //#include #include "led.h" #include "util.h" #include "hhd70.h" #include "c1101lib.h" #define CPU_PRESCALE(n) do { CLKPR = 0x80; CLKPR = (n); } while(0) char read_buffer[64]; // buffer for reading usb signals char write_buffer[64]; // buffer for writing usb signals //TODOs: //* make adc work ? // * remove code duplications // * speed up and simplify code // * make as much use of sleep modes as possible // * use adc noise canceler (i.e. automatic sampling during cpu sleep) // * read atmega temp // * safely save state in eeprom (2 memory regions, only use the one with the "written successfully bit" which is written last) // * what if c1101 resets spuriously and clears it's settings ? -> check peridically ? /* ###### ###### LUFA Library Copyright (C) Dean Camera, 2012. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ //#include //#include #include #include "lufa-descriptor-usbserial.h" /* Global I/O Buffers: */ //static RingBuffer_t SPItoUSB_Buffer; //static uint8_t SPItoUSB_Buffer_Data[8]; /** LUFA CDC Class driver interface configuration and state information. This structure is * passed to all CDC Class driver functions, so that multiple instances of the same class * within a device can be differentiated from one another. */ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { .ControlInterfaceNumber = 0, .DataINEndpointNumber = CDC_TX_EPNUM, .DataINEndpointSize = CDC_TXRX_EPSIZE, .DataINEndpointDoubleBank = false, .DataOUTEndpointNumber = CDC_RX_EPNUM, .DataOUTEndpointSize = CDC_TXRX_EPSIZE, .DataOUTEndpointDoubleBank = false, .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, .NotificationEndpointDoubleBank = false, }, }; void EVENT_USB_Device_ConfigurationChanged(void) { CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); } void EVENT_USB_Device_ControlRequest(void) { CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } /* ###### end LUFA CDC-ACM specific definitions ###### */ int main(void) { CPU_PRESCALE(0); led_init(); hhd70_init(); USB_Init(); DDRB &= ~(1<