-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
writing mock pico code and working on setting up testbase file
- Loading branch information
Showing
12 changed files
with
173 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <stdio.h> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef MOCK_PICO_STDLIB_H | ||
#define MOCK_PICO_STDLIB_H | ||
|
||
#include "mock_pico/printf.h" | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
#include "mock_pico/types.h" | ||
|
||
// Mock for GPIO pin initialization | ||
void gpio_init(uint pin) { | ||
printf("Mock: GPIO pin %d initialized\n", pin); | ||
} | ||
|
||
// Mock for setting GPIO direction | ||
void gpio_set_dir(uint pin, bool out) { | ||
printf("Mock: GPIO pin %d set to direction %s\n", pin, out ? "OUTPUT" : "INPUT"); | ||
} | ||
|
||
// Mock for setting GPIO state | ||
void gpio_put(uint pin, bool value) { | ||
printf("Mock: GPIO pin %d set to %s\n", pin, value ? "HIGH" : "LOW"); | ||
} | ||
|
||
// Mock for reading GPIO state | ||
bool gpio_get(uint pin) { | ||
printf("Mock: GPIO pin %d read\n", pin); | ||
return true; // Simulate high signal | ||
} | ||
|
||
// Mock for sleep/delay function | ||
void sleep_ms(uint32_t ms) { | ||
printf("Mock: Sleep for %d ms\n", ms); | ||
} | ||
|
||
// Mock for UART initialization (if used) | ||
void uart_init(void) { | ||
printf("Mock: UART initialized\n"); | ||
} | ||
|
||
// You can add more mocked functions based on what you use in your code | ||
|
||
#endif // MOCK_PICO_STDLIB_H |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef MOCK_PICO_TYPES_H | ||
#define MOCK_PICO_TYPES_H | ||
|
||
#include <sys/types.h> | ||
|
||
// Add any basic types or stubs needed for your code here | ||
// typedef unsigned int uint; | ||
// typedef unsigned char uint8_t; | ||
// typedef unsigned long long uint64_t; | ||
// typedef unsigned int uint32_t; | ||
// typedef unsigned long size_t; | ||
// Mock absolute_time_t type to match pico-sdk | ||
#if PICO_OPAQUE_ABSOLUTE_TIME_T | ||
typedef struct { | ||
uint64_t _private_us_since_boot; | ||
} absolute_time_t; | ||
#else | ||
typedef uint64_t absolute_time_t; | ||
#endif | ||
|
||
|
||
|
||
// Define other Pico types as needed for your code | ||
|
||
#endif // MOCK_PICO_TYPES_H |
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
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
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
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
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* @author Darrow Hartman | ||
* @date 2024-10-28 | ||
* | ||
* This file contains the main testing entry point for the SAMWISE flight code. | ||
* All testing code should import this file | ||
*/ | ||
|
||
#include <CUnit/CUnit.h> | ||
#include <CUnit/Basic.h> | ||
|
||
#include "init.h" | ||
#include "macros.h" | ||
#include "scheduler/scheduler.h" | ||
#include "slate.h" | ||
|
||
|
||
/** | ||
* Static allocation of the slate. | ||
*/ | ||
slate_t test_slate; | ||
|
||
int test_main() | ||
{ | ||
stdio_init_all(); | ||
LOG_TEST("testbase: Slate uses %d bytes", sizeof(test_slate)); | ||
LOG_TEST("testbase: Initializing everything..."); | ||
ASSERT(init(&test_slate)); | ||
LOG_TEST("testbase: We are in test mode!"); | ||
|
||
return 0; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @author Darrow Hartman | ||
* @date 2024-10-28 | ||
*/ | ||
|
||
#include <CUnit/CUnit.h> | ||
#include <CUnit/Basic.h> | ||
|
||
#include "init.h" | ||
#include "macros.h" | ||
#include "scheduler/scheduler.h" | ||
#include "slate.h" | ||
|
||
int test_main(void); |