Skip to content

Instantly share code, notes, and snippets.

View C47D's full-sized avatar
:octocat:
Working...

Carlos Diaz C47D

:octocat:
Working...
  • México
View GitHub Profile
@C47D
C47D / direcciones_nrf24.c
Last active October 4, 2017 21:06
setter y getter para las direcciones de los pipe del nrf24
#include <stdio.h>
#include <stdint.h>
#include <string.h>
enum nrf24_addresses {
NRF24_PIPE_O = 0,
NRF24_PIPE_1 = 1,
NRF24_PIPE_2 = 2,
NRF24_PIPE_3 = 3,
NRF24_PIPE_4 = 4,
@C47D
C47D / lambda.ino
Created August 5, 2017 02:03
C++ lambdas in TI chip
#define LED1 PN_1
#define LED2 PN_0
#define LED3 PF_4
#define LED4 PF_0
#define SW1 PJ_0
#define SW2 PJ_1
void setup() {
pinMode(LED1, OUTPUT);
pinMode(SW1, INPUT_PULLUP);
@C47D
C47D / gray.v
Last active July 8, 2017 07:01
generic gray code generator written in verilog.
// file: gray.pcf
set_io clk_out 95
set_io gray_leds[3] 96
set_io gray_leds[2] 97
set_io gray_leds[1] 98
set_io gray_leds[0] 99
set_io clk 21
set_io rst 112
// synthesis with yosys for ice40hx1k device (iceStick)
@C47D
C47D / fifo.v
Last active December 6, 2023 07:52
Generic FIFO implemented in verilog.
/**
* Generic FIFO.
* Author: Carlos Diaz (2017)
*
* DISCLAIMER (2021): This implementation was done when I had a few days of
* experience using verilog, I was at school and not really sure what
* I was doing. I choose to make it public in case of me needing it
* in the future, but that was not the case, it's been a long time
* since I tried to learn any HDL.
*
@C47D
C47D / cpp_array.cpp
Created June 23, 2017 01:54
Iterate over an array using C++11 "approach"
/// cpp_array.cpp
#include <array>
#include <iostream>
#include <stdint.h>
int main(void)
{
const std::array<std::uint8_t, 10> array_cpp =
{ 0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08, 0x09, 0x0A };
@C47D
C47D / c_array.c
Created June 23, 2017 01:53
Iterate over an array using C "approach"
/// c_array.c
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
const uint8_t array_c[10] =
{ 0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08, 0x09, 0x0A };
#include <stdio.h>
#include <stdint.h>
int main()
{
const uint8_t arreglo[10] = {0,1,2,3,4,5,6,7,8,9};
uint8_t i;
for(i = sizeof(arreglo); i != 0; i--){
printf("Pos: %d, Contenido: %d\r\n", sizeof(arreglo) - i, arreglo[sizeof(arreglo) - i]);
@C47D
C47D / vendorCommands.py
Last active January 23, 2017 00:44
Basic python scripts to send USB Vendor Commands to PSoC5LP, based on Cypress AN56377
#!/usr/bin/env python3
'''
Basic script to send USB Vendor Commands to PSoC5LP
Based on Cypress AN56377
VID = 0x04B4
PID = 0xE176
@C47D
C47D / interrupt.py
Last active December 30, 2016 06:15
#!/usr/bin/env python3
import time
import usb
import sys
from sys import platform as _platform
# Estos valores se determinan en el proyecto de PSoC
VID = 0x04B4
PID = 0xE177