Skip to content

Instantly share code, notes, and snippets.

View ElektroNeo's full-sized avatar
💻
Embedded System Engineer

Bahtiyar Bayram ElektroNeo

💻
Embedded System Engineer
View GitHub Profile
@ElektroNeo
ElektroNeo / main.c
Created August 9, 2022 14:12
Using Struct in Embedded C
/*
* File: main.c
* Author: Bahtiyar Bayram
*
* Created on 20 July 2022, 14:54
*/
#include "main.h"
#define GPIO_OUTPUT 0
@ElektroNeo
ElektroNeo / main.c
Created July 20, 2022 12:43
Struct Usage in Embedded Programming
/*
* File: main.c
* Author: Bahtiyar Bayram
*
* Created on 20 July 2022, 14:54
*/
#include "main.h"
#define GPIO_OUTPUT 0
@ElektroNeo
ElektroNeo / main.c
Last active May 6, 2021 12:52
Telemetry data encoder and decoder functions.
#include <stdio.h>
#include <stdint.h>
#define MAX_TLM_DATA 32
/* Encode function */
void encode(uint8_t *data, uint16_t *dataCounter, uint32_t val, uint8_t bitSize) {
uint8_t dataIndex;
for(uint8_t i = bitSize; i > 0; i--) {
dataIndex = (*dataCounter) / 8;
@ElektroNeo
ElektroNeo / Button-Input.c
Last active November 16, 2019 20:01
GPIO operations (3) for PIC16F1508 microcontroller.
short btn1 = PORTAbits.RA0;
short btn2 = PORTAbits.RA1;
@ElektroNeo
ElektroNeo / PIC16F1508-GPIO-Operations-1.c
Last active November 16, 2019 20:05
GPIO operations (2) for PIC16F1508 microcontroller.
// PIC16F1508 Configuration Bit Settings
// 'C' source line config statements
// CONFIG1
#pragma config FOSC = INTOSC // Oscillator Selection Bits (INTOSC oscillator: I/O function on CLKIN pin)
#pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled)
#pragma config MCLRE = ON // MCLR Pin Function Select (MCLR/VPP pin function is MCLR)
#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled)
@ElektroNeo
ElektroNeo / PIC16F1508-GPIO-Operations-1.c
Last active July 11, 2019 17:51
GPIO operations (1) for PIC16F1508 microcontroller.
/*
* File: main.c
* Author: elektroneo
*
* Created on July 5, 2019, 10:31 PM
*/
// PIC16F1508 Configuration Bit Settings