Skip to content

Instantly share code, notes, and snippets.

View cms-codes's full-sized avatar

Chris Slothouber cms-codes

View GitHub Profile
@cms-codes
cms-codes / main.cpp
Last active October 4, 2023 01:30
WiFi-Arrgh!
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
const struct rcc_clock_scale rcc_clock_config[RCC_CLOCK_CONFIG_END] = {
[RCC_CLOCK_CONFIG_LSI_32KHZ] = {
/* 32khz from lsi, scale2, 0ws */
.sysclock_source = RCC_LSI,
.hpre = RCC_CFGR_HPRE_NODIV,
.ppre = RCC_CFGR_PPRE_NODIV,
.flash_waitstates = FLASH_ACR_LATENCY_0WS,
.voltage_scale = PWR_SCALE2,
.ahb_frequency = 32000,
.apb_frequency = 32000,
#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/g0/syscfg.h>
#include <libopencm3/stm32/g0/usart.h>
#include "systick.h"
volatile uint32_t systickCount = 0;
// ******* Systick_init *******
// Initializes the SysTick interrupt timer.
// Inputs: none
// Outputs: none
void Systick_init(void)
{
#include <iostream>
#include <string>
#include <assert.h>
class Animal
{
public:
double age;
};
int numDays(int month, int year)
{
if ( (month == 1 ) || (month == 3 ) || (month == 5 ) || (month == 7 ) || (month == 8 ) ||
(month == 10 ) || (month == 12 ) )
{
return 31;
}
if (month == 2)
{
if ( year % 4 != 0 )
@cms-codes
cms-codes / blinky.c
Last active December 24, 2018 16:19
Toggles all the user LEDs on the STM32F3 Discovery board using libopencm3, arm-none-eabi, and OpenOCD to program
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/gpio.h>
#define PORT_LED GPIOE
#define PIN_LED GPIO9
uint16_t outBits[] = { GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO8 };
static void gpio_setup(void)
{
@cms-codes
cms-codes / Lab6.c
Created November 18, 2018 17:34
Solution using structures and linked list
/********* Lab6 *******
* Course: PROG1955-1
* Title: Lab 6
* Purpose: Store the last name and first name of students in a dynamic
* structure using a linked list
* Date: 2018-11-10
* Author: Christopher Slothouber
* File: Lab6.c
*/
@cms-codes
cms-codes / Lab6.c
Last active November 12, 2018 00:15
/********* Lab6 *******
* Course: PROG1955-1
* Title: Lab6
* Purpose: Store the last name and first name of students in a dynamic
structure using a linked list
* Date: 2018-11-10
* Author:
* File: Lab6.c
*/
@cms-codes
cms-codes / orange_you_glad.py
Created July 28, 2018 03:18
So I wanted to test instantiating an object inside another object and the object's constructor requires a reference of the object creating it so I pass it self
class Tree:
def __init__(self):
self.oranges = []
def grow_orange(self):
# Creating an object by passing it self
orange = Orange(self)
self.add_orange(orange)