SE3 PSE Binome2023-6
Aller à la navigation
Aller à la recherche
Conception de la manette
SCHÉMATIQUE KiCAD
PCB
Code C
bool GetNextReport(USB_JoystickReport_Data_t* const ReportData)
{
bool InputChanged = false;
/* Clear the report contents */
memset(ReportData, 0, sizeof(USB_JoystickReport_Data_t));
if (~(PINF>>PIN7) & 1) ReportData->Button |= (1 << 1);
if (~(PINF>>PIN6) & 1) ReportData->Button |= (1 << 0);
if (~(PIND>>PIN1) & 1) ReportData->Y = 100;
if (~(PIND>>PIN2) & 1) ReportData->X = 100;
if (~(PIND>>PIN3) & 1) ReportData->X = -100;
if (~(PIND>>PIN5) & 1) ReportData->Y = -100;
InputChanged = 1;
return InputChanged;
}
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
Buttons_Init();
USB_Init();
MCUCR |= (1<<JTD);
MCUCR |= (1<<JTD);
CLKSEL0 = 0b00010101; // sélection de l'horloge externe
CLKSEL1 = 0b00001111; // minimum de 8Mhz
CLKPR = 0b10000000; // modification du diviseur d'horloge (CLKPCE=1)
CLKPR = 0; // 0 pour pas de diviseur (diviseur de 1)
//Boutons A et B
DDRF &= 0b00111111;
PORTF |= 0b11000000;
//Boutons directionnels
DDRD &= 0b11010001;
PORTD |= 0b00101110;
// Allumer les leds
PORTF |= 0b00100011;
PORTE |= 0b01000000;
Montage de la carte :
Fichiers: Fichier:ManetteUSBLilianPierre.zip
gerber: Fichiers: Fichier:SE3-pad-job.gbrjob.zip gerber: Fichiers: Fichier:SE3-pad-LGPC.zip