This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Arduino code to communicate with xbox 360 RF module. | |
https://www.electromaker.io/project/view/xbox-360-rf-module-controlled-with-an-arduino-1 | |
GNU General Public License, version 3 or later (GPL3+) | |
*/ | |
#include <avr/sleep.h> | |
#define sync_pin 2 // 電源ボタンをペアリングボタン代わりにする | |
#define data_pin 3 // データ線 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "project.h" | |
CY_ISR(OnIntrupptPaIn) | |
{ | |
uint8_t v = pa_in_GetValue(); | |
for(int i = 0; i < 8; i++){ | |
UART_PutChar((v & 0x80) ? '1' : '0'); | |
v <<= 1; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __`$INSTANCE_NAME`_H__ | |
#define __`$INSTANCE_NAME`_H__ | |
#define `$INSTANCE_NAME`_GetValue() CY_GET_REG8(`$INSTANCE_NAME`_dp__A0_REG) | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`include "cypress.v" | |
module pa_in ( | |
input clock, | |
output isr | |
); | |
localparam RG_IDLE = 3'b000; | |
localparam RG_COPY = 3'b001; | |
reg [2:0]rg_state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module pa_out ( | |
input clock, | |
output led1, | |
output led2, | |
output led3 | |
); | |
reg [7:0] led_out; | |
assign led1 = led_out[2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "project.h" | |
// LED number -> Pin's position | |
#define SEG_LA 0b00000001 | |
#define SEG_LB 0b00000010 | |
#define SEG_LC 0b00000100 | |
#define SEG_LP 0b00001000 | |
#define SEG_LD 0b00010000 | |
#define SEG_LE 0b00100000 | |
#define SEG_LF 0b10000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __`$INSTANCE_NAME`_H__ | |
#define __`$INSTANCE_NAME`_H__ | |
#ifndef __PA_OUT_DEFINED__ | |
#define __PA_OUT_DEFINED__ | |
#define SEG_0 (SEG_LA | SEG_LB | SEG_LC | SEG_LD | SEG_LE | SEG_LF) | |
#define SEG_1 (SEG_LB | SEG_LC) | |
#define SEG_2 (SEG_LA | SEG_LB | SEG_LD | SEG_LE | SEG_LG) | |
#define SEG_3 (SEG_LA | SEG_LB | SEG_LC | SEG_LD | SEG_LG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`include "cypress.v" | |
module pa_out ( | |
input clock, | |
output[7:0] led_out | |
); | |
cy_psoc3_dp #(.cy_dpconfig( | |
{ | |
`CS_ALU_OP_PASS, `CS_SRCA_A0, `CS_SRCB_D0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`include "cypress.v" | |
module flipflop ( | |
input button_in, | |
output led_out | |
); | |
reg ff; | |
always @(posedge button_in) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "project.h" | |
int main(void) | |
{ | |
CyGlobalIntEnable; | |
CyDelay(1000); // wait 1000ms | |
UART_1_Start(); | |
UART_1_UartPutString("Hello World!\n"); |
NewerOlder